public AssociationEditor() { if (SessionHelper.isUserLoggedIn() == false) ViewHelper.gotoMain(); // Executions. // TODO remove /*CodeSystem cs = new CodeSystem(); cs.setId(5l); cs.setCurrentVersionId(6l); cs.setName("authorSpeciality"); CodeSystemVersion csv = new CodeSystemVersion(); csv.setVersionId(6l); csv.setName("authorSpeciality"); cs.getCodeSystemVersions().add(csv); SessionHelper.setValue("selectedCS1", cs); cs = new CodeSystem(); cs.setId(6l); cs.setCurrentVersionId(7l); cs.setName("practiceSettingCode"); csv = new CodeSystemVersion(); csv.setVersionId(7l); csv.setName("practiceSettingCode"); cs.getCodeSystemVersions().add(csv); SessionHelper.setValue("selectedCS2", cs);*/ }
public void automaticAssociations() { logger.debug("automaticAssociations()"); if (Messagebox.show( Labels.getLabel("common.automaticMsg"), Labels.getLabel("common.automatic"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES) { final org.zkoss.zk.ui.Desktop desktop = Executions.getCurrent().getDesktop(); if (desktop.isServerPushEnabled() == false) desktop.enableServerPush(true); Clients.showBusy(Labels.getLabel("loginHelper.working")); final CodeSystem cs1 = (CodeSystem) SessionHelper.getValue("selectedCS1"); final CodeSystem cs2 = (CodeSystem) SessionHelper.getValue("selectedCS2"); // start timer to enable busy message Timer timer = new Timer(); timer.schedule( new TimerTask() { @Override public void run() { try { // List<CodeSystemEntityVersionAssociation> list = new // LinkedList<CodeSystemEntityVersionAssociation>(); logger.debug("cs1: " + cs1.getName()); logger.debug("cs2: " + cs2.getName()); long csvId1 = cs1.getCodeSystemVersions().get(0).getVersionId(); long csvId2 = cs2.getCodeSystemVersions().get(0).getVersionId(); logger.debug("csvId1: " + csvId1); logger.debug("csvId2: " + csvId2); // ListCodeSystemConceptsRequestType ListCodeSystemConceptsResponse.Return response1 = WebServiceHelper.listCodeSystemConcepts(csvId1); ListCodeSystemConceptsResponse.Return response2 = WebServiceHelper.listCodeSystemConcepts(csvId2); logger.debug("result 1: " + response1.getReturnInfos().getMessage()); logger.debug("result 2: " + response2.getReturnInfos().getMessage()); Executions.activate(desktop); if (response1.getReturnInfos().getStatus() == Status.OK && response2.getReturnInfos().getStatus() == Status.OK) { for (CodeSystemEntity cse1 : response1.getCodeSystemEntity()) { CodeSystemEntityVersion csev1 = cse1.getCodeSystemEntityVersions().get(0); CodeSystemConcept csc1 = csev1.getCodeSystemConcepts().get(0); for (CodeSystemEntity cse2 : response2.getCodeSystemEntity()) { CodeSystemEntityVersion csev2 = cse2.getCodeSystemEntityVersions().get(0); CodeSystemConcept csc2 = csev2.getCodeSystemConcepts().get(0); // check same code if (csc1.getCode().equals(csc2.getCode())) { // match addAutomaticMatch(csev1, csev2); } // check containing text if (csc1.getTerm().toLowerCase().contains(csc2.getTerm().toLowerCase())) { addAutomaticMatch(csev1, csev2); } if (csc2.getTerm().toLowerCase().contains(csc1.getTerm().toLowerCase())) { addAutomaticMatch(csev2, csev1); } } } } // read data of both codesystems /*Include incL = (Include) getFellow("incContentLeft"); ContentAssociationEditor contentEditor1 = (ContentAssociationEditor)incL.getDynamicProperty("instance"); Include incR = (Include) getFellow("incContentRight"); ContentAssociationEditor contentEditor2 = (ContentAssociationEditor)incL.getDynamicProperty("instance"); ContentConcepts content1 = contentEditor1.getContent(); ContentConcepts content2 = contentEditor2.getContent(); TreeModel model1 = content1.getConcepts().getTreeConcepts().getModel(); logger.debug("root: " + model1.getRoot().getClass().getCanonicalName());*/ // Executions.schedule(desktop, el, new Event("finish", null, "")); Clients.clearBusy(); Executions.deactivate(desktop); } catch (Exception ex) { LoggingOutput.outputException(ex, this); try { Executions.activate(desktop); Clients.clearBusy(); Messagebox.show(ex.getLocalizedMessage()); Executions.deactivate(desktop); } catch (Exception e) { } } } }, 10); } }