예제 #1
0
  private void fillAssociationTypeList() {
    // cbRelation
    logger.debug("fillAssociationTypeList()");

    ListConceptAssociationTypesResponse.Return response =
        WebServiceHelper.listConceptAssociationTypes(new ListConceptAssociationTypesRequestType());
    logger.debug("response: " + response.getReturnInfos().getMessage());

    if (response.getReturnInfos().getStatus() == Status.OK) {
      final Combobox cb = (Combobox) getFellow("cbRelation");

      cb.setItemRenderer(
          new ComboitemRenderer<CodeSystemEntity>() {
            public void render(Comboitem item, CodeSystemEntity cse, int i) throws Exception {
              item.setValue(cse);
              CodeSystemEntityVersion csev = cse.getCodeSystemEntityVersions().get(0);
              AssociationType assType = csev.getAssociationTypes().get(0);
              item.setLabel(assType.getForwardName() + " <-> " + assType.getReverseName());

              if (cb.getSelectedItem() == null) cb.setSelectedItem(item);
            }
          });

      ListModelList lml = new ListModelList<CodeSystemEntity>(response.getCodeSystemEntity());
      cb.setModel(lml);

      logger.debug("association count: " + lml.getSize());

      // if(lml.getSize() > 0)
      //  cb.setSelectedIndex(0);
    }
  }
예제 #2
0
  private boolean associationExists(CodeSystemEntityVersionAssociation cseva) {
    long csvId1 = cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId();
    ListConceptAssociationsRequestType request = new ListConceptAssociationsRequestType();
    request.setDirectionBoth(true);
    request.setCodeSystemEntity(new CodeSystemEntity());
    CodeSystemEntityVersion csev = new CodeSystemEntityVersion();
    csev.setVersionId(csvId1);
    request.getCodeSystemEntity().getCodeSystemEntityVersions().add(csev);

    ListConceptAssociationsResponse.Return response =
        WebServiceHelper.listConceptAssociations(request);
    if (response.getReturnInfos().getStatus()
        == de.fhdo.terminologie.ws.conceptassociation.Status.OK) {
      for (CodeSystemEntityVersionAssociation _cseva :
          response.getCodeSystemEntityVersionAssociation()) {
        long csvId2 = 0;

        if (_cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1() != null)
          csvId2 = _cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId();
        else if (_cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2() != null)
          csvId2 = _cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId();

        if (csvId2 > 0
            && csvId2
                == cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId()) {
          return true;
        }

        /*if((_cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId().longValue() ==
            cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId() &&
           _cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId().longValue() ==
            cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId()) ||
            (_cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId().longValue() ==
            cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId() &&
           _cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId1().getVersionId().longValue() ==
            cseva.getCodeSystemEntityVersionByCodeSystemEntityVersionId2().getVersionId()))
        {
          // exists
          return true;
        }*/
      }
    }

    return false;
  }