예제 #1
0
  /**
   * Transforms a {@link Code} instance to a {@link EbXMLClassification}.
   *
   * @param code the code instance to transform. Can be <code>null</code>.
   * @param objectLibrary the object library.
   * @return the {@link EbXMLClassification}. <code>null</code> if the input was <code>null</code>.
   */
  public EbXMLClassification toEbXML(Code code, EbXMLObjectLibrary objectLibrary) {
    if (code == null) {
      return null;
    }

    EbXMLClassification classification = factory.createClassification(objectLibrary);
    classification.setNodeRepresentation(code.getCode());
    classification.setName(code.getDisplayName());

    if (code.getSchemeName() != null) {
      classification.addSlot(SLOT_NAME_CODING_SCHEME, code.getSchemeName());
    }

    return classification;
  }
예제 #2
0
  /**
   * Transforms a {@link EbXMLClassification} to a {@link Code} instance.
   *
   * @param classification {@link EbXMLClassification}. Can be <code>null</code>.
   * @return the code instance. <code>null</code> if the input was <code>null</code>.
   */
  public Code fromEbXML(EbXMLClassification classification) {
    if (classification == null) {
      return null;
    }

    Code code = new Code();
    code.setCode(classification.getNodeRepresentation());
    code.setDisplayName(classification.getName());

    List<String> slotValues = classification.getSlotValues(SLOT_NAME_CODING_SCHEME);
    if (slotValues.size() > 0) {
      code.setSchemeName(slotValues.get(0));
    }

    return code;
  }