KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > engines > shared > JahiaPageEngineTempBean


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12

13 package org.jahia.engines.shared;
14
15 import java.util.Enumeration JavaDoc;
16 import java.util.Hashtable JavaDoc;
17
18 import org.jahia.services.pages.JahiaPage;
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * For use in the Page_Field engine, to handle every page parameters without changing/creating
23  * a real page until the user really want to save it.
24  */

25 public class JahiaPageEngineTempBean implements Serializable JavaDoc {
26
27     private int id;
28     private int siteID;
29     private int parentID;
30     private int pageType;
31     private Hashtable JavaDoc titles = new Hashtable JavaDoc();
32     private int pageTemplateID;
33     private String JavaDoc remoteURL;
34     private int pageLinkID;
35     private String JavaDoc creator;
36     private int linkFieldID;
37     private String JavaDoc operation = Page_Field.RESET_LINK;
38     private boolean sharedTitle;
39     private boolean deleteOldContainer = true;
40
41     public JahiaPageEngineTempBean( int id,
42                                     int siteID,
43                                     int parentID,
44                                     int pageType,
45                                     int pageTemplateID,
46                                     String JavaDoc remoteURL,
47                                     int pageLinkID,
48                                     String JavaDoc creator,
49                                     int linkFieldID ) {
50         this.id = id;
51         this.siteID = siteID;
52         this.parentID = parentID;
53         this.pageType = pageType;
54         this.pageTemplateID = pageTemplateID;
55         this.remoteURL = remoteURL;
56         this.pageLinkID = pageLinkID;
57         this.creator = creator;
58         this.linkFieldID = linkFieldID;
59     } // end constructor
60

61     //------------------------------------------------------------------------
62
public int getID() { return this.id; }
63
64     /** get the site ID
65      *
66      * @return Return the Jahia site ID.
67      */

68     public int getSiteID() {
69         return siteID;
70     }
71
72     //------------------------------------------------------------------------
73
public int getParentID() { return parentID; }
74
75     //------------------------------------------------------------------------
76
public int getPageType() { return pageType; }
77
78     //------------------------------------------------------------------------
79
public String JavaDoc getTitle(String JavaDoc languageCode) { return (String JavaDoc)titles.get(languageCode); }
80
81     //------------------------------------------------------------------------
82
public int getPageTemplateID() { return pageTemplateID; }
83
84     //------------------------------------------------------------------------
85
public String JavaDoc getRemoteURL() { return remoteURL; }
86
87     //------------------------------------------------------------------------
88
public int getPageLinkID() { return pageLinkID; }
89
90     //------------------------------------------------------------------------
91
public String JavaDoc getCreator() { return creator; }
92
93     //------------------------------------------------------------------------
94
public int getLinkFieldID() { return linkFieldID; }
95
96     //------------------------------------------------------------------------
97
public void setSiteID(int siteID) { this.siteID = siteID; }
98
99     //------------------------------------------------------------------------
100
public void setParentID(int parentID) { this.parentID = parentID; }
101
102     //------------------------------------------------------------------------
103
public void setPageType(int pageType) {
104         this.pageType = pageType;
105     }
106
107     //------------------------------------------------------------------------
108
public void setTitle(String JavaDoc languageCode,String JavaDoc title) {
109         if (languageCode == null || title == null) {
110             return;
111         }
112         this.titles.put(languageCode,title);
113     }
114
115     //------------------------------------------------------------------------
116
public void removeTitle(String JavaDoc languageCode) {
117         this.titles.remove(languageCode);
118     }
119
120     //------------------------------------------------------------------------
121
public void setPageTemplateID(int pageTemplateID) {
122         this.pageTemplateID = pageTemplateID;
123     }
124
125     //------------------------------------------------------------------------
126
public void setRemoteURL(String JavaDoc remoteURL) {
127         this.remoteURL = remoteURL;
128     }
129
130     //------------------------------------------------------------------------
131
public void setPageLinkID(int pageLinkID) {
132         this.pageLinkID = pageLinkID;
133     }
134
135     //------------------------------------------------------------------------
136
public void setCreator(String JavaDoc creator) {
137         this.creator = creator;
138     }
139
140     public Hashtable JavaDoc getTitles() {
141         return this.titles;
142     }
143
144     public void setTitles(Hashtable JavaDoc titles) {
145         this.titles = titles;
146     }
147
148     public void setOperation(String JavaDoc _operation) {
149         operation = _operation;
150     }
151
152     public String JavaDoc getOperation() {
153         return operation;
154     }
155
156     public void sharedTitle(boolean _sharedTitle) {
157         sharedTitle = _sharedTitle;
158     }
159
160     public boolean isSharedTitle() {
161         return sharedTitle;
162     }
163
164     public boolean deleteOldContainer(){
165         return this.deleteOldContainer;
166     }
167
168     public void setDeleteOldContainer(boolean value){
169         this.deleteOldContainer = value;
170     }
171
172     public String JavaDoc toString() {
173
174         StringBuffer JavaDoc pageAttribute =
175                 new StringBuffer JavaDoc ("JahiaPageEngineTempBean detail :\n");
176         pageAttribute.append("- siteID : [" + siteID + "]\n");
177         pageAttribute.append("- parentID : [" + parentID + "]\n");
178         String JavaDoc typeName = pageType == -1 ? "No type defined" : JahiaPage.PAGE_TYPE_NAMES[pageType];
179         pageAttribute.append("- pageType : [" + typeName + "]\n");
180         pageAttribute.append("- pageTemplateID : [" + pageTemplateID + "]\n");
181         pageAttribute.append("- remoteURL : [" + remoteURL + "]\n");
182         pageAttribute.append("- pageLinkID : [" + pageLinkID + "]\n");
183         pageAttribute.append("- creator : [" + creator + "]\n");
184         pageAttribute.append("- linkFieldID : [" + linkFieldID + "]\n");
185         pageAttribute.append("- operation : [" + operation + "]\n");
186         pageAttribute.append("- titles : [");
187         Enumeration JavaDoc titlesEnum = titles.elements();
188         while (titlesEnum.hasMoreElements()) {
189             pageAttribute.append((String JavaDoc)titlesEnum.nextElement());
190             if (titlesEnum.hasMoreElements()) {
191                 pageAttribute.append(", ");
192             }
193         }
194         pageAttribute.append("]\n");
195         return pageAttribute.toString();
196     }
197
198 }
199
Popular Tags