KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > exceptions > JahiaPageNotFoundException


1 // $Id: JahiaPageNotFoundException.java 5450 2003-11-13 17:39:50Z shuber $
2
//
3
//
4
// ____.
5
// __/\ ______| |__/\. _______
6
// __ .____| | \ | +----+ \
7
// _______| /--| | | - \ _ | : - \_________
8
// \\______: :---| : : | : | \________>
9
// |__\---\_____________:______: :____|____:_____\
10
// /_____|
11
//
12
// . . . i n j a h i a w e t r u s t . . .
13
//
14

15
16 package org.jahia.exceptions;
17
18
19 /**
20  * This exception is raised when a page object is requested and is not
21  * present in the database.
22  *
23  * @author Fulco Houkes
24  * @version 1.0
25  */

26 public class JahiaPageNotFoundException extends JahiaException
27 {
28     private int mPageID;
29
30     //-------------------------------------------------------------------------
31
/** Default constructor
32      *
33      * @param pageID The not-found requested page ID.
34      */

35     public JahiaPageNotFoundException (int pageID)
36     {
37         super ("404 Not found - Page:" + pageID,
38                "404 error - page ["+pageID+"] could not be found in the database or is no longer accessible.",
39                PAGE_ERROR, ERROR_SEVERITY);
40
41         mPageID = pageID;
42     }
43
44     //-------------------------------------------------------------------------
45
/** Constructor
46      *
47      * @param pageIDStr The not-found requested page ID string.
48      */

49
50     public JahiaPageNotFoundException (String JavaDoc pageIDStr)
51     {
52         super ("404 Not found - Page:" + pageIDStr,
53                "404 error - page ["+pageIDStr+"] could not be found in the database or is no longer accessible.",
54                PAGE_ERROR, ERROR_SEVERITY);
55
56         try {
57             mPageID = Integer.parseInt (pageIDStr);
58         }
59         catch (NumberFormatException JavaDoc ex) {
60             mPageID = -1;
61         }
62     }
63
64     public JahiaPageNotFoundException (int pageID, String JavaDoc languageCode, String JavaDoc operationMode)
65     {
66         super ("404 Not found - Page:" + pageID,
67                "404 error - page ["+pageID+"] could not be found for language ["+languageCode+"] in ["+operationMode+"] mode .",
68                PAGE_ERROR, ERROR_SEVERITY);
69
70         mPageID = pageID;
71     }
72
73     //-------------------------------------------------------------------------
74
/** Return the ID of the not found page.
75      */

76     public final int getPageID () {
77         return mPageID;
78     }
79
80 }
81
Popular Tags