public void setSwingFocus(ICFLibAnyObj value) { final String S_ProcName = "setSwingFocus"; if ((value == null) || (value instanceof ICFSecurityServiceTypeObj)) { super.setSwingFocus(value); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "value", value, "ICFSecurityServiceTypeObj"); } ((ICFInternetSwingServiceTypeJPanelCommon) swingViewEditJPanel).setSwingFocus(value); ICFInternetServiceTypeObj argFocus = (ICFInternetServiceTypeObj) value; if ((argFocus != null) && (!argFocus.getIsNew())) { argFocus = (ICFInternetServiceTypeObj) argFocus.read(true); super.setSwingFocus(argFocus); } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; // ServiceType Attributes String attrDescription = null; // ServiceType References // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ServiceType"); CFInternetSaxLoader saxLoader = (CFInternetSaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFInternetSchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate an edit buffer for the parsed information ICFInternetServiceTypeEditObj editBuff = (ICFInternetServiceTypeEditObj) schemaObj.getServiceTypeTableObj().newInstance().beginEdit(); // 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("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 (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); curContext.putNamedValue("Description", attrDescription); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. Integer natId; if ((attrId != null) && (attrId.length() > 0)) { natId = new Integer(Integer.parseInt(attrId)); } else { natId = null; } String natDescription = attrDescription; editBuff.setRequiredDescription(natDescription); // Get the scope/container object CFLibXmlCoreContext parentContext = curContext.getPrevContext(); Object scopeObj; if (parentContext != null) { scopeObj = parentContext.getNamedValue("Object"); } else { scopeObj = null; } CFInternetSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getServiceTypeLoaderBehaviour(); ICFInternetServiceTypeEditObj editServiceType = null; ICFInternetServiceTypeObj origServiceType = (ICFInternetServiceTypeObj) schemaObj .getServiceTypeTableObj() .readServiceTypeByUDescrIdx(editBuff.getRequiredDescription()); if (origServiceType == null) { editServiceType = editBuff; } else { switch (loaderBehaviour) { case Insert: break; case Update: editServiceType = (ICFInternetServiceTypeEditObj) origServiceType.beginEdit(); editServiceType.setRequiredDescription(editBuff.getRequiredDescription()); break; case Replace: editServiceType = (ICFInternetServiceTypeEditObj) origServiceType.beginEdit(); editServiceType.delete(); editServiceType.endEdit(); origServiceType = null; editServiceType = editBuff; break; } } if (editServiceType != null) { if (origServiceType != null) { editServiceType.update(); } else { origServiceType = (ICFInternetServiceTypeObj) editServiceType.create(); } editServiceType.endEdit(); } curContext.putNamedValue("Object", origServiceType); } 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); } }