public ICFBamDataScopeObj readDataScopeByUNameIdx(String Name, boolean forceRead) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFBamDataScopeByUNameIdxKey, ICFBamDataScopeObj>(); } CFBamDataScopeByUNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); key.setRequiredName(Name); ICFBamDataScopeObj obj = null; if ((!forceRead) && indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); } else { CFBamDataScopeBuff buff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .readDerivedByUNameIdx(schema.getAuthorization(), Name); if (buff != null) { obj = schema.getDataScopeTableObj().newInstance(); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey()); obj.setBuff(buff); obj = (ICFBamDataScopeObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUNameIdx.put(key, null); } } return (obj); }
public void deleteClearTopDepByTenantIdx(long TenantId) { CFBamScopeByTenantIdxKey key = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (indexByTenantIdx == null) { indexByTenantIdx = new HashMap<CFBamScopeByTenantIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if (indexByTenantIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> dict = indexByTenantIdx.get(key); schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId); Iterator<ICFBamClearTopDepObj> iter = dict.values().iterator(); ICFBamClearTopDepObj obj; List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByTenantIdx.remove(key); } else { schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId); } }
public ICFBamClearTopDepObj readClearTopDepByUNameIdx( long TenantId, long ContTableId, String Name, boolean forceRead) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>(); } CFBamClearTopDepByUNameIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); key.setRequiredName(Name); ICFBamClearTopDepObj obj = null; if ((!forceRead) && indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); } else { CFBamClearTopDepBuff buff = schema .getBackingStore() .getTableClearTopDep() .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name); if (buff != null) { obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(buff); obj = (ICFBamClearTopDepObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUNameIdx.put(key, null); } } return (obj); }
public ICFBamDataScopeObj realizeDataScope(ICFBamDataScopeObj Obj) { ICFBamDataScopeObj obj = Obj; CFBamDataScopePKey pkey = obj.getPKey(); ICFBamDataScopeObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFBamDataScopeObj existingObj = members.get(pkey); keepObj = existingObj; /* * We always rebind the data because if we're being called, some index has * been updated and is refreshing it's data, which may or may not have changed */ // Detach object from alternate and duplicate indexes, leave PKey alone if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allDataScope != null) { allDataScope.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj.setIsNew(false); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allDataScope != null) { allDataScope.put(keepObj.getPKey(), keepObj); } if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }
public void deleteDataScope(ICFBamDataScopeObj Obj) { ICFBamDataScopeObj obj = Obj; ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .deleteDataScope(schema.getAuthorization(), obj.getDataScopeBuff()); obj.forget(true); }
public void deleteDataScopeByIdIdx(short Id) { CFBamDataScopePKey pkey = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey(); pkey.setRequiredId(Id); ICFBamDataScopeObj obj = readDataScope(pkey); if (obj != null) { ICFBamDataScopeEditObj editObj = (ICFBamDataScopeEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFBamDataScopeEditObj) obj.beginEdit(); if (editObj != null) { editStarted = true; } else { editStarted = false; } } else { editStarted = false; } if (editObj != null) { editObj.delete(); if (editStarted) { editObj.endEdit(); } } obj.forget(true); } }
public ICFBamClearTopDepObj readClearTopDepByIdIdx(long TenantId, long Id, boolean forceRead) { CFBamScopePKey pkey = schema.getBackingStore().getFactoryScope().newPKey(); pkey.setRequiredTenantId(TenantId); pkey.setRequiredId(Id); ICFBamClearTopDepObj obj = readClearTopDep(pkey, forceRead); return (obj); }
public ICFBamDataScopeObj readDataScopeByIdIdx(short Id, boolean forceRead) { CFBamDataScopePKey pkey = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey(); pkey.setRequiredId(Id); ICFBamDataScopeObj obj = readDataScope(pkey, forceRead); return (obj); }
public void forgetClearTopDepByContTblIdx(long TenantId, long ContTableId) { if (indexByContTblIdx == null) { return; } CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); if (indexByContTblIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(key); if (mapContTblIdx != null) { List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); ICFBamClearTopDepObj cur = null; Iterator<ICFBamClearTopDepObj> iter = mapContTblIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByContTblIdx.remove(key); } }
public void deleteClearTopDepByIdIdx(long TenantId, long Id) { CFBamScopePKey pkey = schema.getBackingStore().getFactoryScope().newPKey(); pkey.setRequiredTenantId(TenantId); pkey.setRequiredId(Id); ICFBamScopeObj obj = readClearTopDep(pkey); if (obj != null) { ICFBamClearTopDepEditObj editObj = (ICFBamClearTopDepEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFBamClearTopDepEditObj) obj.beginEdit(); if (editObj != null) { editStarted = true; } else { editStarted = false; } } else { editStarted = false; } if (editObj != null) { editObj.delete(); if (editStarted) { editObj.endEdit(); } } obj.forget(true); } }
public void deleteClearTopDep(ICFBamClearTopDepObj Obj) { ICFBamClearTopDepObj obj = Obj; schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDep(schema.getAuthorization(), obj.getClearTopDepBuff()); obj.forget(true); }
public ICFBamClearTopDepObj lockClearTopDep(CFBamScopePKey pkey) { ICFBamClearTopDepObj locked = null; CFBamClearTopDepBuff lockBuff = schema.getBackingStore().getTableClearTopDep().lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(lockBuff.getClassCode()); locked.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); locked.setBuff(lockBuff); locked = (ICFBamClearTopDepObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockClearTopDep", pkey); } return (locked); }
public CFBamDataScopeBuff getBuff() { if (buff == null) { if (isNew) { buff = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newBuff(); } else { // Read the data buff via the backing store buff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .readDerivedByIdIdx(schema.getAuthorization(), getPKey().getRequiredId()); if (buff != null) { copyBuffToPKey(); } } } return (buff); }
public ICFBamDataScopeObj updateDataScope(ICFBamDataScopeObj Obj) { ICFBamDataScopeObj obj = Obj; ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .updateDataScope(schema.getAuthorization(), Obj.getDataScopeBuff()); obj = (ICFBamDataScopeObj) Obj.realize(); return (obj); }
public ICFBamDataScopeObj lockDataScope(CFBamDataScopePKey pkey) { ICFBamDataScopeObj locked = null; CFBamDataScopeBuff lockBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = schema.getDataScopeTableObj().newInstance(); locked.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey()); locked.setBuff(lockBuff); locked = (ICFBamDataScopeObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockDataScope", pkey); } return (locked); }
public ICFBamDataScopeObj createDataScope(ICFBamDataScopeObj Obj) { ICFBamDataScopeObj obj = Obj; CFBamDataScopeBuff buff = obj.getDataScopeBuff(); ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .createDataScope(schema.getAuthorization(), buff); obj.copyBuffToPKey(); obj = obj.realize(); return (obj); }
public ICFBamDataScopeObj readDataScope(CFBamDataScopePKey pkey, boolean forceRead) { ICFBamDataScopeObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFBamDataScopeBuff readBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredId()); if (readBuff != null) { obj = schema.getDataScopeTableObj().newInstance(); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey()); obj.setBuff(readBuff); obj = (ICFBamDataScopeObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public ICFBamClearTopDepObj updateClearTopDep(ICFBamClearTopDepObj Obj) { ICFBamClearTopDepObj obj = Obj; schema .getBackingStore() .getTableClearTopDep() .updateClearTopDep(schema.getAuthorization(), Obj.getClearTopDepBuff()); if (Obj.getClassCode().equals("CLRT")) { obj = (ICFBamClearTopDepObj) Obj.realize(); } return (obj); }
public void deleteDataScopeByUNameIdx(String Name) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFBamDataScopeByUNameIdxKey, ICFBamDataScopeObj>(); } CFBamDataScopeByUNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); key.setRequiredName(Name); ICFBamDataScopeObj obj = null; if (indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .deleteDataScopeByUNameIdx(schema.getAuthorization(), Name); obj.forget(true); } else { ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .deleteDataScopeByUNameIdx(schema.getAuthorization(), Name); } }
public ICFBamClearTopDepObj createClearTopDep(ICFBamClearTopDepObj Obj) { ICFBamClearTopDepObj obj = Obj; CFBamClearTopDepBuff buff = obj.getClearTopDepBuff(); schema .getBackingStore() .getTableClearTopDep() .createClearTopDep(schema.getAuthorization(), buff); obj.copyBuffToPKey(); if (obj.getPKey().getClassCode().equals("CLRT")) { obj = (ICFBamClearTopDepObj) (obj.realize()); } return (obj); }
public void forgetDataScopeByIdIdx(short Id) { if (members == null) { return; } CFBamDataScopePKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey(); key.setRequiredId(Id); if (members.containsKey(key)) { ICFBamDataScopeObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void forgetClearTopDepByIdIdx(long TenantId, long Id) { if (members == null) { return; } CFBamScopePKey key = schema.getBackingStore().getFactoryScope().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); if (members.containsKey(key)) { ICFBamClearTopDepObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public ICFBamClearTopDepObj readClearTopDep(CFBamScopePKey pkey, boolean forceRead) { ICFBamClearTopDepObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFBamClearTopDepBuff readBuff = schema .getBackingStore() .getTableClearTopDep() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredId()); if (readBuff != null) { obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(readBuff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(readBuff); obj = (ICFBamClearTopDepObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public void deleteClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>(); } CFBamClearTopDepByUNameIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); key.setRequiredName(Name); ICFBamClearTopDepObj obj = null; if (indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name); obj.forget(true); } else { schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name); } }
public void forgetDataScopeByUNameIdx(String Name) { if (indexByUNameIdx == null) { return; } CFBamDataScopeByUNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); key.setRequiredName(Name); if (indexByUNameIdx.containsKey(key)) { ICFBamDataScopeObj probed = indexByUNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByUNameIdx.remove(key); } }
public void forgetClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) { if (indexByUNameIdx == null) { return; } CFBamClearTopDepByUNameIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); key.setRequiredName(Name); if (indexByUNameIdx.containsKey(key)) { ICFBamClearTopDepObj probed = indexByUNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByUNameIdx.remove(key); } }
public void forgetDataScope(ICFBamDataScopeObj Obj, boolean forgetSubObjects) { ICFBamDataScopeObj obj = Obj; CFBamDataScopePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFBamDataScopeObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } if (allDataScope != null) { allDataScope.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstInt64ColDelete"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFBamValuePKey pkey = schemaObj.getBackingStore().getFactoryValue().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFBamInt64ColObj read = schemaObj.getInt64ColTableObj().readInt64Col(pkey); if (read != null) { if (read.getInt64ColBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete Int64Col"); } else { ICFBamInt64ColEditObj editBuff = (ICFBamInt64ColEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgInt64ColMessageFormatter.formatInt64ColRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAccessFrequencyLock"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFBamAccessFrequencyPKey pkey = schemaObj.getBackingStore().getFactoryAccessFrequency().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natId; natId = Short.parseShort(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); // Lock the object ICFBamAccessFrequencyObj locked = schemaObj.getAccessFrequencyTableObj().lockAccessFrequency(pkey); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgAccessFrequencyMessageFormatter.formatAccessFrequencyRspnLocked( "\n\t\t\t", locked.getAccessFrequencyBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Scope Attributes String attrTenantId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // ClearDep Attributes String attrRelationId = null; // ClearSubDep3 Attributes String attrContClearDep2TenantId = null; String attrContClearDep2Id = null; String attrName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstClearSubDep3Update"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RelationId")) { if (attrRelationId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelationId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2TenantId")) { if (attrContClearDep2TenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2TenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContClearDep2Id")) { if (attrContClearDep2Id != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContClearDep2Id = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } if ((attrRelationId == null) || (attrRelationId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RelationId"); } if ((attrContClearDep2TenantId == null) || (attrContClearDep2TenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2TenantId"); } if ((attrContClearDep2Id == null) || (attrContClearDep2Id.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFBamScopePKey pkey = ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryScope().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); // Read the instance ICFBamClearSubDep3Obj origBuff = ((ICFBamClearSubDep3Obj) schemaObj.getClearSubDep3TableObj().readClearSubDep3(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getClearSubDep3TableObj().readClearSubDep3()"); } else { // Edit the instance ICFBamClearSubDep3EditObj editBuff = (ICFBamClearSubDep3EditObj) origBuff.beginEdit(); CFBamClearSubDep3Buff dataBuff = editBuff.getClearSubDep3Buff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } long natRelationId = Long.parseLong(attrRelationId); dataBuff.setRequiredRelationId(natRelationId); long natContClearDep2TenantId = Long.parseLong(attrContClearDep2TenantId); dataBuff.setRequiredContClearDep2TenantId(natContClearDep2TenantId); long natContClearDep2Id = Long.parseLong(attrContClearDep2Id); dataBuff.setRequiredContClearDep2Id(natContClearDep2Id); String natName = attrName; dataBuff.setRequiredName(natName); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgClearSubDep3MessageFormatter.formatClearSubDep3RspnUpdated( "\n\t\t\t", origBuff.getClearSubDep3Buff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }