public CFSecurityClusterBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, long Id) { final String S_ProcName = "CFDbTestRamCluster.readBuffByIdIdx() "; CFSecurityClusterBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("CLUS")) { return ((CFSecurityClusterBuff) buff); } else { return (null); } }
public CFSecurityClusterBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "lockBuff"; CFSecurityClusterBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("CLUS"))) { buff = null; } return (buff); }
public ICFSecuritySecUserObj getUpdatedBy() { if (updatedBy == null) { CFSecurityClusterBuff buff = getBuff(); updatedBy = ((ICFDbTestSchemaObj) getSchema()) .getSecUserTableObj() .readSecUserByIdIdx(buff.getUpdatedByUserId()); } return (updatedBy); }
public CFSecurityClusterBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFDbTestRamCluster.readAllBuff"; CFSecurityClusterBuff buff; ArrayList<CFSecurityClusterBuff> filteredList = new ArrayList<CFSecurityClusterBuff>(); CFSecurityClusterBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CLUS")) { filteredList.add(buff); } } return (filteredList.toArray(new CFSecurityClusterBuff[0])); }
public void setClusterBuff(CFSecurityClusterBuff src) { setRequiredId(src.getRequiredId()); setCreatedByUserId(src.getCreatedByUserId()); setCreatedAt(src.getCreatedAt()); setUpdatedByUserId(src.getUpdatedByUserId()); setUpdatedAt(src.getUpdatedAt()); setRequiredFullDomainName(src.getRequiredFullDomainName()); setRequiredDescription(src.getRequiredDescription()); setRequiredRevision(src.getRequiredRevision()); }
public CFSecurityClusterBuff getBuff() { if (buff == null) { buff = ((ICFInternetSchema) getOrigAsCluster().getSchema().getBackingStore()) .getFactoryCluster() .newBuff(); buff.set(orig.getBuff()); } return (buff); }
public void createCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "createCluster"; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(schema.nextClusterIdGen()); Buff.setRequiredId(pkey.getRequiredId()); CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUDomainNameIdx.containsKey(keyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ClusterUDomainNameIdx", keyUDomainNameIdx); } if (dictByUDescrIdx.containsKey(keyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ClusterUDescrNameIdx", keyUDescrIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.put(keyUDomainNameIdx, Buff); dictByUDescrIdx.put(keyUDescrIdx, Buff); }
public void deleteCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "CFDbTestRamClusterTable.deleteCluster() "; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteCluster", pkey); } CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys // Delete is valid schema.getTableHostNode().deleteHostNodeByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableTenant().deleteTenantByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSecApp().deleteSecAppByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSecGroup().deleteSecGroupByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSysCluster().deleteSysClusterByClusterIdx(Authorization, Buff.getRequiredId()); Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByUDomainNameIdx.remove(keyUDomainNameIdx); dictByUDescrIdx.remove(keyUDescrIdx); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // Cluster Attributes String attrFullDomainName = null; String attrDescription = 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("RspnClusterLocked"); CFSecurityXMsgRspnHandler xmsgRspnHandler = (CFSecurityXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj 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("FullDomainName")) { if (attrFullDomainName != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFullDomainName = 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("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 (attrFullDomainName == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "FullDomainName"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } 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 natId = Long.parseLong(attrId); String natFullDomainName = attrFullDomainName; String natDescription = attrDescription; 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 ICFSecurityClusterObj obj = (ICFSecurityClusterObj) schemaObj.getClusterTableObj().newInstance(); CFSecurityClusterBuff dataBuff = obj.getClusterBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredFullDomainName(natFullDomainName); dataBuff.setRequiredDescription(natDescription); 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(); ICFSecurityClusterObj realized = (ICFSecurityClusterObj) 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 int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFSecurityClusterBuff) { CFSecurityClusterBuff rhs = (CFSecurityClusterBuff) obj; int retval = 0; { int cmp = getCreatedByUserId().compareTo(rhs.getCreatedByUserId()); if (cmp != 0) { return (cmp); } cmp = getCreatedAt().compareTo(rhs.getCreatedAt()); if (cmp != 0) { return (cmp); } cmp = getUpdatedByUserId().compareTo(rhs.getUpdatedByUserId()); if (cmp != 0) { return (cmp); } cmp = getUpdatedAt().compareTo(rhs.getUpdatedAt()); if (cmp != 0) { return (cmp); } } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } { int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName()); if (cmp != 0) { return (cmp); } } { int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFSecurityClusterPKey) { CFSecurityClusterPKey rhs = (CFSecurityClusterPKey) obj; if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFSecurityClusterHPKey) { CFSecurityClusterHPKey rhs = (CFSecurityClusterHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFSecurityClusterHBuff) { CFSecurityClusterHBuff rhs = (CFSecurityClusterHBuff) obj; int retval = 0; if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } { int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName()); if (cmp != 0) { return (cmp); } } { int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFSecurityClusterByUDomainNameIdxKey) { CFSecurityClusterByUDomainNameIdxKey rhs = (CFSecurityClusterByUDomainNameIdxKey) obj; { int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFSecurityClusterByUDescrIdxKey) { CFSecurityClusterByUDescrIdxKey rhs = (CFSecurityClusterByUDescrIdxKey) obj; { int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription()); if (cmp != 0) { return (cmp); } } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null); } }
public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFSecurityClusterBuff) { CFSecurityClusterBuff rhs = (CFSecurityClusterBuff) obj; if (!getCreatedByUserId().equals(rhs.getCreatedByUserId())) { return (false); } if (!getCreatedAt().equals(rhs.getCreatedAt())) { return (false); } if (!getUpdatedByUserId().equals(rhs.getUpdatedByUserId())) { return (false); } if (!getUpdatedAt().equals(rhs.getUpdatedAt())) { return (false); } if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) { return (false); } if (!getRequiredDescription().equals(rhs.getRequiredDescription())) { return (false); } return (true); } else if (obj instanceof CFSecurityClusterPKey) { CFSecurityClusterPKey rhs = (CFSecurityClusterPKey) obj; if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else if (obj instanceof CFSecurityClusterHBuff) { CFSecurityClusterHBuff rhs = (CFSecurityClusterHBuff) obj; if (getRequiredId() != rhs.getRequiredId()) { return (false); } if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) { return (false); } if (!getRequiredDescription().equals(rhs.getRequiredDescription())) { return (false); } return (true); } else if (obj instanceof CFSecurityClusterHPKey) { CFSecurityClusterHPKey rhs = (CFSecurityClusterHPKey) obj; if (getRequiredId() != rhs.getRequiredId()) { return (false); } return (true); } else if (obj instanceof CFSecurityClusterByUDomainNameIdxKey) { CFSecurityClusterByUDomainNameIdxKey rhs = (CFSecurityClusterByUDomainNameIdxKey) obj; if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) { return (false); } return (true); } else if (obj instanceof CFSecurityClusterByUDescrIdxKey) { CFSecurityClusterByUDescrIdxKey rhs = (CFSecurityClusterByUDescrIdxKey) obj; if (!getRequiredDescription().equals(rhs.getRequiredDescription())) { return (false); } return (true); } else { boolean retval = super.equals(obj); return (retval); } }
public void updateCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateCluster", "Existing record not found", "Cluster", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateCluster", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityClusterByUDomainNameIdxKey existingKeyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); existingKeyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDomainNameIdxKey newKeyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); newKeyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFSecurityClusterByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Check unique indexes if (!existingKeyUDomainNameIdx.equals(newKeyUDomainNameIdx)) { if (dictByUDomainNameIdx.containsKey(newKeyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateCluster", "ClusterUDomainNameIdx", newKeyUDomainNameIdx); } } if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateCluster", "ClusterUDescrNameIdx", newKeyUDescrIdx); } } // Validate foreign keys // Update is valid Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.remove(existingKeyUDomainNameIdx); dictByUDomainNameIdx.put(newKeyUDomainNameIdx, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); }
public CFInternetClusterEditObj(ICFSecurityClusterObj argOrig) { orig = argOrig; getBuff(); CFSecurityClusterBuff origBuff = orig.getBuff(); buff.set(origBuff); }
public void updateCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "updateCluster"; String rqst = CFBamXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFBamXMsgClusterMessageFormatter.formatClusterRqstUpdate("\n\t\t\t", Buff) + "\n" + CFBamXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); try { schema.getCFTipClientHandler().issueAppRequest(rqst); } catch (BadPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught BadPaddingException - " + e.getMessage(), e); } catch (IllegalBlockSizeException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught IllegalBlockSizeException - " + e.getMessage(), e); } catch (InvalidKeyException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidKeyException - " + e.getMessage(), e); } catch (NoSuchAlgorithmException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchAlgorithmException - " + e.getMessage(), e); } catch (InvalidAlgorithmParameterException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidAlgorithmParameterException - " + e.getMessage(), e); } catch (NoSuchPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchPaddingException - " + e.getMessage(), e); } ICFTipResponseHandler responseHandler = schema.getCFTipClientHandler().getResponseHandler(); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } CFSecurityClusterBuff buff = null; Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFBamClusterObj realized = null; if (lastObjectProcessed instanceof ICFBamClusterObj) { realized = (ICFBamClusterObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFBamClusterObj"); } if (realized != null) { buff = realized.getClusterBuff(); } } if (buff != null) { Buff.set(buff); } }
public void copyOrigToBuff() { CFSecurityClusterBuff origBuff = getOrigAsCluster().getClusterBuff(); CFSecurityClusterBuff myBuff = getClusterBuff(); myBuff.set(origBuff); }
public void copyBuffToOrig() { CFSecurityClusterBuff origBuff = getOrigAsCluster().getClusterBuff(); CFSecurityClusterBuff myBuff = getClusterBuff(); origBuff.set(myBuff); }
public void copyBuffToPKey() { getPKey().setRequiredId(buff.getRequiredId()); }
public void copyPKeyToBuff() { buff.setRequiredId(getPKey().getRequiredId()); }