KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > data > fields > JahiaUndefinedField


1 // JahiaUndefinedField
2
// YG 17.07.2001
3

4 package org.jahia.data.fields;
5
6 import java.util.Properties JavaDoc;
7
8 import org.jahia.exceptions.JahiaException;
9 import org.jahia.params.ParamBean;
10 import org.jahia.registries.ServicesRegistry;
11 import org.jahia.services.fields.ContentField;
12
13
14 public class JahiaUndefinedField extends JahiaField implements JahiaAllowApplyChangeToAllLangField
15 {
16
17         /***
18         * constructor
19         * YG 17.07.2001
20         *
21         */

22     public JahiaUndefinedField(Integer JavaDoc ID,
23                             Integer JavaDoc jahiaID,
24                             Integer JavaDoc pageID,
25                             Integer JavaDoc ctnid,
26                             Integer JavaDoc fieldDefID,
27                             Integer JavaDoc fieldType,
28                             Integer JavaDoc connectType,
29                             String JavaDoc fieldValue,
30                             Integer JavaDoc rank,
31                             Integer JavaDoc aclID,
32                             Integer JavaDoc versionID,
33                             Integer JavaDoc versionStatus,
34                             String JavaDoc languageCode)
35     {
36         super(ID, jahiaID, pageID, ctnid, fieldDefID, fieldType, connectType,
37               fieldValue, rank, aclID, versionID, versionStatus, languageCode);
38
39         if ( isShared() ){
40             this.languageCode = ContentField.SHARED_LANGUAGE;
41         }
42
43     } // end constructor
44

45
46     public void load(int loadFlag, ParamBean jParams)
47     throws JahiaException
48     {
49         ;
50     }
51
52     public boolean save(ParamBean jParams)
53     throws JahiaException
54     {
55         return true;
56     }
57
58     public void delete(ParamBean jParams)
59     throws JahiaException
60     {
61         ;
62     }
63
64     public String JavaDoc getEngineName()
65     {
66         return "org.jahia.engines.shared.Undefined_Field";
67     }
68
69     public String JavaDoc getFieldContent4Ranking()
70     {
71         return "";
72     }
73
74     public String JavaDoc getIconNameOff()
75     {
76         return "undefined";
77     }
78
79     public String JavaDoc getIconNameOn()
80     {
81         return "undefined_on";
82     }
83
84     public JahiaField cloneField(int newctnid, int newPageID, int clonedAclID, boolean childrenCloned)
85     throws JahiaException
86     {
87         JahiaField clonedField = ServicesRegistry.getInstance().getJahiaFieldService().
88                                  createJahiaField(0, this.getJahiaID(),
89                                  newPageID, newctnid,
90                                  this.getFieldDefID(), this.getType(),
91                                  this.getConnectType(),
92                                  this.getValue(), this.getRank(),
93                                  clonedAclID, this.getVersionID(), this.getWorkflowState(),
94                                  this.getLanguageCode());
95
96         if (clonedField == null)
97         {
98             throw new JahiaException ("Could not clone field.",
99                 "Could not instanciate a new JahiaField object.",
100                 JahiaException.PAGE_ERROR, JahiaException.CRITICAL_SEVERITY);
101         }
102
103         clonedField.setRawValue(this.getRawValue());
104         clonedField.setObject( this.getObject() );
105         clonedField.setProperties( (Properties JavaDoc)(this.getProperties()).clone() );
106
107         return clonedField;
108     }
109
110     public Object JavaDoc clone()
111     {
112         return new JahiaUndefinedField (new Integer JavaDoc(ID), new Integer JavaDoc(jahiaID),
113                                         new Integer JavaDoc(pageID),
114                                         new Integer JavaDoc(ctnid),
115                                         new Integer JavaDoc(fieldDefID),
116                                         new Integer JavaDoc(fieldType),
117                                         new Integer JavaDoc(connectType),
118                                         fieldValue, new Integer JavaDoc(rank),
119                                         new Integer JavaDoc(aclID),
120                                         new Integer JavaDoc(versionID),
121                                         new Integer JavaDoc(workflowState),
122                                         new String JavaDoc(getLanguageCode()) );
123     }
124
125     /**
126      * Is this kind of field shared (i.e. not one version for each language, but one version for every language)
127      */

128     public boolean isShared (){
129         return true;
130     }
131
132     /**
133      * Copy the internal value of current language to another language.
134      * Must be implemented by conctrete field for specific implementation.
135      *
136      * @param aField A same field in another language
137      */

138     public void copyValueInAnotherLanguage (JahiaField aField,ParamBean jParams)
139     throws JahiaException {
140         if ( aField == null ){
141             return;
142         }
143         aField.setValue(this.getValue());
144         aField.setRawValue(this.getValue());
145         aField.setObject(this.getObject());
146     }
147
148 }
Popular Tags