| 1 19 package org.openharmonise.rm.resources.metadata.values; 20 21 import java.util.*; 22 23 import org.openharmonise.commons.dsi.*; 24 import org.openharmonise.commons.dsi.dml.JoinConditions; 25 import org.openharmonise.rm.DataAccessException; 26 import org.openharmonise.rm.dsi.*; 27 import org.openharmonise.rm.publishing.Publishable; 28 import org.openharmonise.rm.resources.*; 29 import org.openharmonise.rm.resources.lifecycle.Editable; 30 31 32 41 public class ValueGroup 42 extends AbstractParentObject 43 implements DataStoreObject, Editable, Publishable { 44 45 48 protected static String TYPE_VALUEGROUP = ValueGroup.class.getName(); 49 50 53 private static List CHILD_CLASS_NAMES = null; 54 55 59 public static final String TAG_VALUEGROUP = "ValueGroup"; 60 61 65 private static final String TBL_VALUEGROUP = "value_group"; 66 67 static { 69 CHILD_CLASS_NAMES = new Vector(); 70 CHILD_CLASS_NAMES.add(Value.class.getName()); 71 CHILD_CLASS_NAMES.add(ValueGroup.class.getName()); 72 73 DatabaseInfo.getInstance().registerTableName( 74 ValueGroup.class.getName(), 75 TBL_VALUEGROUP); 76 77 } 78 79 83 public ValueGroup() { 84 super(); 85 86 } 87 88 93 public ValueGroup(AbstractDataStoreInterface dbintrf) { 94 super(dbintrf); 95 96 } 97 98 104 public ValueGroup(AbstractDataStoreInterface dbintrf, int nId) { 105 super(dbintrf, nId); 106 107 } 108 109 118 public ValueGroup( 119 AbstractDataStoreInterface dbintrf, 120 int nId, 121 int nKey, 122 boolean bIsHist) { 123 super(dbintrf, nId, nKey, bIsHist); 124 125 } 126 127 134 public ValueGroup(AbstractDataStoreInterface dbintrf, boolean bIsHist) { 135 super(dbintrf); 136 137 } 138 139 147 public static List getTopLevelGroups(AbstractDataStoreInterface dbinterf) 148 throws DataAccessException { 149 return AbstractParentObject.getTopLevelGroups( 150 dbinterf, 151 new ValueGroup()); 152 } 153 154 157 public List getChildClassNames() { 158 return CHILD_CLASS_NAMES; 159 } 160 161 164 public String getParentObjectClassName() { 165 return getClass().getName(); 166 } 167 168 171 public String getDBTableName() { 172 return TBL_VALUEGROUP; 173 } 174 175 178 public JoinConditions getInstanceJoinConditions( 179 String sObjectTag, 180 boolean bIsOuter) 181 throws DataStoreException { 182 JoinConditions joinConditions = new JoinConditions(); 183 DatabaseInfo dbInfo = DatabaseInfo.getInstance(); 184 String sChildTableName = null; 185 String sClassName = null; 186 187 if (sObjectTag.equals("Value") == true) { 188 sChildTableName = dbInfo.getTableName(Value.class.getName()); 189 sClassName = Value.class.getName(); 190 } else if (sObjectTag.equals("ValueGroup") == true) { 191 sChildTableName = dbInfo.getTableName(ValueGroup.class.getName()); 192 sClassName = ValueGroup.class.getName(); 193 } else { 194 throw new DataStoreException("Invalid child object"); 195 } 196 197 ColumnRef childKeyCol = 199 getGroupChildJoinColumnRef(sChildTableName, CLMN_CHILD_KEY); 200 ColumnRef parentKeyCol = 201 getGroupChildJoinColumnRef(sChildTableName, CLMN_PARENT_KEY); 202 203 joinConditions.addCondition( 204 getInstanceColumnRef(AbstractObject.ATTRIB_KEY, false), 205 parentKeyCol); 206 207 if (sObjectTag.equals("Value") == true) { 208 joinConditions.addCondition( 209 Value.getColumnRef( 210 Value.class.getName(), 211 AbstractObject.ATTRIB_KEY, 212 false), 213 childKeyCol); 214 } else if (sObjectTag.equals("ValueGroup") == true) { 215 joinConditions.addCondition( 216 getColumnRef( 217 Value.class.getName(), 218 AbstractObject.ATTRIB_KEY, 219 false), 220 childKeyCol); 221 } 222 223 return joinConditions; 224 } 225 226 229 public String getTagName() { 230 return TAG_VALUEGROUP; 231 } 232 233 } | Popular Tags |