public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFSecurityServiceBuff) { CFSecurityServiceBuff rhs = (CFSecurityServiceBuff) 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 (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredServiceId() < rhs.getRequiredServiceId()) { return (-1); } else if (getRequiredServiceId() > rhs.getRequiredServiceId()) { return (1); } if (getRequiredHostNodeId() < rhs.getRequiredHostNodeId()) { return (-1); } else if (getRequiredHostNodeId() > rhs.getRequiredHostNodeId()) { return (1); } if (getRequiredServiceTypeId() < rhs.getRequiredServiceTypeId()) { return (-1); } else if (getRequiredServiceTypeId() > rhs.getRequiredServiceTypeId()) { return (1); } if (getRequiredHostPort() < rhs.getRequiredHostPort()) { return (-1); } else if (getRequiredHostPort() > rhs.getRequiredHostPort()) { return (1); } return (0); } else if (obj instanceof CFSecurityServicePKey) { CFSecurityServicePKey rhs = (CFSecurityServicePKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredServiceId() < rhs.getRequiredServiceId()) { return (-1); } else if (getRequiredServiceId() > rhs.getRequiredServiceId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceHPKey) { CFSecurityServiceHPKey rhs = (CFSecurityServiceHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredServiceId() < rhs.getRequiredServiceId()) { return (-1); } else if (getRequiredServiceId() > rhs.getRequiredServiceId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceHBuff) { CFSecurityServiceHBuff rhs = (CFSecurityServiceHBuff) obj; int retval = 0; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredServiceId() < rhs.getRequiredServiceId()) { return (-1); } else if (getRequiredServiceId() > rhs.getRequiredServiceId()) { return (1); } if (getRequiredHostNodeId() < rhs.getRequiredHostNodeId()) { return (-1); } else if (getRequiredHostNodeId() > rhs.getRequiredHostNodeId()) { return (1); } if (getRequiredServiceTypeId() < rhs.getRequiredServiceTypeId()) { return (-1); } else if (getRequiredServiceTypeId() > rhs.getRequiredServiceTypeId()) { return (1); } if (getRequiredHostPort() < rhs.getRequiredHostPort()) { return (-1); } else if (getRequiredHostPort() > rhs.getRequiredHostPort()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceByClusterIdxKey) { CFSecurityServiceByClusterIdxKey rhs = (CFSecurityServiceByClusterIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceByHostIdxKey) { CFSecurityServiceByHostIdxKey rhs = (CFSecurityServiceByHostIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredHostNodeId() < rhs.getRequiredHostNodeId()) { return (-1); } else if (getRequiredHostNodeId() > rhs.getRequiredHostNodeId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceByTypeIdxKey) { CFSecurityServiceByTypeIdxKey rhs = (CFSecurityServiceByTypeIdxKey) obj; if (getRequiredServiceTypeId() < rhs.getRequiredServiceTypeId()) { return (-1); } else if (getRequiredServiceTypeId() > rhs.getRequiredServiceTypeId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceByUTypeIdxKey) { CFSecurityServiceByUTypeIdxKey rhs = (CFSecurityServiceByUTypeIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredHostNodeId() < rhs.getRequiredHostNodeId()) { return (-1); } else if (getRequiredHostNodeId() > rhs.getRequiredHostNodeId()) { return (1); } if (getRequiredServiceTypeId() < rhs.getRequiredServiceTypeId()) { return (-1); } else if (getRequiredServiceTypeId() > rhs.getRequiredServiceTypeId()) { return (1); } return (0); } else if (obj instanceof CFSecurityServiceByUHostPortIdxKey) { CFSecurityServiceByUHostPortIdxKey rhs = (CFSecurityServiceByUHostPortIdxKey) obj; if (getRequiredClusterId() < rhs.getRequiredClusterId()) { return (-1); } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) { return (1); } if (getRequiredHostNodeId() < rhs.getRequiredHostNodeId()) { return (-1); } else if (getRequiredHostNodeId() > rhs.getRequiredHostNodeId()) { return (1); } if (getRequiredHostPort() < rhs.getRequiredHostPort()) { return (-1); } else if (getRequiredHostPort() > rhs.getRequiredHostPort()) { return (1); } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFCrmXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrClusterId = null; String attrServiceId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstServiceDelete"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFCrmSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFSecurityServicePKey pkey = ((ICFCrmSchema) schemaObj.getBackingStore()).getFactoryService().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("ClusterId")) { if (attrClusterId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrClusterId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ServiceId")) { if (attrServiceId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrServiceId = 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 ((attrServiceId == null) || (attrServiceId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ServiceId"); } 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 natClusterId; natClusterId = Long.parseLong(attrClusterId); pkey.setRequiredClusterId(natClusterId); pkey.setRequiredClusterId(natClusterId); long natServiceId; natServiceId = Long.parseLong(attrServiceId); pkey.setRequiredServiceId(natServiceId); pkey.setRequiredServiceId(natServiceId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFCrmServiceObj read = ((ICFCrmServiceObj) schemaObj.getServiceTableObj().readService(pkey)); if (read != null) { if (read.getServiceBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete Service"); } else { ICFCrmServiceEditObj editBuff = (ICFCrmServiceEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgServiceMessageFormatter.formatServiceRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFSecurityServiceBuff) { CFSecurityServiceBuff rhs = (CFSecurityServiceBuff) 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 (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredServiceId() != rhs.getRequiredServiceId()) { return (false); } if (getRequiredHostNodeId() != rhs.getRequiredHostNodeId()) { return (false); } if (getRequiredServiceTypeId() != rhs.getRequiredServiceTypeId()) { return (false); } if (getRequiredHostPort() != rhs.getRequiredHostPort()) { return (false); } return (true); } else if (obj instanceof CFSecurityServicePKey) { CFSecurityServicePKey rhs = (CFSecurityServicePKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredServiceId() != rhs.getRequiredServiceId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceHBuff) { CFSecurityServiceHBuff rhs = (CFSecurityServiceHBuff) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredServiceId() != rhs.getRequiredServiceId()) { return (false); } if (getRequiredHostNodeId() != rhs.getRequiredHostNodeId()) { return (false); } if (getRequiredServiceTypeId() != rhs.getRequiredServiceTypeId()) { return (false); } if (getRequiredHostPort() != rhs.getRequiredHostPort()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceHPKey) { CFSecurityServiceHPKey rhs = (CFSecurityServiceHPKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredServiceId() != rhs.getRequiredServiceId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceByClusterIdxKey) { CFSecurityServiceByClusterIdxKey rhs = (CFSecurityServiceByClusterIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceByHostIdxKey) { CFSecurityServiceByHostIdxKey rhs = (CFSecurityServiceByHostIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredHostNodeId() != rhs.getRequiredHostNodeId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceByTypeIdxKey) { CFSecurityServiceByTypeIdxKey rhs = (CFSecurityServiceByTypeIdxKey) obj; if (getRequiredServiceTypeId() != rhs.getRequiredServiceTypeId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceByUTypeIdxKey) { CFSecurityServiceByUTypeIdxKey rhs = (CFSecurityServiceByUTypeIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredHostNodeId() != rhs.getRequiredHostNodeId()) { return (false); } if (getRequiredServiceTypeId() != rhs.getRequiredServiceTypeId()) { return (false); } return (true); } else if (obj instanceof CFSecurityServiceByUHostPortIdxKey) { CFSecurityServiceByUHostPortIdxKey rhs = (CFSecurityServiceByUHostPortIdxKey) obj; if (getRequiredClusterId() != rhs.getRequiredClusterId()) { return (false); } if (getRequiredHostNodeId() != rhs.getRequiredHostNodeId()) { return (false); } if (getRequiredHostPort() != rhs.getRequiredHostPort()) { return (false); } return (true); } else { boolean retval = super.equals(obj); return (retval); } }