public int compare(ICFBamUuidGenObj lhs, ICFBamUuidGenObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { String lhsValue = lhs.getObjQualifiedName(); String rhsValue = rhs.getObjQualifiedName(); if (lhsValue == null) { if (rhsValue == null) { return (0); } else { return (-1); } } else if (rhsValue == null) { return (1); } else { return (lhsValue.compareTo(rhsValue)); } } }
public Object getValueAt(int row, int column) { if ((row < 0) || (column < -1)) { return (null); } if (arrayOfUuidGen == null) { return (null); } int len = arrayOfUuidGen.length; if (row >= len) { return (null); } ICFBamUuidGenObj obj = arrayOfUuidGen[row]; if (obj == null) { return (null); } Object retval; switch (column) { case COLID_ROW_HEADER: retval = obj; break; case COLID_OBJQUALIFIEDNAME: retval = obj.getObjQualifiedName(); break; case COLID_ID: retval = new Long(obj.getRequiredId()); break; case COLID_NAME: retval = obj.getRequiredName(); if (retval == null) { retval = ""; } break; case COLID_SHORTNAME: retval = obj.getOptionalShortName(); if (retval == null) { retval = ""; } break; case COLID_LABEL: retval = obj.getOptionalLabel(); if (retval == null) { retval = ""; } break; case COLID_SHORTDESCRIPTION: retval = obj.getOptionalShortDescription(); if (retval == null) { retval = ""; } break; case COLID_DESCRIPTION: retval = obj.getOptionalDescription(); if (retval == null) { retval = ""; } break; case COLID_ISNULLABLE: retval = new Boolean(obj.getRequiredIsNullable()); break; case COLID_GENERATEID: retval = obj.getOptionalGenerateId(); break; case COLID_DEFAULTVISIBILITY: retval = new Boolean(obj.getRequiredDefaultVisibility()); break; case COLID_DBNAME: retval = obj.getOptionalDbName(); if (retval == null) { retval = ""; } break; case COLID_INITVALUE: retval = obj.getOptionalInitValue(); break; case COLID_DEFAULTVALUE: retval = obj.getOptionalDefaultValue(); break; case COLID_NULLVALUE: retval = obj.getOptionalNullValue(); break; case COLID_UNKNOWNVALUE: retval = obj.getOptionalUnknownValue(); break; case COLID_SLICE: retval = new Short(obj.getRequiredSlice()); break; case COLID_BLOCKSIZE: retval = new Integer(obj.getRequiredBlockSize()); break; case COLID_LOOKUP_DEFSCHEMA: retval = obj.getOptionalLookupDefSchema(); break; case COLID_LOOKUP_DATASCOPE: retval = obj.getOptionalLookupDataScope(); break; case COLID_LOOKUP_VACCSEC: retval = obj.getOptionalLookupVAccSec(); break; case COLID_LOOKUP_EACCSEC: retval = obj.getOptionalLookupEAccSec(); break; case COLID_LOOKUP_VACCFREQ: retval = obj.getOptionalLookupVAccFreq(); break; case COLID_LOOKUP_EACCFREQ: retval = obj.getOptionalLookupEAccFreq(); break; case COLID_LOOKUP_PREV: retval = obj.getOptionalLookupPrev(); break; case COLID_LOOKUP_NEXT: retval = obj.getOptionalLookupNext(); break; case COLID_LOOKUP_DISPENSER: retval = obj.getOptionalLookupDispenser(); break; default: retval = null; break; } return (retval); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstUuidGenMoveDown"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFBamValuePKey pkey = schemaObj.getBackingStore().getFactoryValue().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); pkey.setRequiredTenantId(natTenantId); long natId; natId = Long.parseLong(attrId); pkey.setRequiredId(natId); pkey.setRequiredId(natId); int natRevision = Integer.parseInt(attrRevision); // MoveDown the object ICFBamUuidGenObj read = schemaObj.getUuidGenTableObj().readUuidGen(pkey); if (read != null) { if (read.getUuidGenBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to move UuidGen down"); } else { ICFBamUuidGenObj moved = (ICFBamUuidGenObj) read.moveDown(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgUuidGenMessageFormatter.formatUuidGenRspnUpdated( "\n\t\t\t", moved.getUuidGenBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }