Exemplo n.º 1
0
  private static String compareElements(String path, Element e1, Element e2) {
    if (!e1.getNamespaceURI().equals(e2.getNamespaceURI()))
      return "Namespaces differ at "
          + path
          + ": "
          + e1.getNamespaceURI()
          + "/"
          + e2.getNamespaceURI();
    if (!e1.getLocalName().equals(e2.getLocalName()))
      return "Names differ at " + path + ": " + e1.getLocalName() + "/" + e2.getLocalName();
    path = path + "/" + e1.getLocalName();
    String s = compareAttributes(path, e1.getAttributes(), e2.getAttributes());
    if (!Utilities.noString(s)) return s;
    s = compareAttributes(path, e2.getAttributes(), e1.getAttributes());
    if (!Utilities.noString(s)) return s;

    Node c1 = e1.getFirstChild();
    Node c2 = e2.getFirstChild();
    c1 = skipBlankText(c1);
    c2 = skipBlankText(c2);
    while (c1 != null && c2 != null) {
      if (c1.getNodeType() != c2.getNodeType())
        return "node type mismatch in children of "
            + path
            + ": "
            + Integer.toString(e1.getNodeType())
            + "/"
            + Integer.toString(e2.getNodeType());
      if (c1.getNodeType() == Node.TEXT_NODE) {
        if (!normalise(c1.getTextContent()).equals(normalise(c2.getTextContent())))
          return "Text differs at "
              + path
              + ": "
              + normalise(c1.getTextContent())
              + "/"
              + normalise(c2.getTextContent());
      } else if (c1.getNodeType() == Node.ELEMENT_NODE) {
        s = compareElements(path, (Element) c1, (Element) c2);
        if (!Utilities.noString(s)) return s;
      }

      c1 = skipBlankText(c1.getNextSibling());
      c2 = skipBlankText(c2.getNextSibling());
    }
    if (c1 != null) return "node mismatch - more nodes in source in children of " + path;
    if (c2 != null) return "node mismatch - more nodes in target in children of " + path;
    return null;
  }
Exemplo n.º 2
0
 public static Operation fromCode(String name) {
   if (Utilities.noString(name)) return null;
   if (name.equals("=")) return Operation.Equals;
   if (name.equals("~")) return Operation.Equivalent;
   if (name.equals("!=")) return Operation.NotEquals;
   if (name.equals("!~")) return Operation.NotEquivalent;
   if (name.equals(">")) return Operation.Greater;
   if (name.equals("<")) return Operation.LessThen;
   if (name.equals(">=")) return Operation.GreaterOrEqual;
   if (name.equals("<=")) return Operation.LessOrEqual;
   if (name.equals("|")) return Operation.Union;
   if (name.equals("or")) return Operation.Or;
   if (name.equals("and")) return Operation.And;
   if (name.equals("xor")) return Operation.Xor;
   if (name.equals("is")) return Operation.Is;
   if (name.equals("as")) return Operation.As;
   if (name.equals("*")) return Operation.Times;
   if (name.equals("/")) return Operation.DivideBy;
   if (name.equals("+")) return Operation.Plus;
   if (name.equals("-")) return Operation.Minus;
   if (name.equals("&")) return Operation.Concatenate;
   if (name.equals("implies")) return Operation.Implies;
   if (name.equals("div")) return Operation.Div;
   if (name.equals("mod")) return Operation.Mod;
   if (name.equals("in")) return Operation.In;
   if (name.equals("contains")) return Operation.Contains;
   return null;
 }
  public void compose(IXMLWriter writer, AtomFeed feed, boolean htmlPretty) throws Exception {
    this.htmlPretty = htmlPretty;
    xml = writer;
    xml.setDefaultNamespace(ATOM_NS);

    xml.open(ATOM_NS, "feed");
    if (feed.getTitle() != null) xml.element(ATOM_NS, "title", feed.getTitle());
    if (feed.getId() != null) xml.element(ATOM_NS, "id", feed.getId());
    for (String n : feed.getLinks().keySet()) {
      xml.attribute("href", feed.getLinks().get(n));
      xml.attribute("rel", n);
      xml.element(ATOM_NS, "link", null);
    }
    if (feed.getTotalResults() != null) {
      xml.setDefaultNamespace("http://purl.org/atompub/tombstones/1.0");
      xml.element("totalResults", feed.getTotalResults().toString());
      xml.setDefaultNamespace(ATOM_NS);
    }
    if (feed.getUpdated() != null) xml.element(ATOM_NS, "updated", feed.getUpdated().toString());
    if (feed.getAuthorName() != null || feed.getAuthorUri() != null) {
      xml.open(ATOM_NS, "author");
      if (feed.getAuthorName() != null) xml.element(ATOM_NS, "name", feed.getAuthorName());
      if (feed.getAuthorUri() != null) xml.element(ATOM_NS, "uri", feed.getAuthorUri());
      xml.close(ATOM_NS, "author");
    }
    for (AtomCategory cat : feed.getTags()) {
      xml.attribute("scheme", cat.getScheme());
      xml.attribute("term", cat.getTerm());
      if (!Utilities.noString(cat.getLabel())) xml.attribute("label", cat.getLabel());
      xml.element("category", null);
    }

    for (AtomEntry<? extends Resource> e : feed.getEntryList()) composeEntry(e);
    xml.close(ATOM_NS, "feed");
  }
