public int compare(ICFSecurityISOTimezoneObj lhs, ICFSecurityISOTimezoneObj 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 void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFDbTestSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFSecurityISOTimezoneObj selectedInstance = getSwingFocusAsISOTimezone(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("ITZN".equals(classCode)) { JInternalFrame frame = swingSchema.getISOTimezoneFactory().newAskDeleteJInternalFrame(selectedInstance); ((ICFDbTestSwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); frame.addInternalFrameListener(getViewEditInternalFrameListener()); getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFDbTestISOTimezoneObj"); } } }
public Object getValueAt(int row, int column) { final String S_ProcName = "getValueAt"; if ((row < 0) || (column < -1)) { return (null); } if (arrayOfISOTimezone == null) { return (null); } int len = arrayOfISOTimezone.length; if (row >= len) { return (null); } ICFSecurityISOTimezoneObj obj = arrayOfISOTimezone[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_ISOTIMEZONEID: retval = new Short(obj.getRequiredISOTimezoneId()); break; case COLID_ISO8601: retval = obj.getRequiredIso8601(); if (retval == null) { retval = ""; } break; case COLID_TZNAME: retval = obj.getRequiredTZName(); if (retval == null) { retval = ""; } break; case COLID_TZHOUROFFSET: retval = new Short(obj.getRequiredTZHourOffset()); break; case COLID_TZMINOFFSET: retval = new Short(obj.getRequiredTZMinOffset()); break; case COLID_DESCRIPTION: retval = obj.getRequiredDescription(); if (retval == null) { retval = ""; } break; case COLID_VISIBLE: retval = new Boolean(obj.getRequiredVisible()); break; default: retval = null; break; } return (retval); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrTZHourOffset = null; String attrTZMinOffset = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOTimezoneReadByOffsetIdx"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj 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("TZHourOffset")) { if (attrTZHourOffset != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTZHourOffset = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TZMinOffset")) { if (attrTZMinOffset != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTZMinOffset = 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 ((attrTZHourOffset == null) || (attrTZHourOffset.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TZHourOffset"); } if ((attrTZMinOffset == null) || (attrTZMinOffset.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TZMinOffset"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natTZHourOffset; natTZHourOffset = Short.parseShort(attrTZHourOffset); short natTZMinOffset; natTZMinOffset = Short.parseShort(attrTZMinOffset); // Read the objects List<ICFSecurityISOTimezoneObj> list = schemaObj .getISOTimezoneTableObj() .readISOTimezoneByOffsetIdx(natTZHourOffset, natTZMinOffset); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgISOTimezoneMessageFormatter.formatISOTimezoneRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecurityISOTimezoneObj> iter = list.iterator(); ICFSecurityISOTimezoneObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAsteriskXMsgISOTimezoneMessageFormatter.formatISOTimezoneRspnDerivedRec( "\n\t\t", cur.getISOTimezoneBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAsteriskXMsgISOTimezoneMessageFormatter.formatISOTimezoneRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }