Package uk.nhs.interoperability.payloads.metadata

Examples of uk.nhs.interoperability.payloads.metadata.Field


 
  public static void serialiseFieldsInPayload(XMLNamespaceContext namespaces, Payload p, Element parent, Document xmldoc) {
   
    Map<String, Field> fieldDefinitions = p.getFieldDefinitions();
    for (String fieldName : fieldDefinitions.keySet()) {
      Field field = fieldDefinitions.get(fieldName);
      FieldType fieldType = field.getTypeEnum();
      Logger.trace("===== Processing field: " + field.getName() + " - type specified as: " + fieldType.name() + " multiplicity = " + field.getMaxOccurs());

      FieldHandler handler = fieldType.getHandler();
     
      String xpath = field.getXpath();
      String strValue = null;
      Object fieldValue = p.getValue(field.getName());
     
      // First, see if the field should be included in the output
      boolean outputField = handler.outputField(field, p);
     
      if (outputField) {
        if (field.getMaxOccurs() > 1) {
          // We are expecting an ArrayList with one or more items
          ArrayList list = (ArrayList)fieldValue;
          if (list != null) {
            for (Object fieldListItem : list) {
             
View Full Code Here


    if (parent == null) {
      return;
    }
    Map<String, Field> fieldDefinitions = p.getFieldDefinitions();
    for (String fieldName : fieldDefinitions.keySet()) {
      Field field = fieldDefinitions.get(fieldName);
      FieldType fieldType = field.getTypeEnum();
      processField(namespaces, p, parent, xmldoc, name, field);
    }
  }
View Full Code Here

      if (o == null) {
        outputField = false;
        Logger.trace("  Excluding due to NULL in ifExists check - field: " + field.getIfExists());
      } else {
        // Now, check if this is an empty payload, which is equivalent to not existing..
        Field defn = p.getFieldDefinitions().get(fieldName);
        FieldHandler handler = defn.getHandler();
        if (handler.isPayload()) {
          boolean isBlank = true;
          if (defn.getMaxOccurs()>1) {
            for (Object fieldListItem : (ArrayList)o) {
              if (!handler.isItemBlank(defn, fieldListItem, true)) {
                isBlank = false;
              }
            }
          } else {
            isBlank = handler.isItemBlank(defn, o, false);
          }
          if (isBlank) {
            outputField = false;
            Logger.trace("  Excluding due to ifExists check - this is an empty child payload - field: " + field.getIfExists());
          }
        }
        Logger.trace("  NOT EXCLUDING - ifExists check - field: " + field.getIfExists());
      }
    }
   
    // See of there is an ifNotExists condition attached
    fieldName = field.getIfNotExists();
    if (fieldName != null) {
      // See whether the required field does exist - if it does, prevent this field being added
      Object o = p.getValue(fieldName);
      if (o != null) {
        // Now, check if this is an empty payload, which is equivalent to not existing..
        Field defn = p.getFieldDefinitions().get(fieldName);
        FieldHandler handler = defn.getHandler();
        if (handler.isPayload()) {
          boolean isBlank = handler.isItemBlank(defn, o, false);
          if (!isBlank) {
            outputField = false;
            Logger.trace("  Excluding due to ifNotExists check - this is a non-empty child payload - field: " + field.getIfExists());
View Full Code Here

  public boolean preProcessSerialise(XMLNamespaceContext namespaces, Object itemObject, String xpath, Element parent, Document xmldoc, Field field, Payload payload) {
    Code item = (Code)itemObject;
    Logger.trace("  Serialising FHIR coded item - code = " + item.getCode());
    boolean suppressCodeSystem = field.isSuppressCodeSystem();
    // First create the @code node: 
    Field stringValueField = new Field();
    stringValueField.setType("String");
    stringValueField.setName("Coded Item Value");
   
    PayloadSerialiser.createNode(namespaces, xpath + "/x:value/@value", parent, xmldoc, item.getCode(), new StringHandler(), stringValueField, payload);
    String displayName = item.getDisplayName();
    //String reference = item.getReference();
    if (displayName != null) {
View Full Code Here

  public boolean preProcessSerialise(XMLNamespaceContext namespaces, Object itemObject, String xpath, Element parent, Document xmldoc, Field field, Payload payload) {
    Code item = (Code)itemObject;
    Logger.trace("  Serialising coded item - code = " + item.getCode());
    boolean suppressCodeSystem = field.isSuppressCodeSystem();
    // First create the @code node: 
    Field stringValueField = new Field();
    stringValueField.setType("String");
    stringValueField.setName("Coded Item Value");
    PayloadSerialiser.createNode(namespaces, xpath + "/@code", parent, xmldoc, item.getCode(), new StringHandler(), stringValueField, payload);
    String displayName = item.getDisplayName();
    String reference = item.getReference();
    if (displayName != null) {
      PayloadSerialiser.createNode(namespaces, xpath + "/@displayName", parent, xmldoc, displayName, new StringHandler(), stringValueField, payload);
View Full Code Here

TOP

Related Classes of uk.nhs.interoperability.payloads.metadata.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.