Exemplo n.º 4
0
 /**
  * @param value A representation of the meaning of the code in the system, following the rules of
  *     the system.
  */
 public Coding setDisplay(String value) {
   if (Utilities.noString(value)) this.display = null;
   else {
     if (this.display == null) this.display = new StringType();
     this.display.setValue(value);
   }
   return this;
 }
Exemplo n.º 5
0
 /**
  * @param value This will either be a name or a description. E.g. "Aunt Susan", "my cousin with
  *     the red hair".
  */
 public FamilyMemberHistory setName(String value) {
   if (Utilities.noString(value)) this.name = null;
   else {
     if (this.name == null) this.name = new StringType();
     this.name.setValue(value);
   }
   return this;
 }
Exemplo n.º 6
0
 /** @param value A computer processable form of the unit in some unit representation system. */
 public Quantity setCode(String value) {
   if (Utilities.noString(value)) this.code = null;
   else {
     if (this.code == null) this.code = new CodeType();
     this.code.setValue(value);
   }
   return this;
 }
Exemplo n.º 7
0
 /** @param value A human-readable form of the unit. */
 public Quantity setUnit(String value) {
   if (Utilities.noString(value)) this.unit = null;
   else {
     if (this.unit == null) this.unit = new StringType();
     this.unit.setValue(value);
   }
   return this;
 }
Exemplo n.º 8
0
 /**
  * @param value A description of the substance - its appearance, handling requirements, and other
  *     usage notes.
  */
 public Substance setDescription(String value) {
   if (Utilities.noString(value)) this.description = null;
   else {
     if (this.description == null) this.description = new StringType();
     this.description.setValue(value);
   }
   return this;
 }
Exemplo n.º 9
0
 /** @param value Any comments related to the goal. */
 public Goal setNotes(String value) {
   if (Utilities.noString(value)) this.notes = null;
   else {
     if (this.notes == null) this.notes = new StringType();
     this.notes.setValue(value);
   }
   return this;
 }
Exemplo n.º 10
0
 /**
  * @param value Identifies a sub-style or sub-collective of coverage issues by the underwriter,
  *     for example may be used to identify a specific employer group within a class of employers.
  *     May be referred to as a Section or Division ID.
  */
 public Coverage setSubPlan(String value) {
   if (Utilities.noString(value)) this.subPlan = null;
   else {
     if (this.subPlan == null) this.subPlan = new StringType();
     this.subPlan.setValue(value);
   }
   return this;
 }
 /**
  * @param value The actual contact point details, in a form that is meaningful to the designated
  *     communication system (i.e. phone number or email address).
  */
 public ContactPoint setValue(String value) {
   if (Utilities.noString(value)) this.value = null;
   else {
     if (this.value == null) this.value = new StringType();
     this.value.setValue(value);
   }
   return this;
 }
Exemplo n.º 12
0
 /**
  * @param value The version specific identifier, as it appears in the version portion of the URL.
  *     This values changes when the resource is created, updated, or deleted.
  */
 public Meta setVersionId(String value) {
   if (Utilities.noString(value)) this.versionId = null;
   else {
     if (this.versionId == null) this.versionId = new IdType();
     this.versionId.setValue(value);
   }
   return this;
 }
Exemplo n.º 13
0
 /**
  * @param value The name of the device / manufacturer of the device that was used to make the
  *     recording.
  */
 public Media setDeviceName(String value) {
   if (Utilities.noString(value)) this.deviceName = null;
   else {
     if (this.deviceName == null) this.deviceName = new StringType();
     this.deviceName.setValue(value);
   }
   return this;
 }
Exemplo n.º 14
0
 /** @param value Country - a nation as commonly understood or generally accepted. */
 public Address setCountry(String value) {
   if (Utilities.noString(value)) this.country = null;
   else {
     if (this.country == null) this.country = new StringType();
     this.country.setValue(value);
   }
   return this;
 }
Exemplo n.º 15
0
 /** @param value A postal code designating a region defined by the postal service. */
 public Address setPostalCode(String value) {
   if (Utilities.noString(value)) this.postalCode = null;
   else {
     if (this.postalCode == null) this.postalCode = new StringType();
     this.postalCode.setValue(value);
   }
   return this;
 }
Exemplo n.º 16
0
 /** @param value A full text representation of the address. */
 public Address setText(String value) {
   if (Utilities.noString(value)) this.text = null;
   else {
     if (this.text == null) this.text = new StringType();
     this.text.setValue(value);
   }
   return this;
 }
