1 4 package org.jahia.data.fields; 5 6 import java.util.Properties ; 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 22 public JahiaUndefinedField(Integer ID, 23 Integer jahiaID, 24 Integer pageID, 25 Integer ctnid, 26 Integer fieldDefID, 27 Integer fieldType, 28 Integer connectType, 29 String fieldValue, 30 Integer rank, 31 Integer aclID, 32 Integer versionID, 33 Integer versionStatus, 34 String 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 } 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 getEngineName() 65 { 66 return "org.jahia.engines.shared.Undefined_Field"; 67 } 68 69 public String getFieldContent4Ranking() 70 { 71 return ""; 72 } 73 74 public String getIconNameOff() 75 { 76 return "undefined"; 77 } 78 79 public String 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 )(this.getProperties()).clone() ); 106 107 return clonedField; 108 } 109 110 public Object clone() 111 { 112 return new JahiaUndefinedField (new Integer (ID), new Integer (jahiaID), 113 new Integer (pageID), 114 new Integer (ctnid), 115 new Integer (fieldDefID), 116 new Integer (fieldType), 117 new Integer (connectType), 118 fieldValue, new Integer (rank), 119 new Integer (aclID), 120 new Integer (versionID), 121 new Integer (workflowState), 122 new String (getLanguageCode()) ); 123 } 124 125 128 public boolean isShared (){ 129 return true; 130 } 131 132 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 |