Esempio n. 1
0
  public boolean linkAnnotation(Annotation o) {

    o.linkScreen(this);
    if (!annotationLinks.contains(o)) {
      return annotationLinks.add(o);
    }
    return false;
  }
Esempio n. 2
0
 public boolean link(Reference reference, OMEModelObject o) {
   boolean wasHandledBySuperClass = super.link(reference, o);
   if (wasHandledBySuperClass) {
     return true;
   }
   if (reference instanceof PlateRef) {
     Plate o_casted = (Plate) o;
     o_casted.linkScreen(this);
     if (!plateLinks.contains(o_casted)) {
       plateLinks.add(o_casted);
     }
     return true;
   }
   if (reference instanceof AnnotationRef) {
     Annotation o_casted = (Annotation) o;
     o_casted.linkScreen(this);
     if (!annotationLinks.contains(o_casted)) {
       annotationLinks.add(o_casted);
     }
     return true;
   }
   LOGGER.debug("Unable to handle reference of type: {}", reference.getClass());
   return false;
 }
 /**
  * Updates DoubleAnnotation recursively from an XML DOM tree. <b>NOTE:</b> No properties are
  * removed, only added or updated.
  *
  * @param element Root of the XML DOM tree to construct a model object graph from.
  * @param model Handler for the OME model which keeps track of instances and references seen
  *     during object population.
  * @throws EnumerationException If there is an error instantiating an enumeration during model
  *     object creation.
  */
 public void update(Element element, OMEModel model) throws EnumerationException {
   super.update(element, model);
   String tagName = element.getTagName();
   if (!"DoubleAnnotation".equals(tagName)) {
     LOGGER.debug("Expecting node name of DoubleAnnotation got {}", tagName);
   }
   List<Element> Value_nodeList = getChildrenByTagName(element, "Value");
   if (Value_nodeList.size() > 1) {
     // TODO: Should be its own Exception
     throw new RuntimeException(
         String.format("Value node list size %d != 1", Value_nodeList.size()));
   } else if (Value_nodeList.size() != 0) {
     // Element property Value which is not complex (has no
     // sub-elements)
     setValue(Double.valueOf(Value_nodeList.get(0).getTextContent()));
   }
 }
Esempio n. 4
0
  protected Element asXMLElement(Document document, Element Screen_element) {
    // Creating XML block for Screen

    if (Screen_element == null) {
      Screen_element = document.createElementNS(NAMESPACE, "Screen");
    }

    if (name != null) {
      // Attribute property Name
      Screen_element.setAttribute("Name", name.toString());
    }
    if (protocolDescription != null) {
      // Attribute property ProtocolDescription
      Screen_element.setAttribute("ProtocolDescription", protocolDescription.toString());
    }
    if (protocolIdentifier != null) {
      // Attribute property ProtocolIdentifier
      Screen_element.setAttribute("ProtocolIdentifier", protocolIdentifier.toString());
    }
    if (reagentSetDescription != null) {
      // Attribute property ReagentSetDescription
      Screen_element.setAttribute("ReagentSetDescription", reagentSetDescription.toString());
    }
    if (type != null) {
      // Attribute property Type
      Screen_element.setAttribute("Type", type.toString());
    }
    if (id != null) {
      // Attribute property ID
      Screen_element.setAttribute("ID", id.toString());
    }
    if (reagentSetIdentifier != null) {
      // Attribute property ReagentSetIdentifier
      Screen_element.setAttribute("ReagentSetIdentifier", reagentSetIdentifier.toString());
    }
    if (description != null) {
      // Element property Description which is not complex (has no
      // sub-elements)
      Element description_element = document.createElementNS(NAMESPACE, "Description");
      description_element.setTextContent(description.toString());
      Screen_element.appendChild(description_element);
    }
    if (reagents != null) {
      // Element property Reagent which is complex (has
      // sub-elements) and occurs more than once
      for (Reagent reagents_value : reagents) {
        Screen_element.appendChild(reagents_value.asXMLElement(document));
      }
    }
    if (plateLinks != null) {
      // Reference property PlateRef which occurs more than once
      for (Plate plateLinks_value : plateLinks) {
        PlateRef o = new PlateRef();
        o.setID(plateLinks_value.getID());
        Screen_element.appendChild(o.asXMLElement(document));
      }
    }
    if (annotationLinks != null) {
      // Reference property AnnotationRef which occurs more than once
      for (Annotation annotationLinks_value : annotationLinks) {
        AnnotationRef o = new AnnotationRef();
        o.setID(annotationLinks_value.getID());
        Screen_element.appendChild(o.asXMLElement(document));
      }
    }
    return super.asXMLElement(document, Screen_element);
  }
Esempio n. 5
0
  public boolean unlinkAnnotation(Annotation o) {

    o.unlinkScreen(this);
    return annotationLinks.remove(o);
  }