/** * persist: called by start to do all persisting work for this process. If this method throws an * exception, then the condition returned by the <code>getPersistFailureCondition()</code> is set. * Otherwise, the condition returned by <code>getPersistSuccessCondition()</code> is set. */ public void persist() throws Exception { resetResults(); TabInfoBean tib = null; if (getInfoObject("tib") == null) { tib = new TabInfoBean("cdebrowser_details_tabs"); } else { tib = (TabInfoBean) getInfoObject("tib"); } if (tib.getMainTabNum() != 6) { tib.setMainTabNum(6); } DataElement de = (DataElement) getInfoObject("de"); Map<Classification, List<Contact>> csContacts = null; Map<Concept, List<Contact>> conContacts = null; Map<ValueMeaning, List<Contact>> vmContacts = null; if (de != null) { Map<String, Object> varMap = new HashMap<String, Object>(); varMap.put(de.getIdseq(), DE_CON_VAR); if (de.getDataElementConcept() != null) { varMap.put(de.getDataElementConcept().getIdseq(), DEC_CON_VAR); ObjectClass oc = de.getDataElementConcept().getObjectClass(); Property prop = de.getDataElementConcept().getProperty(); if (oc != null) { varMap.put(oc.getIdseq(), OC_CON_VAR); addConceptsToMap(oc.getConceptDerivationRule(), varMap); } if (prop != null) { varMap.put(prop.getIdseq(), PROP_CON_VAR); addConceptsToMap(prop.getConceptDerivationRule(), varMap); } } if (de.getClassifications() != null) { for (Classification cs : (List<Classification>) de.getClassifications()) { varMap.put(cs.getCsIdseq(), cs); } } if (de.getConteIdseq() != null) { varMap.put(de.getConteIdseq(), CTX_CON_VAR); } if (de.getVdIdseq() != null) { varMap.put(de.getVdIdseq(), VD_CON_VAR); } if (de.getValueDomain() != null) { List vvs = de.getValueDomain().getValidValues(); if (vvs != null && !vvs.isEmpty()) { for (Object obj : vvs) { ValidValue vv = (ValidValue) obj; ValueMeaning vm = vv.getValueMeaning(); if (vm != null) { varMap.put(vm.getIdseq(), vm); } } } } if (de.getValueDomain().getRepresentation() != null) { varMap.put(de.getValueDomain().getRepresentation().getIdseq(), REP_CON_VAR); addConceptsToMap( de.getValueDomain().getRepresentation().getConceptDerivationRule(), varMap); } ServiceLocator locator = ServiceLocatorFactory.getLocator(CaDSRConstants.CDEBROWSER_SERVICE_LOCATOR_CLASSNAME); AbstractDAOFactory daoFactory = AbstractDAOFactory.getDAOFactory(locator); AdminComponentDAO adminDAO = daoFactory.getAdminComponentDAO(); Map<String, List<Contact>> contactsMap = adminDAO.getContacts(new ArrayList<String>(varMap.keySet())); if (contactsMap != null) { Iterator<String> iter = contactsMap.keySet().iterator(); while (iter.hasNext()) { String id = iter.next(); Object varType = varMap.get(id); if (varType instanceof String) { setResult((String) varType, contactsMap.get(id)); } else { if (varType instanceof Classification) { if (csContacts == null) { csContacts = new HashMap<Classification, List<Contact>>(); setResult(CS_CON_VAR, csContacts); } csContacts.put((Classification) varType, contactsMap.get(id)); } else if (varType instanceof Concept) { if (conContacts == null) { conContacts = new HashMap<Concept, List<Contact>>(); setResult(CON_CON_VAR, conContacts); } conContacts.put((Concept) varType, contactsMap.get(id)); } else if (varType instanceof ValueMeaning) { if (vmContacts == null) { vmContacts = new HashMap<ValueMeaning, List<Contact>>(); setResult(VM_CON_VAR, vmContacts); } vmContacts.put((ValueMeaning) varType, contactsMap.get(id)); } } } } } setResult("tib", tib); setCondition(SUCCESS); }
/** Custom Method: Valid Values */ public List getValidValues(Object aVdIdseq) throws Exception { NCIBC4JUtil bc4jUtil = new NCIBC4JUtil(); // Vector rows = new Vector(); List rows = null; try { ViewObject view = getValidValuesView(); ViewObjectImpl view1 = (ValidValuesViewImpl) bc4jUtil.cloneViewObject(view); view1.setWhereClause(" VD_IDSEQ = '" + aVdIdseq + "'"); view1.setOrderByClause(" display_order, UPPER(VALUE) "); // view1.setOrderByClause(" UPPER(VALUE) "); // view1.setForwardOnly(true); view1.executeQuery(); rows = new ArrayList(view1.getRowCount()); while (view1.hasNext()) { // rows.add(new ValidValuesValueObject((ValidValuesViewRowImpl) view1.next())); ValidValuesViewRowImpl vvImpl = (ValidValuesViewRowImpl) view1.next(); ValidValue vv = new ValidValueTransferObject(); vv.setVdIdseq(vvImpl.getVdIdseq().trim()); // for 4.0 ShortMeaning is replaced with Long Name and Description with PreferredDefinition vv.setDescription(vvImpl.getPreferredDefinition()); vv.setShortMeaning(vvImpl.getLongName()); vv.setShortMeaningDescription(vvImpl.getMeaningDescription()); vv.setShortMeaningValue(vvImpl.getValue()); vv.setVpIdseq(vvImpl.getVpIdseq().trim()); vv.setVmId(new Integer(vvImpl.getVmId().intValue())); vv.setVmVersion(new Float(vvImpl.getVersion().floatValue())); vv.setBeginDate( (vvImpl.getBeginDate() != null) ? ((Date) vvImpl.getBeginDate().dateValue()).toString() : ""); vv.setEndDate( (vvImpl.getEndDate() != null) ? ((Date) vvImpl.getEndDate().dateValue()).toString() : ""); vv.setContext(vvImpl.getName()); vv.setWorkflowstatus(vvImpl.getAslName()); String cdrIdseq = vvImpl.getCondrIdseq(); if (cdrIdseq != null) { ConceptDerivationRule rule = new ConceptDerivationRuleTransferObject(); rule.setIdseq(cdrIdseq.trim()); vv.setConceptDerivationRule(rule); } rows.add(vv); } } catch (Exception e) { throw e; } return rows; }