public boolean equals(Object obj) { if (obj == null) { return (false); } else if (obj instanceof CFInternetMimeTypeHPKey) { CFInternetMimeTypeHPKey rhs = (CFInternetMimeTypeHPKey) obj; if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) { return (false); } return (true); } else if (obj instanceof CFInternetMimeTypePKey) { CFInternetMimeTypePKey rhs = (CFInternetMimeTypePKey) obj; if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) { return (false); } return (true); } else if (obj instanceof CFInternetMimeTypeHBuff) { CFInternetMimeTypeHBuff rhs = (CFInternetMimeTypeHBuff) obj; if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) { return (false); } return (true); } else if (obj instanceof CFInternetMimeTypeBuff) { CFInternetMimeTypeBuff rhs = (CFInternetMimeTypeBuff) obj; if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) { return (false); } return (true); } else { return (false); } }
public ICFSecuritySecUserObj getUpdatedBy() { if (updatedBy == null) { CFInternetMimeTypeBuff buff = getBuff(); updatedBy = ((ICFInternetSchemaObj) getSchema()) .getSecUserTableObj() .readSecUserByIdIdx(buff.getUpdatedByUserId()); } return (updatedBy); }
public static String formatMimeTypeRqstDelete(String separator, CFInternetMimeTypeBuff buff) { String retval = "<RqstMimeTypeDelete " + formatMimeTypePKeyAttributes(separator, buff) + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision()) + " />"; return (retval); }
public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFInternetMimeTypeHPKey) { CFInternetMimeTypeHPKey rhs = (CFInternetMimeTypeHPKey) obj; if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) { return (-1); } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) { return (1); } return (0); } else if (obj instanceof CFInternetMimeTypePKey) { CFInternetMimeTypePKey rhs = (CFInternetMimeTypePKey) obj; if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) { return (-1); } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) { return (1); } return (0); } else if (obj instanceof CFInternetMimeTypeBuff) { CFInternetMimeTypeBuff rhs = (CFInternetMimeTypeBuff) obj; if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) { return (-1); } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) { return (1); } return (0); } else if (obj instanceof CFInternetMimeTypeHBuff) { CFInternetMimeTypeHBuff rhs = (CFInternetMimeTypeHBuff) obj; if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) { return (-1); } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) { return (1); } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), "compareTo", "obj", obj, "CFInternetMimeTypePKey, CFInternetMimeTypeBuff"); } }
public CFInternetMimeTypeBuff getBuff() { if (buff == null) { buff = ((ICFInternetSchema) getOrigAsMimeType().getSchema().getBackingStore()) .getFactoryMimeType() .newBuff(); buff.set(orig.getBuff()); } return (buff); }
public static String formatMimeTypeBuffAttributes(String separator, CFInternetMimeTypeBuff buff) { String retval = CFFreeSwitchXMsgMimeTypeMessageFormatter.formatMimeTypePKeyAttributes(separator, buff) + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision()) + CFLibXmlUtil.formatOptionalUuid(separator, "CreatedBy", buff.getCreatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "CreatedAt", buff.getCreatedAt()) + CFLibXmlUtil.formatOptionalUuid(separator, "UpdatedBy", buff.getUpdatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "UpdatedAt", buff.getUpdatedAt()) + CFLibXmlUtil.formatRequiredXmlString(separator, "Name", buff.getRequiredName()) + CFLibXmlUtil.formatRequiredXmlString( separator, "FileTypes", buff.getRequiredFileTypes()); return (retval); }
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 { try { // Common XML Attributes String attrId = null; String attrRevision = null; // MimeType Attributes String attrMimeTypeId = null; String attrName = 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("RspnMimeTypeUpdated"); CFFreeSwitchXMsgRspnHandler xmsgRspnHandler = (CFFreeSwitchXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFFreeSwitchSchemaObj 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("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("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 ((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 (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 int natMimeTypeId = Integer.parseInt(attrMimeTypeId); String natName = attrName; 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 ICFFreeSwitchMimeTypeObj obj = (ICFFreeSwitchMimeTypeObj) schemaObj.getMimeTypeTableObj().newInstance(); CFInternetMimeTypeBuff dataBuff = obj.getMimeTypeBuff(); dataBuff.setRequiredMimeTypeId(natMimeTypeId); dataBuff.setRequiredName(natName); 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(); ICFFreeSwitchMimeTypeObj realized = (ICFFreeSwitchMimeTypeObj) 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 static String formatMimeTypePKeyAttributes(String separator, CFInternetMimeTypeBuff buff) { String retval = CFLibXmlUtil.formatRequiredInt32(separator, "MimeTypeId", buff.getRequiredMimeTypeId()); return (retval); }
public void copyOrigToBuff() { CFInternetMimeTypeBuff origBuff = getOrigAsMimeType().getMimeTypeBuff(); CFInternetMimeTypeBuff myBuff = getMimeTypeBuff(); myBuff.set(origBuff); }
public CFInternetMimeTypeEditObj(ICFInternetMimeTypeObj argOrig) { orig = argOrig; getBuff(); CFInternetMimeTypeBuff origBuff = orig.getBuff(); buff.set(origBuff); }
public void copyBuffToOrig() { CFInternetMimeTypeBuff origBuff = getOrigAsMimeType().getMimeTypeBuff(); CFInternetMimeTypeBuff myBuff = getMimeTypeBuff(); origBuff.set(myBuff); }
public void copyBuffToPKey() { getPKey().setRequiredMimeTypeId(buff.getRequiredMimeTypeId()); }
public void copyPKeyToBuff() { buff.setRequiredMimeTypeId(getPKey().getRequiredMimeTypeId()); }