Ejemplo n.º 1
0
 public GuideManager(Collection<GuideDTO> guideDTOs) {
   init();
   try {
     loadGuides(guideDTOs);
     _completeElementInstanceCollection = new GeneratedElementInstanceCollection();
     _completeElementInstanceCollection.merge(_elementInstanceCollectionByIdGuideMap.values());
     Logger.getLogger(GuideManager.class).debug(_completeElementInstanceCollection.toString());
   } catch (InternalErrorException e) {
     ExceptionHandler.handle(e);
   }
 }
Ejemplo n.º 2
0
  public boolean matches(DataValue dv, String guideId, GuideManager guideManager) {
    if (OperatorKind.IS_A.equals(operatorKind)) {
      if (dv instanceof DvCodedText && getDataValue() instanceof DvCodedText) {
        CodePhrase elementCodePhrase = ((DvCodedText) dv).getDefiningCode();
        CodePhrase predicateCodePhrase = ((DvCodedText) getDataValue()).getDefiningCode();
        Set<CodePhrase> codePhrases = new HashSet<CodePhrase>();
        if (guideManager != null) {
          Guide guide = guideManager.getGuide(guideId);
          if (guide != null) {
            if (guide.getOntology().getTermBindings() != null) {
              for (String terminologyId : guide.getOntology().getTermBindings().keySet()) {
                TermBinding termBinding = guide.getOntology().getTermBindings().get(terminologyId);
                if (termBinding != null) {
                  Binding binding =
                      termBinding.getBindings().get(predicateCodePhrase.getCodeString());
                  if (binding != null && binding.getCodes() != null) {
                    codePhrases.addAll(binding.getCodes());
                  }
                }
              }
            }
          }
        } else {
          codePhrases.add(predicateCodePhrase);
        }
        if (!codePhrases.isEmpty()) {
          try {
            return CDSTerminologyService.isSubclassOf(elementCodePhrase, codePhrases);
          } catch (Exception e) {
            ExceptionHandler.handle(e);
          }
        } else {
          return false;
        }
      }

    } else {
      if (dataValue != null) {
        return DVUtil.equalDVs(getDataValue(), dv);
      } else {
        if (dataValue == dv) {
          return true;
        }
      }
    }
    return false;
  }