public CFInternetSwingServiceTypeViewEditJInternalFrame( ICFInternetSwingSchema argSchema, ICFSecurityServiceTypeObj argFocus) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; if ((argFocus != null) && (!argFocus.getIsNew())) { argFocus = (ICFInternetServiceTypeObj) argFocus.read(true); swingFocus = argFocus; } swingViewEditJPanel = argSchema.getServiceTypeFactory().newViewEditJPanel(argFocus); setContentPane(swingViewEditJPanel); Dimension dim = new Dimension(1024, 480); setSize(dim); dim = new Dimension(320, 240); setMinimumSize(dim); setTitle("View/Edit Service Type"); setJMenuBar(getFrameMenuBar()); setIconifiable(true); setMaximizable(true); setResizable(true); setClosable(false); }
public ICFSecurityServiceTypeObj readServiceTypeByUDescrIdx( String Description, boolean forceRead) { if (indexByUDescrIdx == null) { indexByUDescrIdx = new HashMap<CFSecurityServiceTypeByUDescrIdxKey, ICFSecurityServiceTypeObj>(); } CFSecurityServiceTypeByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); key.setRequiredDescription(Description); ICFSecurityServiceTypeObj obj = null; if ((!forceRead) && indexByUDescrIdx.containsKey(key)) { obj = indexByUDescrIdx.get(key); } else { CFSecurityServiceTypeBuff buff = ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .readDerivedByUDescrIdx(schema.getAuthorization(), Description); if (buff != null) { obj = schema.getServiceTypeTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey()); obj.setBuff(buff); obj = (ICFSecurityServiceTypeObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUDescrIdx.put(key, null); } } return (obj); }
public void deleteServiceTypeByIdIdx(int ServiceTypeId) { CFSecurityServiceTypePKey pkey = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey(); pkey.setRequiredServiceTypeId(ServiceTypeId); ICFSecurityServiceTypeObj obj = readServiceType(pkey); if (obj != null) { ICFSecurityServiceTypeEditObj editObj = (ICFSecurityServiceTypeEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFSecurityServiceTypeEditObj) obj.beginEdit(); if (editObj != null) { editStarted = true; } else { editStarted = false; } } else { editStarted = false; } if (editObj != null) { editObj.delete(); if (editStarted) { editObj.endEdit(); } } obj.forget(true); } }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFCrmSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFSecurityServiceTypeObj selectedInstance = getSwingFocusAsServiceType(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SVCT".equals(classCode)) { JInternalFrame frame = swingSchema.getServiceTypeFactory().newAskDeleteJInternalFrame(selectedInstance); ((ICFCrmSwingServiceTypeJPanelCommon) 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, "ICFCrmServiceTypeObj"); } } }
public void deleteServiceType(ICFSecurityServiceTypeObj Obj) { ICFSecurityServiceTypeObj obj = Obj; ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .deleteServiceType(schema.getAuthorization(), obj.getServiceTypeBuff()); obj.forget(true); }
public ICFSecurityServiceTypeObj updateServiceType(ICFSecurityServiceTypeObj Obj) { ICFSecurityServiceTypeObj obj = Obj; ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .updateServiceType(schema.getAuthorization(), Obj.getServiceTypeBuff()); obj = (ICFSecurityServiceTypeObj) Obj.realize(); return (obj); }
public ICFSecurityServiceTypeObj createServiceType(ICFSecurityServiceTypeObj Obj) { ICFSecurityServiceTypeObj obj = Obj; CFSecurityServiceTypeBuff buff = obj.getServiceTypeBuff(); ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .createServiceType(schema.getAuthorization(), buff); obj.copyBuffToPKey(); obj = obj.realize(); return (obj); }
public void forgetServiceTypeByIdIdx(int ServiceTypeId) { if (members == null) { return; } CFSecurityServiceTypePKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey(); key.setRequiredServiceTypeId(ServiceTypeId); if (members.containsKey(key)) { ICFSecurityServiceTypeObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void forgetServiceTypeByUDescrIdx(String Description) { if (indexByUDescrIdx == null) { return; } CFSecurityServiceTypeByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); key.setRequiredDescription(Description); if (indexByUDescrIdx.containsKey(key)) { ICFSecurityServiceTypeObj probed = indexByUDescrIdx.get(key); if (probed != null) { probed.forget(true); } indexByUDescrIdx.remove(key); } }
public void minimizeMemory() { allServiceType = null; indexByUDescrIdx = null; List<ICFSecurityServiceTypeObj> toForget = new LinkedList<ICFSecurityServiceTypeObj>(); ICFSecurityServiceTypeObj cur = null; Iterator<ICFSecurityServiceTypeObj> iter = members.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(); } }
public ICFSecurityServiceTypeObj lockServiceType(CFSecurityServiceTypePKey pkey) { ICFSecurityServiceTypeObj locked = null; CFSecurityServiceTypeBuff lockBuff = ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = schema.getServiceTypeTableObj().newInstance(); locked.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey()); locked.setBuff(lockBuff); locked = (ICFSecurityServiceTypeObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockServiceType", pkey); } return (locked); }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFSecurityServiceTypeObj focus = getSwingFocusAsServiceType(); if (focus != null) { ICFInternetServiceTypeEditObj editObj = (ICFInternetServiceTypeEditObj) (focus.getEdit()); if (editObj != null) { setPanelMode(CFJPanel.PanelMode.Update); } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot save on object that isn't being edited"); } } try { setClosed(true); } catch (Exception x) { } }
public CFSecurityServiceTypeBuff getBuff() { if (buff == null) { buff = ((ICFBamSchema) getOrigAsServiceType().getSchema().getBackingStore()) .getFactoryServiceType() .newBuff(); buff.set(orig.getBuff()); } return (buff); }
public void actionPerformed(ActionEvent e) { ICFSecurityServiceTypeObj focus = getSwingFocusAsServiceType(); if (focus != null) { ICFInternetServiceTypeEditObj editObj = (ICFInternetServiceTypeEditObj) focus.getEdit(); if (editObj != null) { if (editObj.getIsNew()) { editObj.endEdit(); setSwingFocus(null); setPanelMode(CFJPanel.PanelMode.Unknown); } else { editObj.endEdit(); setPanelMode(CFJPanel.PanelMode.View); } } } try { setClosed(true); } catch (Exception x) { } }
public void deleteServiceTypeByUDescrIdx(String Description) { if (indexByUDescrIdx == null) { indexByUDescrIdx = new HashMap<CFSecurityServiceTypeByUDescrIdxKey, ICFSecurityServiceTypeObj>(); } CFSecurityServiceTypeByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); key.setRequiredDescription(Description); ICFSecurityServiceTypeObj obj = null; if (indexByUDescrIdx.containsKey(key)) { obj = indexByUDescrIdx.get(key); ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .deleteServiceTypeByUDescrIdx(schema.getAuthorization(), Description); obj.forget(true); } else { ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .deleteServiceTypeByUDescrIdx(schema.getAuthorization(), Description); } }
public ICFSecurityServiceTypeObj readServiceType( CFSecurityServiceTypePKey pkey, boolean forceRead) { ICFSecurityServiceTypeObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityServiceTypeBuff readBuff = ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredServiceTypeId()); if (readBuff != null) { obj = schema.getServiceTypeTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityServiceTypeObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public void forgetServiceType(ICFSecurityServiceTypeObj Obj, boolean forgetSubObjects) { ICFSecurityServiceTypeObj obj = Obj; CFSecurityServiceTypePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityServiceTypeObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } if (allServiceType != null) { allServiceType.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getServiceTableObj() .forgetServiceByTypeIdx(keepObj.getRequiredServiceTypeId()); } } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { // Common XML Attributes String attrId = null; String attrRevision = null; // ServiceType Attributes String attrServiceTypeId = 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("ServiceType"); CFSecurityXMsgRspnHandler xmsgRspnHandler = (CFSecurityXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj 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("ServiceTypeId")) { if (attrServiceTypeId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrServiceTypeId = 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 ((attrServiceTypeId == null) || (attrServiceTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ServiceTypeId"); } if (attrDescription == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Description"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types int natServiceTypeId = Integer.parseInt(attrServiceTypeId); 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); } // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFSecurityServiceTypeObj obj = (ICFSecurityServiceTypeObj) (schemaObj.getServiceTypeTableObj().newInstance()); CFSecurityServiceTypeBuff dataBuff = obj.getServiceTypeBuff(); dataBuff.setRequiredServiceTypeId(natServiceTypeId); 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(); @SuppressWarnings("unchecked") List<ICFSecurityServiceTypeObj> list = (List<ICFSecurityServiceTypeObj>) xmsgRspnHandler.getListOfObjects(); ICFSecurityServiceTypeObj realized = (ICFSecurityServiceTypeObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (list != null) { list.add(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 CFBamServiceTypeEditObj(ICFSecurityServiceTypeObj argOrig) { orig = argOrig; getBuff(); CFSecurityServiceTypeBuff origBuff = orig.getBuff(); buff.set(origBuff); }
public void setIsNew(boolean value) { orig.setIsNew(value); }
public boolean getIsNew() { return (orig.getIsNew()); }
public void setPKey(CFSecurityServiceTypePKey value) { orig.setPKey(value); copyPKeyToBuff(); }
public CFSecurityServiceTypePKey getPKey() { return (orig.getPKey()); }
public ICFSecurityServiceTypeObj realizeServiceType(ICFSecurityServiceTypeObj Obj) { ICFSecurityServiceTypeObj obj = Obj; CFSecurityServiceTypePKey pkey = obj.getPKey(); ICFSecurityServiceTypeObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityServiceTypeObj existingObj = members.get(pkey); keepObj = existingObj; /* * We always rebind the data because if we're being called, some index has * been updated and is refreshing it's data, which may or may not have changed */ // Detach object from alternate and duplicate indexes, leave PKey alone if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } if (allServiceType != null) { allServiceType.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj.setIsNew(false); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allServiceType != null) { allServiceType.put(keepObj.getPKey(), keepObj); } if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } } return (keepObj); }
public ICFSecuritySchemaObj getSchema() { return (orig.getSchema()); }
public void endEdit() { orig.endEdit(); }
public ICFSecurityServiceTypeTableObj getServiceTypeTable() { return (orig.getSchema().getServiceTypeTableObj()); }
public List<ICFSecurityServiceTypeObj> readAllServiceType(boolean forceRead) { final String S_ProcName = "readAllServiceType"; if ((allServiceType == null) || forceRead) { Map<CFSecurityServiceTypePKey, ICFSecurityServiceTypeObj> map = new HashMap<CFSecurityServiceTypePKey, ICFSecurityServiceTypeObj>(); allServiceType = map; CFSecurityServiceTypeBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableServiceType() .readAllDerived(schema.getAuthorization()); CFSecurityServiceTypeBuff buff; ICFSecurityServiceTypeObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey()); obj.setBuff(buff); ICFSecurityServiceTypeObj realized = (ICFSecurityServiceTypeObj) obj.realize(); } } Comparator<ICFSecurityServiceTypeObj> cmp = new Comparator<ICFSecurityServiceTypeObj>() { public int compare(ICFSecurityServiceTypeObj lhs, ICFSecurityServiceTypeObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecurityServiceTypePKey lhsPKey = lhs.getPKey(); CFSecurityServiceTypePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allServiceType.size(); ICFSecurityServiceTypeObj arr[] = new ICFSecurityServiceTypeObj[len]; Iterator<ICFSecurityServiceTypeObj> valIter = allServiceType.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFSecurityServiceTypeObj> arrayList = new ArrayList<ICFSecurityServiceTypeObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecurityServiceTypeObj> sortedList = arrayList; return (sortedList); }