public void deleteDomain(ICFInternetDomainObj Obj) { ICFInternetDomainObj obj = Obj; ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomain(schema.getAuthorization(), obj.getDomainBuff()); obj.forget(true); }
public void deleteDomainBySubDomIdx(long TenantId, long SubDomainOfId) { CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx == null) { indexBySubDomIdx = new HashMap< CFInternetDomainBySubDomIdxKey, Map<CFInternetDomainBasePKey, ICFInternetDomainObj>>(); } if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> dict = indexBySubDomIdx.get(key); ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); Iterator<ICFInternetDomainObj> iter = dict.values().iterator(); ICFInternetDomainObj obj; List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexBySubDomIdx.remove(key); } else { ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); } }
public ICFInternetDomainObj updateDomain(ICFInternetDomainObj Obj) { ICFInternetDomainObj obj = Obj; ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .updateDomain(schema.getAuthorization(), Obj.getDomainBuff()); if (Obj.getClassCode().equals("DOMN")) { obj = (ICFInternetDomainObj) Obj.realize(); } return (obj); }
public ICFInternetDomainObj createDomain(ICFInternetDomainObj Obj) { ICFInternetDomainObj obj = Obj; CFInternetDomainBuff buff = obj.getDomainBuff(); ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .createDomain(schema.getAuthorization(), buff); obj.copyBuffToPKey(); if (obj.getPKey().getClassCode().equals("DOMN")) { obj = (ICFInternetDomainObj) (obj.realize()); } return (obj); }
public void forgetDomain(ICFInternetDomainObj Obj, boolean forgetSubObjects) { ICFInternetDomainObj obj = Obj; CFInternetDomainBasePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFInternetDomainObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.remove(keepObj.getPKey()); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.remove(keyNameIdx); } if (allDomain != null) { allDomain.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFInternetSchemaObj) schema) .getTopProjectTableObj() .forgetTopProjectByDomainIdx(keepObj.getRequiredTenantId(), keepObj.getRequiredId()); } } ((ICFBamSchemaObj) schema).getDomainBaseTableObj().forgetDomainBase(obj); }
public void forgetDomainBySubDomIdx(long TenantId, long SubDomainOfId) { if (indexBySubDomIdx == null) { return; } CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(key); if (mapSubDomIdx != null) { List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); ICFInternetDomainObj cur = null; Iterator<ICFInternetDomainObj> iter = mapSubDomIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexBySubDomIdx.remove(key); } }
public void deleteDomainByIdIdx(long TenantId, long Id) { CFInternetDomainBasePKey pkey = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(TenantId); pkey.setRequiredId(Id); ICFInternetDomainObj obj = readDomain(pkey); if (obj != null) { ICFInternetDomainEditObj editObj = (ICFInternetDomainEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFInternetDomainEditObj) 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 ICFInternetDomainObj readDomainByIdIdx(long TenantId, long Id, boolean forceRead) { CFInternetDomainBasePKey pkey = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(TenantId); pkey.setRequiredId(Id); ICFInternetDomainObj obj = readDomain(pkey, forceRead); return (obj); }
public ICFInternetDomainObj lockDomain(CFInternetDomainBasePKey pkey) { ICFInternetDomainObj locked = null; CFInternetDomainBuff lockBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(lockBuff.getClassCode()); locked.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); locked.setBuff(lockBuff); locked = (ICFInternetDomainObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockDomain", pkey); } return (locked); }
public ICFInternetDomainObj readDomainByNameIdx( long TenantId, long SubDomainOfId, String Name, boolean forceRead) { if (indexByNameIdx == null) { indexByNameIdx = new HashMap<CFInternetDomainByNameIdxKey, ICFInternetDomainObj>(); } CFInternetDomainByNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); key.setRequiredName(Name); ICFInternetDomainObj obj = null; if ((!forceRead) && indexByNameIdx.containsKey(key)) { obj = indexByNameIdx.get(key); } else { CFInternetDomainBuff buff = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readDerivedByNameIdx(schema.getAuthorization(), TenantId, SubDomainOfId, Name); if (buff != null) { obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(buff); obj = (ICFInternetDomainObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByNameIdx.put(key, null); } } return (obj); }
public void deleteDomainByNameIdx(long TenantId, long SubDomainOfId, String Name) { if (indexByNameIdx == null) { indexByNameIdx = new HashMap<CFInternetDomainByNameIdxKey, ICFInternetDomainObj>(); } CFInternetDomainByNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); key.setRequiredName(Name); ICFInternetDomainObj obj = null; if (indexByNameIdx.containsKey(key)) { obj = indexByNameIdx.get(key); ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainByNameIdx(schema.getAuthorization(), TenantId, SubDomainOfId, Name); obj.forget(true); } else { ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainByNameIdx(schema.getAuthorization(), TenantId, SubDomainOfId, Name); } }
public ICFInternetDomainObj readDomain(CFInternetDomainBasePKey pkey, boolean forceRead) { ICFInternetDomainObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFInternetDomainBuff readBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredId()); if (readBuff != null) { obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(readBuff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(readBuff); obj = (ICFInternetDomainObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public void forgetDomainByIdIdx(long TenantId, long Id) { if (members == null) { return; } CFInternetDomainBasePKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); if (members.containsKey(key)) { ICFInternetDomainObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void forgetDomainByNameIdx(long TenantId, long SubDomainOfId, String Name) { if (indexByNameIdx == null) { return; } CFInternetDomainByNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); key.setRequiredName(Name); if (indexByNameIdx.containsKey(key)) { ICFInternetDomainObj probed = indexByNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByNameIdx.remove(key); } }
public ICFInternetDomainObj realizeDomain(ICFInternetDomainObj Obj) { ICFInternetDomainObj obj = Obj; CFInternetDomainBasePKey pkey = obj.getPKey(); ICFInternetDomainObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFInternetDomainObj 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) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.remove(keepObj.getPKey()); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.remove(keyNameIdx); } // 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 = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(Obj); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.put(keepObj.getPKey(), keepObj); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } if (allDomain != null) { allDomain.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(keepObj); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allDomain != null) { allDomain.put(keepObj.getPKey(), keepObj); } if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.put(keepObj.getPKey(), keepObj); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } } return (keepObj); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support String attrClusterId = null; String attrSecGroupIncludeId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecGroupIncludeLock"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFSecuritySecGroupIncludePKey pkey = ((ICFInternetSchema) schemaObj.getBackingStore()).getFactorySecGroupInclude().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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecGroupIncludeId")) { if (attrSecGroupIncludeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecGroupIncludeId = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if ((attrSecGroupIncludeId == null) || (attrSecGroupIncludeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupIncludeId"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natClusterId; natClusterId = Long.parseLong(attrClusterId); pkey.setRequiredClusterId(natClusterId); pkey.setRequiredClusterId(natClusterId); long natSecGroupIncludeId; natSecGroupIncludeId = Long.parseLong(attrSecGroupIncludeId); pkey.setRequiredSecGroupIncludeId(natSecGroupIncludeId); pkey.setRequiredSecGroupIncludeId(natSecGroupIncludeId); // Lock the object ICFInternetSecGroupIncludeObj locked = ((ICFInternetSecGroupIncludeObj) schemaObj.getSecGroupIncludeTableObj().lockSecGroupInclude(pkey)); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRspnLocked( "\n\t\t\t", locked.getSecGroupIncludeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.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 { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // MimeType Attributes String attrMimeTypeId = null; String attrName = null; String attrFileTypes = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstMimeTypeUpdate"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj 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("MimeTypeId")) { if (attrMimeTypeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrMimeTypeId = 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("FileTypes")) { if (attrFileTypes != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFileTypes = 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 ((attrMimeTypeId == null) || (attrMimeTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "MimeTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if (attrFileTypes == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FileTypes"); } 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"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFInternetMimeTypePKey pkey = ((ICFInternetSchema) schemaObj.getBackingStore()).getFactoryMimeType().newPKey(); int natMimeTypeId; natMimeTypeId = Integer.parseInt(attrMimeTypeId); pkey.setRequiredMimeTypeId(natMimeTypeId); // Read the instance ICFInternetMimeTypeObj origBuff = ((ICFInternetMimeTypeObj) schemaObj.getMimeTypeTableObj().readMimeType(pkey)); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "getMimeTypeTableObj().readMimeType()"); } else { // Edit the instance ICFInternetMimeTypeEditObj editBuff = (ICFInternetMimeTypeEditObj) origBuff.beginEdit(); CFInternetMimeTypeBuff dataBuff = editBuff.getMimeTypeBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. String natName = attrName; dataBuff.setRequiredName(natName); String natFileTypes = attrFileTypes; dataBuff.setRequiredFileTypes(natFileTypes); 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); } // Attempt the update editBuff.update(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgMimeTypeMessageFormatter.formatMimeTypeRspnUpdated( "\n\t\t\t", origBuff.getMimeTypeBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.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 { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrClusterId = null; String attrTenantName = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTenantReadByUNameIdx"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj 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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantName")) { if (attrTenantName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantName = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if (attrTenantName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantName"); } // 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 natClusterId; natClusterId = Long.parseLong(attrClusterId); String natTenantName; natTenantName = attrTenantName; // Read the object ICFInternetTenantObj read = ((ICFInternetTenantObj) schemaObj .getTenantTableObj() .readTenantByUNameIdx(natClusterId, natTenantName, true)); if (read != null) { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgTenantMessageFormatter.formatTenantRspnSingleOpenTag() + CFInternetXMsgTenantMessageFormatter.formatTenantRspnDerivedRec( "\n\t\t", read.getTenantBuff()) + "\n" + "\t" + CFInternetXMsgTenantMessageFormatter.formatTenantRspnSingleCloseTag() + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.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; String attrRevision = null; // SecGroupForm Attributes String attrClusterId = null; String attrSecGroupFormId = null; String attrSecGroupId = null; String attrSecAppId = null; String attrSecFormId = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnSecGroupFormUpdated"); CFInternetXMsgRspnHandler xmsgRspnHandler = (CFInternetXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFInternetSchemaObj 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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecGroupFormId")) { if (attrSecGroupFormId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecGroupFormId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecGroupId")) { if (attrSecGroupId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecGroupId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecAppId")) { if (attrSecAppId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecAppId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecFormId")) { if (attrSecFormId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecFormId = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId"); } if ((attrSecGroupFormId == null) || (attrSecGroupFormId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupFormId"); } if ((attrSecGroupId == null) || (attrSecGroupId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupId"); } if ((attrSecAppId == null) || (attrSecAppId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecAppId"); } if ((attrSecFormId == null) || (attrSecFormId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "SecFormId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types long natClusterId = Long.parseLong(attrClusterId); long natSecGroupFormId = Long.parseLong(attrSecGroupFormId); int natSecGroupId = Integer.parseInt(attrSecGroupId); int natSecAppId = Integer.parseInt(attrSecAppId); int natSecFormId = Integer.parseInt(attrSecFormId); 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); } // Instantiate a buffer for the parsed information ICFInternetSecGroupFormObj obj = (ICFInternetSecGroupFormObj) schemaObj.getSecGroupFormTableObj().newInstance(); CFSecuritySecGroupFormBuff dataBuff = obj.getSecGroupFormBuff(); dataBuff.setRequiredClusterId(natClusterId); dataBuff.setRequiredSecGroupFormId(natSecGroupFormId); dataBuff.setRequiredSecGroupId(natSecGroupId); dataBuff.setRequiredSecAppId(natSecAppId); dataBuff.setRequiredSecFormId(natSecFormId); 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); } obj.copyBuffToPKey(); ICFInternetSecGroupFormObj realized = (ICFInternetSecGroupFormObj) 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 List<ICFInternetDomainObj> readAllDomain(boolean forceRead) { final String S_ProcName = "readAllDomain"; if ((allDomain == null) || forceRead) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> map = new HashMap<CFInternetDomainBasePKey, ICFInternetDomainObj>(); allDomain = map; CFInternetDomainBuff[] buffList = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readAllDerived(schema.getAuthorization()); CFInternetDomainBuff buff; ICFInternetDomainObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(buff); ICFInternetDomainObj realized = (ICFInternetDomainObj) obj.realize(); } } Comparator<ICFInternetDomainObj> cmp = new Comparator<ICFInternetDomainObj>() { public int compare(ICFInternetDomainObj lhs, ICFInternetDomainObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFInternetDomainBasePKey lhsPKey = lhs.getPKey(); CFInternetDomainBasePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allDomain.size(); ICFInternetDomainObj arr[] = new ICFInternetDomainObj[len]; Iterator<ICFInternetDomainObj> valIter = allDomain.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<ICFInternetDomainObj> arrayList = new ArrayList<ICFInternetDomainObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFInternetDomainObj> sortedList = arrayList; return (sortedList); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstAuditActionReadAll"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj 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("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Read the objects and prepare the response XML List<ICFSecurityAuditActionObj> list = schemaObj.getAuditActionTableObj().readAllAuditAction(true); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgAuditActionMessageFormatter.formatAuditActionRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecurityAuditActionObj> iter = list.iterator(); ICFSecurityAuditActionObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFInternetXMsgAuditActionMessageFormatter.formatAuditActionRspnDerivedRec( "\n\t\t", cur.getAuditActionBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFInternetXMsgAuditActionMessageFormatter.formatAuditActionRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public List<ICFInternetDomainObj> readDomainBySubDomIdx( long TenantId, long SubDomainOfId, boolean forceRead) { final String S_ProcName = "readDomainBySubDomIdx"; CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> dict; if (indexBySubDomIdx == null) { indexBySubDomIdx = new HashMap< CFInternetDomainBySubDomIdxKey, Map<CFInternetDomainBasePKey, ICFInternetDomainObj>>(); } if ((!forceRead) && indexBySubDomIdx.containsKey(key)) { dict = indexBySubDomIdx.get(key); } else { dict = new HashMap<CFInternetDomainBasePKey, ICFInternetDomainObj>(); // Allow other threads to dirty-read while we're loading indexBySubDomIdx.put(key, dict); ICFInternetDomainObj obj; CFInternetDomainBuff[] buffList = ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .readDerivedBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); CFInternetDomainBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey()); obj.setBuff(buff); ICFInternetDomainObj realized = (ICFInternetDomainObj) obj.realize(); } } Comparator<ICFInternetDomainObj> cmp = new Comparator<ICFInternetDomainObj>() { public int compare(ICFInternetDomainObj lhs, ICFInternetDomainObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFInternetDomainBasePKey lhsPKey = lhs.getPKey(); CFInternetDomainBasePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFInternetDomainObj arr[] = new ICFInternetDomainObj[len]; Iterator<ICFInternetDomainObj> 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<ICFInternetDomainObj> arrayList = new ArrayList<ICFInternetDomainObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFInternetDomainObj> sortedList = arrayList; return (sortedList); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFInternetXMsgSchemaMessageFormatter 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("RqstSubProjectDelete"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFInternetDomainBasePKey pkey = ((ICFInternetSchema) schemaObj.getBackingStore()).getFactoryDomainBase().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 ICFInternetSubProjectObj read = ((ICFInternetSubProjectObj) schemaObj.getSubProjectTableObj().readSubProject(pkey)); if (read != null) { if (read.getSubProjectBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete SubProject"); } else { ICFInternetSubProjectEditObj editBuff = (ICFInternetSubProjectEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSubProjectMessageFormatter.formatSubProjectRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.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 { CFInternetXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrEMailConfirmationUuid = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecUserDeleteByEMConfIdx"); CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFInternetSchemaObj 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("EMailConfirmationUuid")) { if (attrEMailConfirmationUuid != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEMailConfirmationUuid = 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 UUID natEMailConfirmationUuid; if ((attrEMailConfirmationUuid == null) || (attrEMailConfirmationUuid.length() <= 0)) { natEMailConfirmationUuid = null; } else { natEMailConfirmationUuid = UUID.fromString(attrEMailConfirmationUuid); } // Delete the objects schemaObj.getSecUserTableObj().deleteSecUserByEMConfIdx(natEMailConfirmationUuid); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSecUserMessageFormatter.formatSecUserRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }