1 19 package org.openharmonise.rm.resources.users; 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.publishing.*; 27 import org.openharmonise.rm.resources.*; 28 import org.openharmonise.rm.resources.lifecycle.*; 29 30 31 39 public class UserGroup 40 extends AbstractParentObject 41 implements DataStoreObject, Publishable, Editable, Cloneable , Comparable { 42 43 private static final String TBL_USERGROUP = "users_group"; 45 46 public static final String TAG_USERGROUP = "UserGroup"; 48 49 private static List CHILD_CLASS_NAMES = null; 51 52 static { 53 DatabaseInfo.getInstance().registerTableName( 54 UserGroup.class.getName(), 55 TBL_USERGROUP); 56 57 try { 58 CHILD_CLASS_NAMES = new Vector(); 59 CHILD_CLASS_NAMES.add(User.class.getName()); 60 CHILD_CLASS_NAMES.add(UserGroup.class.getName()); 61 62 } catch (Exception e) { 63 throw new RuntimeException (e.getMessage()); 64 } 65 } 66 67 71 public UserGroup() { 72 super(); 73 74 } 75 76 81 public UserGroup(AbstractDataStoreInterface dbinterf) { 82 super(dbinterf); 83 } 84 85 91 public UserGroup(AbstractDataStoreInterface dbinterf, boolean bHist) { 92 super(dbinterf); 93 } 94 95 101 public UserGroup(AbstractDataStoreInterface dbinterf, int nId) { 102 super(dbinterf, nId); 103 104 } 105 106 113 public UserGroup( 114 AbstractDataStoreInterface dbinterf, 115 int nId, 116 int nKey, 117 boolean bHist) 118 throws Exception { 119 super(dbinterf, nId, nKey, bHist); 120 121 } 122 123 126 public JoinConditions getInstanceJoinConditions( 127 String sObjectTag, 128 boolean bIsOuter) 129 throws DataStoreException { 130 JoinConditions joinConditions = new JoinConditions(); 131 DatabaseInfo dbInfo = DatabaseInfo.getInstance(); 132 String sChildTableName = null; 133 134 if (sObjectTag.equals("User") == true) { 135 sChildTableName = dbInfo.getTableName(User.class.getName()); 136 } else if (sObjectTag.equals("UserGroup") == true) { 137 sChildTableName = dbInfo.getTableName(UserGroup.class.getName()); 138 } else { 139 throw new DataStoreException("Invalid child object"); 140 } 141 142 ColumnRef childKeyCol = getGroupChildJoinColumnRef(sChildTableName, CLMN_CHILD_KEY); 144 ColumnRef parentKeyCol = getGroupChildJoinColumnRef(sChildTableName, CLMN_PARENT_KEY); 145 146 joinConditions.addCondition(getInstanceColumnRef(AbstractObject.ATTRIB_KEY, false), parentKeyCol); 147 joinConditions.addCondition(User.getColumnRef(User.class.getName(), AbstractObject.ATTRIB_KEY, false), childKeyCol); 148 149 return joinConditions; 150 } 151 152 155 public String toString() { 156 String output = ""; 157 158 try { 159 output = output + super.toString(); 160 161 output = 162 output 163 + " UserGroup id:" 164 + Integer.toString(m_nId) 165 + " title:" 166 + this.m_sName 167 + " summary:" 168 + this.m_sSummary; 169 170 } catch (Exception e) { 171 throw new RuntimeException ("UserGroup toString exploded!"); 172 } 173 174 return output; 175 } 176 177 180 public String getParentObjectClassName() { 181 return UserGroup.class.getName(); 182 } 183 184 187 public String getDBTableName() { 188 return TBL_USERGROUP; 189 } 190 191 194 public String getTagName() { 195 return TAG_USERGROUP; 196 } 197 198 201 202 205 public List getChildClassNames() { 206 return CHILD_CLASS_NAMES; 207 } 208 } | Popular Tags |