1 19 package org.openharmonise.rm.resources.xml; 20 21 import java.util.*; 22 23 import org.openharmonise.commons.dsi.*; 24 import org.openharmonise.commons.dsi.dml.*; 25 import org.openharmonise.rm.dsi.*; 26 import org.openharmonise.rm.resources.*; 27 28 29 36 public class XMLResourceGroup extends AbstractParentObject { 37 38 private static final String TBL_XML_GROUP = "xml_group"; 40 41 public static final String TAG_XML_GROUP = "XMLGroup"; 43 44 private static List CHILD_CLASS_NAMES = null; 46 47 static { 48 DatabaseInfo.getInstance().registerTableName( 49 XMLResourceGroup.class.getName(), TBL_XML_GROUP); 50 51 try { 52 CHILD_CLASS_NAMES = new Vector(); 53 CHILD_CLASS_NAMES.add(XMLResourceGroup.class.getName()); 54 CHILD_CLASS_NAMES.add(XMLResource.class.getName()); 55 56 } catch (Exception e) { 57 throw new RuntimeException (e.getMessage()); 58 } 59 } 60 61 64 public XMLResourceGroup() { 65 super(); 66 } 67 68 73 public XMLResourceGroup(AbstractDataStoreInterface dbintrf) { 74 super(dbintrf); 75 } 76 77 84 public XMLResourceGroup(AbstractDataStoreInterface dbintrf, int nId, 85 int nKey, boolean bIsHist) { 86 super(dbintrf, nId, nKey, bIsHist); 87 } 88 89 95 public XMLResourceGroup(AbstractDataStoreInterface dbintrf, int nId) { 96 super(dbintrf, nId); 97 } 98 99 102 public String getParentObjectClassName() { 103 return getClass().getName(); 104 } 105 106 109 public String getDBTableName() { 110 return TBL_XML_GROUP; 111 } 112 113 116 public JoinConditions getInstanceJoinConditions(String sObjectTag, 117 boolean bIsOuter) throws DataStoreException { 118 JoinConditions joinConditions = new JoinConditions(); 119 DatabaseInfo dbInfo = DatabaseInfo.getInstance(); 120 String sChildTableName = null; 121 String sClassName = null; 122 123 if (sObjectTag.equals("XMLResource") == true) { 124 sChildTableName = dbInfo.getTableName(XMLResource.class.getName()); 125 sClassName = XMLResource.class.getName(); 126 } else if (sObjectTag.equals("XMLResourceGroup") == true) { 127 sChildTableName = dbInfo.getTableName(XMLResourceGroup.class 128 .getName()); 129 sClassName = XMLResourceGroup.class.getName(); 130 } else { 131 throw new DataStoreException("Invalid child object."); 132 } 133 134 ColumnRef childKeyCol = getGroupChildJoinColumnRef(sChildTableName, 136 CLMN_CHILD_KEY); 137 ColumnRef parentKeyCol = getGroupChildJoinColumnRef(sChildTableName, 138 CLMN_PARENT_KEY); 139 140 joinConditions.addCondition(getInstanceColumnRef( 141 AbstractObject.ATTRIB_KEY, false), parentKeyCol); 142 if (sObjectTag.equals("XMLResource") == true) { 143 joinConditions.addCondition(XMLResource.getColumnRef(sClassName, 144 AbstractObject.ATTRIB_KEY, false), childKeyCol); 145 } else if (sObjectTag.equals("XMLResourceGroup") == true) { 146 joinConditions.addCondition(getColumnRef(sClassName, 147 AbstractObject.ATTRIB_KEY, false), childKeyCol); 148 } 149 150 return joinConditions; 151 } 152 153 156 public String getTagName() { 157 158 return TAG_XML_GROUP; 159 } 160 161 164 165 168 public List getChildClassNames() { 169 return CHILD_CLASS_NAMES; 170 } 171 172 } | Popular Tags |