コード例 #1
0
  private static void buildBindNodes(Element modelElement) {
    // Create bind node for relative.
    Element bindNode = modelElement.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    bindNode.setName(XformBuilder.NODE_BIND);
    bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_ID, BIND_RELATIVE);
    bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_NODESET, "/form/patient/patient_relative");
    modelElement.addChild(Element.ELEMENT, bindNode);

    // Create bind node for person.
    bindNode = modelElement.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    bindNode.setName(XformBuilder.NODE_BIND);
    bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_ID, BIND_PERSON);
    bindNode.setAttribute(
        null,
        XformBuilder.ATTRIBUTE_NODESET,
        "/form/patient/patient_relative/patient_relative.person");
    modelElement.addChild(Element.ELEMENT, bindNode);

    // Create bind node for relationship.
    bindNode = modelElement.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    bindNode.setName(XformBuilder.NODE_BIND);
    bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_ID, BIND_RELATIONSHIP);
    bindNode.setAttribute(
        null,
        XformBuilder.ATTRIBUTE_NODESET,
        "/form/patient/patient_relative/patient_relative.relationship");
    modelElement.addChild(Element.ELEMENT, bindNode);
  }
コード例 #2
0
  private static void buildPersonInputNode(Element repeatNode) {
    // Create person input node.
    Element inputNode = repeatNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    inputNode.setName(XformBuilder.CONTROL_INPUT);
    inputNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, BIND_PERSON);
    repeatNode.addChild(Element.ELEMENT, inputNode);

    // Create person label.
    Element labelNode = repeatNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    labelNode.setName(XformBuilder.NODE_LABEL);
    labelNode.addChild(Element.TEXT, "RELATIVE");
    inputNode.addChild(Element.ELEMENT, labelNode);

    repeatNode.addChild(Element.ELEMENT, inputNode);
  }
コード例 #3
0
  private static void buildRelationshipInputNode(Element repeatNode) {
    // Create relationship input node.
    Element inputNode = repeatNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    inputNode.setName(XformBuilder.CONTROL_SELECT1);
    inputNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, BIND_RELATIONSHIP);

    populateRelationshipTypes(inputNode);

    repeatNode.addChild(Element.ELEMENT, inputNode);

    // Create relationship label.
    Element labelNode = repeatNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    labelNode.setName(XformBuilder.NODE_LABEL);
    labelNode.addChild(Element.TEXT, "RELATIONSHIP");
    inputNode.addChild(Element.ELEMENT, labelNode);

    repeatNode.addChild(Element.ELEMENT, inputNode);
  }
コード例 #4
0
 /**
  * Encode.
  *
  * @param method the method
  * @return the element
  */
 public final Element encode(final RPCMethod method) {
   GetRPCMethodsResponse grpc = (GetRPCMethodsResponse) method;
   Element result = new Element();
   result.setName("GetRPCMethodsResponse");
   result.setNamespace(Soap.getCWMPNameSpace());
   Element eMethodList = new Element();
   eMethodList.setName("MethodList");
   result.addChild(Element.ELEMENT, eMethodList);
   StringBuffer value = new StringBuffer("xsd:string[");
   value.append(grpc.getLsRPCMethods().size());
   value.append("]");
   eMethodList.setAttribute(Soap.getSoapEncNameSpace(), "arrayType", value.toString());
   for (String string : grpc.getLsRPCMethods()) {
     Element e = new Element();
     e.setName("string");
     e.addChild(Element.TEXT, string);
     eMethodList.addChild(Element.ELEMENT, e);
   }
   return result;
 }
コード例 #5
0
  /**
   * Creates a node for a select option for the specified relation type
   *
   * @param relationshipType the relationshipType object.
   * @param controlNode the select node
   * @param isA specifies which side of the relationship we are adding the option for
   * @return the Element for the select option
   */
  private static Element createRelationTypeOptionNode(
      RelationshipType relationshipType, Element controlNode, boolean isA) {
    Element itemNode = controlNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    itemNode.setName(XformBuilder.NODE_ITEM);

    Element node = itemNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    node.setName(XformBuilder.NODE_LABEL);
    node.addChild(
        Element.TEXT,
        "is "
            + ((isA) ? relationshipType.getaIsToB() : relationshipType.getbIsToA())
            + " ["
            + relationshipType.getRelationshipTypeId()
            + "]");
    itemNode.addChild(Element.ELEMENT, node);

    node = itemNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    node.setName(XformBuilder.NODE_VALUE);
    node.addChild(Element.TEXT, relationshipType.getRelationshipTypeId() + ((isA) ? "A" : "B"));
    itemNode.addChild(Element.ELEMENT, node);
    return itemNode;
  }
コード例 #6
0
  private static Element buildRepeatInputNode(Element bodyNode) {
    // Create the parent repeat ui node.
    Element groupNode = bodyNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    groupNode.setName(XformBuilder.NODE_GROUP);
    bodyNode.addChild(Element.ELEMENT, groupNode);

    Element labelNode = bodyNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    labelNode.setName(XformBuilder.NODE_LABEL);
    labelNode.addChild(Element.TEXT, "RELATIONSHIPS");
    groupNode.addChild(Element.ELEMENT, labelNode);

    Element hintNode = bodyNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    hintNode.setName(XformBuilder.NODE_HINT);
    hintNode.addChild(Element.TEXT, "Relationships that this patient has.");
    groupNode.addChild(Element.ELEMENT, hintNode);

    Element repeatNode = bodyNode.createElement(XformBuilder.NAMESPACE_XFORMS, null);
    repeatNode.setName(XformBuilder.CONTROL_REPEAT);
    repeatNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, BIND_RELATIVE);
    groupNode.addChild(Element.ELEMENT, repeatNode);

    return repeatNode;
  }