Exemplo n.º 17
0
 /**
  * @param value Identifies a style or collective of coverage issues by the underwriter, for
  *     example may be used to identify a class of coverage or employer group. May also be referred
  *     to as a Policy or Group ID.
  */
 public Coverage setGroup(String value) {
   if (Utilities.noString(value)) this.group = null;
   else {
     if (this.group == null) this.group = new StringType();
     this.group.setValue(value);
   }
   return this;
 }
Exemplo n.º 18
0
 /**
  * @param value Identifies the type of the data in the attachment and allows a method to be chosen
  *     to interpret or render the data. Includes mime type parameters such as charset where
  *     appropriate.
  */
 public Attachment setContentType(String value) {
   if (Utilities.noString(value)) this.contentType = null;
   else {
     if (this.contentType == null) this.contentType = new CodeType();
     this.contentType.setValue(value);
   }
   return this;
 }
Exemplo n.º 19
0
 /**
  * @param value Additional diagnostic information about the issue. Typically, this may be a
  *     description of how a value is erroneous, or a stck dump to help trace the issue.
  */
 public OperationOutcomeIssueComponent setDetails(String value) {
   if (Utilities.noString(value)) this.details = null;
   else {
     if (this.details == null) this.details = new StringType();
     this.details.setValue(value);
   }
   return this;
 }
Exemplo n.º 20
0
 /**
  * @param value The human language of the content. The value can be any valid value according to
  *     BCP 47.
  */
 public Attachment setLanguage(String value) {
   if (Utilities.noString(value)) this.language = null;
   else {
     if (this.language == null) this.language = new CodeType();
     this.language.setValue(value);
   }
   return this;
 }
Exemplo n.º 21
0
 /** @param value An alternative location where the data can be accessed. */
 public Attachment setUrl(String value) {
   if (Utilities.noString(value)) this.url = null;
   else {
     if (this.url == null) this.url = new UriType();
     this.url.setValue(value);
   }
   return this;
 }
Exemplo n.º 22
0
 /** @param value A label or set of text to display in place of the data. */
 public Attachment setTitle(String value) {
   if (Utilities.noString(value)) this.title = null;
   else {
     if (this.title == null) this.title = new StringType();
     this.title.setValue(value);
   }
   return this;
 }
Exemplo n.º 23
0
 /** @param value A reference to supply which authenticates the process. */
 public ProcessRequest setReference(String value) {
   if (Utilities.noString(value)) this.reference = null;
   else {
     if (this.reference == null) this.reference = new StringType();
     this.reference.setValue(value);
   }
   return this;
 }
Exemplo n.º 24
0
 /** @param value The note text. */
 public ProcessResponseNotesComponent setText(String value) {
   if (Utilities.noString(value)) this.text = null;
   else {
     if (this.text == null) this.text = new StringType();
     this.text.setValue(value);
   }
   return this;
 }
Exemplo n.º 25
0
 /** @param value The identification of the system that provides the coded form of the unit. */
 public Quantity setSystem(String value) {
   if (Utilities.noString(value)) this.system = null;
   else {
     if (this.system == null) this.system = new UriType();
     this.system.setValue(value);
   }
   return this;
 }
Exemplo n.º 26
0
 /** @param value Name of the care team. */
 public CareTeam setName(String value) {
   if (Utilities.noString(value)) this.name = null;
   else {
     if (this.name == null) this.name = new StringType();
     this.name.setValue(value);
   }
   return this;
 }
Exemplo n.º 27
0
 /** @param value An area where general notes can be placed about this specific condition. */
 public FamilyMemberHistoryConditionComponent setNote(String value) {
   if (Utilities.noString(value)) this.note = null;
   else {
     if (this.note == null) this.note = new StringType();
     this.note.setValue(value);
   }
   return this;
 }
Exemplo n.º 28
0
 /** @param value A description of the status of the adjudication. */
 public EnrollmentResponse setDisposition(String value) {
   if (Utilities.noString(value)) this.disposition = null;
   else {
     if (this.disposition == null) this.disposition = new StringType();
     this.disposition.setValue(value);
   }
   return this;
 }
 /** @param value unique id for the element within a resource (for internal references). */
 public Element setId(String value) {
   if (Utilities.noString(value)) this.id = null;
   else {
     if (this.id == null) this.id = new IdType();
     this.id.setValue(value);
   }
   return this;
 }
Exemplo n.º 30
0
 /**
  * @param value The version of the code system which was used when choosing this code. Note that a
  *     well-maintained code system does not need the version reported, because the meaning of
  *     codes is consistent across versions. However this cannot consistently be assured. and when
  *     the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
  */
 public Coding setVersion(String value) {
   if (Utilities.noString(value)) this.version = null;
   else {
     if (this.version == null) this.version = new StringType();
     this.version.setValue(value);
   }
   return this;
 }