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 void deleteClearTopDep(ICFBamClearTopDepObj Obj) { ICFBamClearTopDepObj obj = Obj; schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDep(schema.getAuthorization(), obj.getClearTopDepBuff()); obj.forget(true); }
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 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 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 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 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 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 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 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 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 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 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 startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Value Attributes String attrTenantId = null; String attrScopeId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDataScopeId = null; String attrViewAccessSecurityId = null; String attrEditAccessSecurityId = null; String attrViewAccessFrequencyId = null; String attrEditAccessFrequencyId = null; String attrPrevTenantId = null; String attrPrevId = null; String attrNextTenantId = null; String attrNextId = null; String attrDefaultVisibility = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Atom Attributes String attrDbName = null; // TZTimeDef Attributes String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("TZTimeDef"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = xmsgRspnHandler.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("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = 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("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScopeId")) { if (attrDataScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScopeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessSecurityId")) { if (attrViewAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessSecurityId")) { if (attrEditAccessSecurityId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessSecurityId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ViewAccessFrequencyId")) { if (attrViewAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrViewAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevTenantId")) { if (attrPrevTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PrevId")) { if (attrPrevId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPrevId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = 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 ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natScopeId = Long.parseLong(attrScopeId); long natId = Long.parseLong(attrId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } String natName = attrName; String natShortName = attrShortName; String natLabel = attrLabel; String natShortDescription = attrShortDescription; String natDescription = attrDescription; boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } Short natDataScopeId; if ((attrDataScopeId == null) || (attrDataScopeId.length() <= 0)) { natDataScopeId = null; } else { natDataScopeId = new Short(Short.parseShort(attrDataScopeId)); } Short natViewAccessSecurityId; if ((attrViewAccessSecurityId == null) || (attrViewAccessSecurityId.length() <= 0)) { natViewAccessSecurityId = null; } else { natViewAccessSecurityId = new Short(Short.parseShort(attrViewAccessSecurityId)); } Short natEditAccessSecurityId; if ((attrEditAccessSecurityId == null) || (attrEditAccessSecurityId.length() <= 0)) { natEditAccessSecurityId = null; } else { natEditAccessSecurityId = new Short(Short.parseShort(attrEditAccessSecurityId)); } Short natViewAccessFrequencyId; if ((attrViewAccessFrequencyId == null) || (attrViewAccessFrequencyId.length() <= 0)) { natViewAccessFrequencyId = null; } else { natViewAccessFrequencyId = new Short(Short.parseShort(attrViewAccessFrequencyId)); } Short natEditAccessFrequencyId; if ((attrEditAccessFrequencyId == null) || (attrEditAccessFrequencyId.length() <= 0)) { natEditAccessFrequencyId = null; } else { natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); } Long natPrevTenantId; if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) { natPrevTenantId = null; } else { natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId)); } Long natPrevId; if ((attrPrevId == null) || (attrPrevId.length() <= 0)) { natPrevId = null; } else { natPrevId = new Long(Long.parseLong(attrPrevId)); } Long natNextTenantId; if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) { natNextTenantId = null; } else { natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); } Long natNextId; if ((attrNextId == null) || (attrNextId.length() <= 0)) { natNextId = null; } else { natNextId = new Long(Long.parseLong(attrNextId)); } boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } int natRevision = Integer.parseInt(attrRevision); 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); } String natDbName = attrDbName; Calendar natInitValue; if ((attrInitValue == null) || (attrInitValue.length() <= 0)) { natInitValue = null; } else { try { natInitValue = CFLibXmlUtil.parseTZTime(attrInitValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "InitValue", attrInitValue, e); } } Calendar natDefaultValue; if ((attrDefaultValue == null) || (attrDefaultValue.length() <= 0)) { natDefaultValue = null; } else { try { natDefaultValue = CFLibXmlUtil.parseTZTime(attrDefaultValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "DefaultValue", attrDefaultValue, e); } } Calendar natNullValue; if ((attrNullValue == null) || (attrNullValue.length() <= 0)) { natNullValue = null; } else { try { natNullValue = CFLibXmlUtil.parseTZTime(attrNullValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "NullValue", attrNullValue, e); } } Calendar natUnknownValue; if ((attrUnknownValue == null) || (attrUnknownValue.length() <= 0)) { natUnknownValue = null; } else { try { natUnknownValue = CFLibXmlUtil.parseTZTime(attrUnknownValue); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory() .newInvalidArgumentException( getClass(), S_ProcName, 0, "UnknownValue", attrUnknownValue, e); } } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFBamTZTimeDefObj obj = schemaObj.getTZTimeDefTableObj().newInstance(); CFBamTZTimeDefBuff dataBuff = obj.getTZTimeDefBuff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredScopeId(natScopeId); dataBuff.setRequiredId(natId); dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredName(natName); dataBuff.setOptionalShortName(natShortName); dataBuff.setOptionalLabel(natLabel); dataBuff.setOptionalShortDescription(natShortDescription); dataBuff.setOptionalDescription(natDescription); dataBuff.setRequiredIsNullable(natIsNullable); dataBuff.setOptionalGenerateId(natGenerateId); dataBuff.setOptionalDataScopeId(natDataScopeId); dataBuff.setOptionalViewAccessSecurityId(natViewAccessSecurityId); dataBuff.setOptionalEditAccessSecurityId(natEditAccessSecurityId); dataBuff.setOptionalViewAccessFrequencyId(natViewAccessFrequencyId); dataBuff.setOptionalEditAccessFrequencyId(natEditAccessFrequencyId); dataBuff.setOptionalPrevTenantId(natPrevTenantId); dataBuff.setOptionalPrevId(natPrevId); dataBuff.setOptionalNextTenantId(natNextTenantId); dataBuff.setOptionalNextId(natNextId); dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } dataBuff.setOptionalDbName(natDbName); dataBuff.setOptionalInitValue(natInitValue); dataBuff.setOptionalDefaultValue(natDefaultValue); dataBuff.setOptionalNullValue(natNullValue); dataBuff.setOptionalUnknownValue(natUnknownValue); obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFBamValueObj> list = (List<ICFBamValueObj>) xmsgRspnHandler.getListOfObjects(); ICFBamTZTimeDefObj realized = (ICFBamTZTimeDefObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(realized); } } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { 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; // PopDep Attributes String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrRelationTenantId = null; String attrRelationId = null; // PopSubDep3 Attributes String attrContTenantId = null; String attrContPopDep2Id = 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("RspnPopSubDep3Created"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = xmsgRspnHandler.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("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RelationTenantId")) { if (attrRelationTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelationTenantId = 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("ContTenantId")) { if (attrContTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContPopDep2Id")) { if (attrContPopDep2Id != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContPopDep2Id = 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 ((attrRelationTenantId == null) || (attrRelationTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RelationTenantId"); } if ((attrRelationId == null) || (attrRelationId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RelationId"); } if ((attrContTenantId == null) || (attrContTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContTenantId"); } if ((attrContPopDep2Id == null) || (attrContPopDep2Id.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ContPopDep2Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natTenantId = Long.parseLong(attrTenantId); long natId = Long.parseLong(attrId); int natRevision = Integer.parseInt(attrRevision); 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); } Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } long natRelationTenantId = Long.parseLong(attrRelationTenantId); long natRelationId = Long.parseLong(attrRelationId); long natContTenantId = Long.parseLong(attrContTenantId); long natContPopDep2Id = Long.parseLong(attrContPopDep2Id); String natName = attrName; // Instantiate a buffer for the parsed information ICFBamPopSubDep3Obj obj = schemaObj.getPopSubDep3TableObj().newInstance(); CFBamPopSubDep3Buff dataBuff = obj.getPopSubDep3Buff(); dataBuff.setRequiredTenantId(natTenantId); dataBuff.setRequiredId(natId); dataBuff.setRequiredRevision(natRevision); if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); dataBuff.setOptionalDefSchemaId(natDefSchemaId); dataBuff.setRequiredRelationTenantId(natRelationTenantId); dataBuff.setRequiredRelationId(natRelationId); dataBuff.setRequiredContTenantId(natContTenantId); dataBuff.setRequiredContPopDep2Id(natContPopDep2Id); dataBuff.setRequiredName(natName); obj.copyBuffToPKey(); ICFBamPopSubDep3Obj realized = (ICFBamPopSubDep3Obj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
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; // Index Attributes String attrTableId = null; String attrDefSchemaTenantId = null; String attrDefSchemaId = null; String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrDbName = null; String attrSuffix = null; String attrIsUnique = null; String attrIsDbMapped = null; String attrDefaultVisibility = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstIndexUpdate"); 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("TableId")) { if (attrTableId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaTenantId")) { if (attrDefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchemaId")) { if (attrDefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchemaId = 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("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Suffix")) { if (attrSuffix != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSuffix = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsUnique")) { if (attrIsUnique != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsUnique = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsDbMapped")) { if (attrIsDbMapped != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsDbMapped = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = 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 ((attrTableId == null) || (attrTableId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TableId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsUnique == null) || (attrIsUnique.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsUnique"); } if ((attrIsDbMapped == null) || (attrIsDbMapped.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsDbMapped"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFBamScopePKey pkey = 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 ICFBamIndexObj origBuff = schemaObj.getIndexTableObj().readIndex(pkey); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getIndexTableObj().readIndex()"); } else { // Edit the instance ICFBamIndexEditObj editBuff = (ICFBamIndexEditObj) origBuff.beginEdit(); CFBamIndexBuff dataBuff = editBuff.getIndexBuff(); // 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 natTableId = Long.parseLong(attrTableId); dataBuff.setRequiredTableId(natTableId); Long natDefSchemaTenantId; if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) { natDefSchemaTenantId = null; } else { natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId)); } dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId); Long natDefSchemaId; if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) { natDefSchemaId = null; } else { natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId)); } dataBuff.setOptionalDefSchemaId(natDefSchemaId); String natName = attrName; dataBuff.setRequiredName(natName); String natShortName = attrShortName; dataBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; dataBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; dataBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; dataBuff.setOptionalDescription(natDescription); String natDbName = attrDbName; dataBuff.setOptionalDbName(natDbName); String natSuffix = attrSuffix; dataBuff.setOptionalSuffix(natSuffix); boolean natIsUnique; if (attrIsUnique.equals("true") || attrIsUnique.equals("yes") || attrIsUnique.equals("1")) { natIsUnique = true; } else if (attrIsUnique.equals("false") || attrIsUnique.equals("no") || attrIsUnique.equals("0")) { natIsUnique = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsUnique value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsUnique + "\""); } dataBuff.setRequiredIsUnique(natIsUnique); boolean natIsDbMapped; if (attrIsDbMapped.equals("true") || attrIsDbMapped.equals("yes") || attrIsDbMapped.equals("1")) { natIsDbMapped = true; } else if (attrIsDbMapped.equals("false") || attrIsDbMapped.equals("no") || attrIsDbMapped.equals("0")) { natIsDbMapped = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsDbMapped value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsDbMapped + "\""); } dataBuff.setRequiredIsDbMapped(natIsDbMapped); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } dataBuff.setRequiredDefaultVisibility(natDefaultVisibility); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgIndexMessageFormatter.formatIndexRspnUpdated( "\n\t\t\t", origBuff.getIndexBuff()) + "\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 { try { // Common XML Attributes String attrId = null; // Value Attributes String attrName = null; String attrShortName = null; String attrLabel = null; String attrShortDescription = null; String attrDescription = null; String attrIsNullable = null; String attrGenerateId = null; String attrDefaultVisibility = null; String attrDefSchema = null; String attrDataScope = null; String attrVAccSec = null; String attrEAccSec = null; String attrVAccFreq = null; String attrEAccFreq = null; // Value References ICFBamTenantObj refTenant = null; ICFBamScopeObj refScope = null; ICFBamSchemaDefObj refDefSchema = null; ICFBamDataScopeObj refDataScope = null; ICFBamAccessSecurityObj refVAccSec = null; ICFBamAccessSecurityObj refEAccSec = null; ICFBamAccessFrequencyObj refVAccFreq = null; ICFBamAccessFrequencyObj refEAccFreq = null; // Atom Attributes String attrDbName = null; // Atom References // NmTokensDef Attributes String attrMaxLen = null; String attrInitValue = null; String attrDefaultValue = null; String attrNullValue = null; String attrUnknownValue = null; String attrShowLines = null; // NmTokensDef References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("NmTokensDef"); CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamNmTokensDefEditObj editBuff = (ICFBamNmTokensDefEditObj) schemaObj.getNmTokensDefTableObj().newInstance().beginEdit(); // 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("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortName")) { if (attrShortName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Label")) { if (attrLabel != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLabel = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShortDescription")) { if (attrShortDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShortDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Description")) { if (attrDescription != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescription = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsNullable")) { if (attrIsNullable != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsNullable = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenerateId")) { if (attrGenerateId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerateId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultVisibility")) { if (attrDefaultVisibility != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultVisibility = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchema")) { if (attrDefSchema != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchema = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DataScope")) { if (attrDataScope != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDataScope = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VAccSec")) { if (attrVAccSec != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVAccSec = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EAccSec")) { if (attrEAccSec != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEAccSec = attrs.getValue(idxAttr); } else if (attrLocalName.equals("VAccFreq")) { if (attrVAccFreq != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrVAccFreq = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EAccFreq")) { if (attrEAccFreq != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEAccFreq = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DbName")) { if (attrDbName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDbName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("MaxLen")) { if (attrMaxLen != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMaxLen = attrs.getValue(idxAttr); } else if (attrLocalName.equals("InitValue")) { if (attrInitValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrInitValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefaultValue")) { if (attrDefaultValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefaultValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NullValue")) { if (attrNullValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNullValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UnknownValue")) { if (attrUnknownValue != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUnknownValue = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ShowLines")) { if (attrShowLines != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrShowLines = 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 (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable"); } if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility"); } if ((attrMaxLen == null) || (attrMaxLen.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MaxLen"); } if ((attrShowLines == null) || (attrShowLines.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ShowLines"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Name", attrName); curContext.putNamedValue("ShortName", attrShortName); curContext.putNamedValue("Label", attrLabel); curContext.putNamedValue("ShortDescription", attrShortDescription); curContext.putNamedValue("Description", attrDescription); curContext.putNamedValue("IsNullable", attrIsNullable); curContext.putNamedValue("GenerateId", attrGenerateId); curContext.putNamedValue("DefaultVisibility", attrDefaultVisibility); curContext.putNamedValue("DefSchema", attrDefSchema); curContext.putNamedValue("DataScope", attrDataScope); curContext.putNamedValue("VAccSec", attrVAccSec); curContext.putNamedValue("EAccSec", attrEAccSec); curContext.putNamedValue("VAccFreq", attrVAccFreq); curContext.putNamedValue("EAccFreq", attrEAccFreq); curContext.putNamedValue("DbName", attrDbName); curContext.putNamedValue("MaxLen", attrMaxLen); curContext.putNamedValue("InitValue", attrInitValue); curContext.putNamedValue("DefaultValue", attrDefaultValue); curContext.putNamedValue("NullValue", attrNullValue); curContext.putNamedValue("UnknownValue", attrUnknownValue); curContext.putNamedValue("ShowLines", attrShowLines); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natName = attrName; editBuff.setRequiredName(natName); String natShortName = attrShortName; editBuff.setOptionalShortName(natShortName); String natLabel = attrLabel; editBuff.setOptionalLabel(natLabel); String natShortDescription = attrShortDescription; editBuff.setOptionalShortDescription(natShortDescription); String natDescription = attrDescription; editBuff.setOptionalDescription(natDescription); boolean natIsNullable; if (attrIsNullable.equals("true") || attrIsNullable.equals("yes") || attrIsNullable.equals("1")) { natIsNullable = true; } else if (attrIsNullable.equals("false") || attrIsNullable.equals("no") || attrIsNullable.equals("0")) { natIsNullable = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected IsNullable value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsNullable + "\""); } editBuff.setRequiredIsNullable(natIsNullable); Boolean natGenerateId; if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) { natGenerateId = null; } else if (attrGenerateId.equals("true") || attrGenerateId.equals("yes") || attrGenerateId.equals("1")) { natGenerateId = true; } else if (attrGenerateId.equals("false") || attrGenerateId.equals("no") || attrGenerateId.equals("0")) { natGenerateId = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerateId + "\""); } editBuff.setOptionalGenerateId(natGenerateId); boolean natDefaultVisibility; if (attrDefaultVisibility.equals("true") || attrDefaultVisibility.equals("yes") || attrDefaultVisibility.equals("1")) { natDefaultVisibility = true; } else if (attrDefaultVisibility.equals("false") || attrDefaultVisibility.equals("no") || attrDefaultVisibility.equals("0")) { natDefaultVisibility = false; } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \"" + attrDefaultVisibility + "\""); } editBuff.setRequiredDefaultVisibility(natDefaultVisibility); String natDbName = attrDbName; editBuff.setOptionalDbName(natDbName); int natMaxLen = Integer.parseInt(attrMaxLen); editBuff.setRequiredMaxLen(natMaxLen); String natInitValue = attrInitValue; editBuff.setOptionalInitValue(natInitValue); String natDefaultValue = attrDefaultValue; editBuff.setOptionalDefaultValue(natDefaultValue); String natNullValue = attrNullValue; editBuff.setOptionalNullValue(natNullValue); String natUnknownValue = attrUnknownValue; editBuff.setOptionalUnknownValue(natUnknownValue); short natShowLines = Short.parseShort(attrShowLines); editBuff.setRequiredShowLines(natShowLines); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } // Resolve and apply required Container reference if (scopeObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj"); } else if (scopeObj instanceof ICFBamScopeObj) { refScope = (ICFBamScopeObj) scopeObj; editBuff.setRequiredContainerScope(refScope); refTenant = editBuff.getRequiredOwnerTenant(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamScopeObj"); } // Resolve and apply Owner reference if (refTenant == null) { if (scopeObj instanceof ICFBamTenantObj) { refTenant = (ICFBamTenantObj) scopeObj; editBuff.setRequiredOwnerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>"); } } // Lookup refDefSchema by qualified name if ((attrDefSchema != null) && (attrDefSchema.length() > 0)) { refDefSchema = (ICFBamSchemaDefObj) (editBuff.getNamedObject( schemaObj.getSchemaDefTableObj().getObjQualifyingClass(), attrDefSchema)); if (refDefSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DefSchema reference qualified name \"" + attrDefSchema + "\" to table SchemaDef"); } } else { refDefSchema = null; } editBuff.setOptionalLookupDefSchema(refDefSchema); // Lookup refDataScope by key name value attr if ((attrDataScope != null) && (attrDataScope.length() > 0)) { refDataScope = schemaObj.getDataScopeTableObj().readDataScopeByUNameIdx(attrDataScope); if (refDataScope == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DataScope reference named \"" + attrDataScope + "\" to table DataScope"); } } else { refDataScope = null; } editBuff.setOptionalLookupDataScope(refDataScope); // Lookup refVAccSec by key name value attr if ((attrVAccSec != null) && (attrVAccSec.length() > 0)) { refVAccSec = schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrVAccSec); if (refVAccSec == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve VAccSec reference named \"" + attrVAccSec + "\" to table AccessSecurity"); } } else { refVAccSec = null; } editBuff.setOptionalLookupVAccSec(refVAccSec); // Lookup refEAccSec by key name value attr if ((attrEAccSec != null) && (attrEAccSec.length() > 0)) { refEAccSec = schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrEAccSec); if (refEAccSec == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve EAccSec reference named \"" + attrEAccSec + "\" to table AccessSecurity"); } } else { refEAccSec = null; } editBuff.setOptionalLookupEAccSec(refEAccSec); // Lookup refVAccFreq by key name value attr if ((attrVAccFreq != null) && (attrVAccFreq.length() > 0)) { refVAccFreq = schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrVAccFreq); if (refVAccFreq == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve VAccFreq reference named \"" + attrVAccFreq + "\" to table AccessFrequency"); } } else { refVAccFreq = null; } editBuff.setOptionalLookupVAccFreq(refVAccFreq); // Lookup refEAccFreq by key name value attr if ((attrEAccFreq != null) && (attrEAccFreq.length() > 0)) { refEAccFreq = schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrEAccFreq); if (refEAccFreq == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve EAccFreq reference named \"" + attrEAccFreq + "\" to table AccessFrequency"); } } else { refEAccFreq = null; } editBuff.setOptionalLookupEAccFreq(refEAccFreq); CFBamSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getNmTokensDefLoaderBehaviour(); ICFBamNmTokensDefEditObj editNmTokensDef = null; ICFBamNmTokensDefObj origNmTokensDef = schemaObj .getNmTokensDefTableObj() .readNmTokensDefByUNameIdx( refTenant.getRequiredId(), refScope.getRequiredId(), editBuff.getRequiredName()); if (origNmTokensDef == null) { editNmTokensDef = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editNmTokensDef = (ICFBamNmTokensDefEditObj) origNmTokensDef.beginEdit(); editNmTokensDef.setRequiredName(editBuff.getRequiredName()); editNmTokensDef.setOptionalShortName(editBuff.getOptionalShortName()); editNmTokensDef.setOptionalLabel(editBuff.getOptionalLabel()); editNmTokensDef.setOptionalShortDescription(editBuff.getOptionalShortDescription()); editNmTokensDef.setOptionalDescription(editBuff.getOptionalDescription()); editNmTokensDef.setRequiredIsNullable(editBuff.getRequiredIsNullable()); editNmTokensDef.setOptionalGenerateId(editBuff.getOptionalGenerateId()); editNmTokensDef.setRequiredDefaultVisibility(editBuff.getRequiredDefaultVisibility()); editNmTokensDef.setOptionalDbName(editBuff.getOptionalDbName()); editNmTokensDef.setRequiredMaxLen(editBuff.getRequiredMaxLen()); editNmTokensDef.setOptionalInitValue(editBuff.getOptionalInitValue()); editNmTokensDef.setOptionalDefaultValue(editBuff.getOptionalDefaultValue()); editNmTokensDef.setOptionalNullValue(editBuff.getOptionalNullValue()); editNmTokensDef.setOptionalUnknownValue(editBuff.getOptionalUnknownValue()); editNmTokensDef.setRequiredShowLines(editBuff.getRequiredShowLines()); editNmTokensDef.setOptionalLookupDefSchema(editBuff.getOptionalLookupDefSchema()); editNmTokensDef.setOptionalLookupDataScope(editBuff.getOptionalLookupDataScope()); editNmTokensDef.setOptionalLookupVAccSec(editBuff.getOptionalLookupVAccSec()); editNmTokensDef.setOptionalLookupEAccSec(editBuff.getOptionalLookupEAccSec()); editNmTokensDef.setOptionalLookupVAccFreq(editBuff.getOptionalLookupVAccFreq()); editNmTokensDef.setOptionalLookupEAccFreq(editBuff.getOptionalLookupEAccFreq()); break; case Replace: editNmTokensDef = (ICFBamNmTokensDefEditObj) origNmTokensDef.beginEdit(); editNmTokensDef.delete(); editNmTokensDef.endEdit(); origNmTokensDef = null; editNmTokensDef = editBuff; break; } } if (editNmTokensDef != null) { if (origNmTokensDef != null) { editNmTokensDef.update(); } else { origNmTokensDef = (ICFBamNmTokensDefObj) editNmTokensDef.create(); } editNmTokensDef.endEdit(); } curContext.putNamedValue("Object", origNmTokensDef); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public ICFBamClearTopDepObj realizeClearTopDep(ICFBamClearTopDepObj Obj) { ICFBamClearTopDepObj obj = Obj; CFBamScopePKey pkey = obj.getPKey(); ICFBamClearTopDepObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFBamClearTopDepObj 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 (indexByTenantIdx != null) { CFBamScopeByTenantIdxKey keyTenantIdx = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexByTableIdx != null) { CFBamClearDepByTableIdxKey keyTableIdx = schema.getBackingStore().getFactoryClearDep().newTableIdxKey(); keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx); if (mapTableIdx != null) { indexByTableIdx.remove(keyTableIdx); } } if (indexByContTblIdx != null) { CFBamClearTopDepByContTblIdxKey keyContTblIdx = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(keyContTblIdx); if (mapContTblIdx != null) { mapContTblIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFBamClearTopDepByUNameIdxKey keyUNameIdx = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } // Keep passing the new object because it's the one with the buffer // that the base table needs to copy to the existing object from // the cache. keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(Obj); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByTenantIdx != null) { CFBamScopeByTenantIdxKey keyTenantIdx = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByTableIdx != null) { CFBamClearDepByTableIdxKey keyTableIdx = schema.getBackingStore().getFactoryClearDep().newTableIdxKey(); keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx); if (mapTableIdx != null) { mapTableIdx.put(keepObj.getPKey(), keepObj); } } if (indexByContTblIdx != null) { CFBamClearTopDepByContTblIdxKey keyContTblIdx = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(keyContTblIdx); if (mapContTblIdx != null) { mapContTblIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFBamClearTopDepByUNameIdxKey keyUNameIdx = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allClearTopDep != null) { allClearTopDep.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(keepObj); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allClearTopDep != null) { allClearTopDep.put(keepObj.getPKey(), keepObj); } if (indexByTenantIdx != null) { CFBamScopeByTenantIdxKey keyTenantIdx = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByTableIdx != null) { CFBamClearDepByTableIdxKey keyTableIdx = schema.getBackingStore().getFactoryClearDep().newTableIdxKey(); keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx); if (mapTableIdx != null) { mapTableIdx.put(keepObj.getPKey(), keepObj); } } if (indexByContTblIdx != null) { CFBamClearTopDepByContTblIdxKey keyContTblIdx = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(keyContTblIdx); if (mapContTblIdx != null) { mapContTblIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFBamClearTopDepByUNameIdxKey keyUNameIdx = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }
public void forgetClearTopDep(ICFBamClearTopDepObj Obj, boolean forgetSubObjects) { ICFBamClearTopDepObj obj = Obj; CFBamScopePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFBamClearTopDepObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFBamScopeByTenantIdxKey keyTenantIdx = schema.getBackingStore().getFactoryScope().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexByTableIdx != null) { CFBamClearDepByTableIdxKey keyTableIdx = schema.getBackingStore().getFactoryClearDep().newTableIdxKey(); keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx); if (mapTableIdx != null) { indexByTableIdx.remove(keyTableIdx); } } if (indexByContTblIdx != null) { CFBamClearTopDepByContTblIdxKey keyContTblIdx = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(keyContTblIdx); if (mapContTblIdx != null) { mapContTblIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFBamClearTopDepByUNameIdxKey keyUNameIdx = schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } if (allClearTopDep != null) { allClearTopDep.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { schema .getClearSubDep1TableObj() .forgetClearSubDep1ByContClearTopIdx( keepObj.getRequiredTenantId(), keepObj.getRequiredId()); } } schema.getClearDepTableObj().forgetClearDep(obj); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // DataScope Attributes String attrName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("DataScope"); CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = xmsgRspnHandler.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("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 ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types short natId = Short.parseShort(attrId); String natName = attrName; int natRevision = Integer.parseInt(attrRevision); // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFBamDataScopeObj obj = schemaObj.getDataScopeTableObj().newInstance(); CFBamDataScopeBuff dataBuff = obj.getDataScopeBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredName(natName); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); @SuppressWarnings("unchecked") List<ICFBamDataScopeObj> list = (List<ICFBamDataScopeObj>) xmsgRspnHandler.getListOfObjects(); ICFBamDataScopeObj realized = (ICFBamDataScopeObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(realized); } } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTenantId = null; String attrScopeId = 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("RqstTextTypeReadByUNameIdx"); 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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeId")) { if (attrScopeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeId = 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 ((attrScopeId == null) || (attrScopeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } // Save named attributes to 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); long natScopeId; natScopeId = Long.parseLong(attrScopeId); String natName; natName = attrName; // Read the object ICFBamTextTypeObj read = schemaObj .getTextTypeTableObj() .readTextTypeByUNameIdx(natTenantId, natScopeId, natName, true); if (read != null) { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnSingleOpenTag() + CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec( "\n\t\t", read.getValueBuff()) + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnSingleCloseTag() + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.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 attrEditAccessFrequencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstValueDeleteByEAccFreqIdx"); 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("EditAccessFrequencyId")) { if (attrEditAccessFrequencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEditAccessFrequencyId = 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 // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types Short natEditAccessFrequencyId; natEditAccessFrequencyId = new Short(Short.parseShort(attrEditAccessFrequencyId)); // Delete the objects schemaObj.getStringTypeTableObj().deleteStringTypeByEAccFreqIdx(natEditAccessFrequencyId); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnDeleted() + "\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; // SchemaRef Attributes String attrSchemaId = null; String attrName = null; String attrRefModelName = null; String attrIncludeRoot = null; String attrRefSchemaTenantId = null; String attrRefSchemaId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSchemaRefCreate"); 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 an edit buffer for the parsed information ICFBamSchemaRefEditObj editBuff = (ICFBamSchemaRefEditObj) schemaObj.getSchemaRefTableObj().newInstance().beginEdit(); CFBamSchemaRefBuff dataBuff = editBuff.getSchemaRefBuff(); // 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 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("SchemaId")) { if (attrSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSchemaId = 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("RefModelName")) { if (attrRefModelName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRefModelName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IncludeRoot")) { if (attrIncludeRoot != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIncludeRoot = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RefSchemaTenantId")) { if (attrRefSchemaTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRefSchemaTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RefSchemaId")) { if (attrRefSchemaId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRefSchemaId = attrs.getValue(idxAttr); } 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 ((attrSchemaId == null) || (attrSchemaId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrRefModelName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "RefModelName"); } if (attrIncludeRoot == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "IncludeRoot"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId = Long.parseLong(attrTenantId); dataBuff.setRequiredTenantId(natTenantId); 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 natSchemaId = Long.parseLong(attrSchemaId); dataBuff.setRequiredSchemaId(natSchemaId); String natName = attrName; dataBuff.setRequiredName(natName); String natRefModelName = attrRefModelName; dataBuff.setRequiredRefModelName(natRefModelName); String natIncludeRoot = attrIncludeRoot; dataBuff.setRequiredIncludeRoot(natIncludeRoot); Long natRefSchemaTenantId; if ((attrRefSchemaTenantId == null) || (attrRefSchemaTenantId.length() <= 0)) { natRefSchemaTenantId = null; } else { natRefSchemaTenantId = new Long(Long.parseLong(attrRefSchemaTenantId)); } dataBuff.setOptionalRefSchemaTenantId(natRefSchemaTenantId); Long natRefSchemaId; if ((attrRefSchemaId == null) || (attrRefSchemaId.length() <= 0)) { natRefSchemaId = null; } else { natRefSchemaId = new Long(Long.parseLong(attrRefSchemaId)); } dataBuff.setOptionalRefSchemaId(natRefSchemaId); // Attempt the create editBuff.copyBuffToPKey(); // Allow for predefined ids ICFBamSchemaRefObj created = (ICFBamSchemaRefObj) editBuff.create(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaRefMessageFormatter.formatSchemaRefRspnCreated( "\n\t\t\t", created.getSchemaRefBuff()) + "\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 attrNextTenantId = null; String attrNextId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstInt32ColReadByNextIdx"); 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("NextTenantId")) { if (attrNextTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("NextId")) { if (attrNextId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrNextId = 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 // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Long natNextTenantId; natNextTenantId = new Long(Long.parseLong(attrNextTenantId)); Long natNextId; natNextId = new Long(Long.parseLong(attrNextId)); // Read the objects List<ICFBamInt32ColObj> list = schemaObj.getInt32ColTableObj().readInt32ColByNextIdx(natNextTenantId, natNextId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFBamInt32ColObj> iter = list.iterator(); ICFBamInt32ColObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFBamXMsgValueMessageFormatter.formatValueRspnDerivedRec("\n\t\t", cur.getValueBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFBamXMsgValueMessageFormatter.formatValueRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } 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 List<ICFBamClearTopDepObj> readAllClearTopDep(boolean forceRead) { final String S_ProcName = "readAllClearTopDep"; if ((allClearTopDep == null) || forceRead) { Map<CFBamScopePKey, ICFBamClearTopDepObj> map = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); allClearTopDep = map; CFBamClearTopDepBuff[] buffList = schema.getBackingStore().getTableClearTopDep().readAllDerived(schema.getAuthorization()); CFBamClearTopDepBuff buff; ICFBamClearTopDepObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(buff); ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize(); } } Comparator<ICFBamClearTopDepObj> cmp = new Comparator<ICFBamClearTopDepObj>() { public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFBamScopePKey lhsPKey = lhs.getPKey(); CFBamScopePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allClearTopDep.size(); ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len]; Iterator<ICFBamClearTopDepObj> valIter = allClearTopDep.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFBamClearTopDepObj> sortedList = arrayList; return (sortedList); }
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 List<ICFBamClearTopDepObj> readClearTopDepByContTblIdx( long TenantId, long ContTableId, boolean forceRead) { final String S_ProcName = "readClearTopDepByContTblIdx"; CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); Map<CFBamScopePKey, ICFBamClearTopDepObj> dict; if (indexByContTblIdx == null) { indexByContTblIdx = new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if ((!forceRead) && indexByContTblIdx.containsKey(key)) { dict = indexByContTblIdx.get(key); } else { dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); // Allow other threads to dirty-read while we're loading indexByContTblIdx.put(key, dict); ICFBamClearTopDepObj obj; CFBamClearTopDepBuff[] buffList = schema .getBackingStore() .getTableClearTopDep() .readDerivedByContTblIdx(schema.getAuthorization(), TenantId, ContTableId); CFBamClearTopDepBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(buff); ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize(); } } Comparator<ICFBamClearTopDepObj> cmp = new Comparator<ICFBamClearTopDepObj>() { public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFBamScopePKey lhsPKey = lhs.getPKey(); CFBamScopePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len]; Iterator<ICFBamClearTopDepObj> valIter = dict.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFBamClearTopDepObj> sortedList = arrayList; return (sortedList); }
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 { try { // Common XML Attributes String attrId = null; // Scope Attributes // Scope References ICFBamTenantObj refTenant = null; // DelDep Attributes String attrRelation = null; String attrDefSchema = null; // DelDep References ICFBamRelationObj refRelation = null; ICFBamSchemaDefObj refDefSchema = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("DelDep"); CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFBamDelDepEditObj editBuff = (ICFBamDelDepEditObj) schemaObj.getDelDepTableObj().newInstance().beginEdit(); // 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("Relation")) { if (attrRelation != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRelation = attrs.getValue(idxAttr); } else if (attrLocalName.equals("DefSchema")) { if (attrDefSchema != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDefSchema = 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 ((attrRelation == null) || (attrRelation.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Relation"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Relation", attrRelation); curContext.putNamedValue("DefSchema", attrDefSchema); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } refTenant = null; // Resolve and apply Owner reference if (refTenant == null) { if (scopeObj instanceof ICFBamTenantObj) { refTenant = (ICFBamTenantObj) scopeObj; editBuff.setRequiredOwnerTenant(refTenant); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>"); } } // Lookup refRelation by qualified name if ((attrRelation != null) && (attrRelation.length() > 0)) { refRelation = (ICFBamRelationObj) (editBuff.getNamedObject( schemaObj.getRelationTableObj().getObjQualifyingClass(), attrRelation)); if (refRelation == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve Relation reference qualified name \"" + attrRelation + "\" to table Relation"); } } else { refRelation = null; } editBuff.setRequiredLookupRelation(refRelation); // Lookup refDefSchema by qualified name if ((attrDefSchema != null) && (attrDefSchema.length() > 0)) { refDefSchema = (ICFBamSchemaDefObj) (editBuff.getNamedObject( schemaObj.getSchemaDefTableObj().getObjQualifyingClass(), attrDefSchema)); if (refDefSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "Resolve DefSchema reference qualified name \"" + attrDefSchema + "\" to table SchemaDef"); } } else { refDefSchema = null; } editBuff.setOptionalLookupDefSchema(refDefSchema); ICFBamDelDepObj origDelDep; ICFBamDelDepEditObj editDelDep = editBuff; origDelDep = (ICFBamDelDepObj) editDelDep.create(); editDelDep.endEdit(); curContext.putNamedValue("Object", origDelDep); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }