Ejemplo n.º 1
0
 /**
  * Updates FilterRef 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 (!"FilterRef".equals(tagName)) {
     LOGGER.debug("Expecting node name of FilterRef got {}", tagName);
   }
   if (!element.hasAttribute("ID") && getID() == null) {
     // TODO: Should be its own exception
     throw new RuntimeException(String.format("FilterRef missing required ID property."));
   }
   if (element.hasAttribute("ID")) {
     // ID property
     setID(String.valueOf(element.getAttribute("ID")));
     // Adding this model object to the model handler
     model.addModelObject(getID(), this);
   }
 }
Ejemplo n.º 2
0
 /**
  * Updates Dichroic 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 (!"Dichroic".equals(tagName)) {
     LOGGER.debug("Expecting node name of Dichroic got {}", tagName);
   }
   if (!element.hasAttribute("ID") && getID() == null) {
     // TODO: Should be its own exception
     throw new RuntimeException(String.format("Dichroic missing required ID property."));
   }
   if (element.hasAttribute("ID")) {
     // ID property
     setID(String.valueOf(element.getAttribute("ID")));
     // Adding this model object to the model handler
     model.addModelObject(getID(), this);
   }
   // *** IGNORING *** Skipped back reference Instrument_BackReference
   // *** IGNORING *** Skipped back reference FilterSet_BackReference
   // *** IGNORING *** Skipped back reference LightPath_BackReference
 }
Ejemplo n.º 3
0
 /**
  * Updates Screen 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 (!"Screen".equals(tagName)) {
     LOGGER.debug("Expecting node name of Screen got {}", tagName);
   }
   if (element.hasAttribute("Name")) {
     // Attribute property Name
     setName(String.valueOf(element.getAttribute("Name")));
   }
   if (element.hasAttribute("ProtocolDescription")) {
     // Attribute property ProtocolDescription
     setProtocolDescription(String.valueOf(element.getAttribute("ProtocolDescription")));
   }
   if (element.hasAttribute("ProtocolIdentifier")) {
     // Attribute property ProtocolIdentifier
     setProtocolIdentifier(String.valueOf(element.getAttribute("ProtocolIdentifier")));
   }
   if (element.hasAttribute("ReagentSetDescription")) {
     // Attribute property ReagentSetDescription
     setReagentSetDescription(String.valueOf(element.getAttribute("ReagentSetDescription")));
   }
   if (element.hasAttribute("Type")) {
     // Attribute property Type
     setType(String.valueOf(element.getAttribute("Type")));
   }
   if (!element.hasAttribute("ID") && getID() == null) {
     // TODO: Should be its own exception
     throw new RuntimeException(String.format("Screen missing required ID property."));
   }
   if (element.hasAttribute("ID")) {
     // ID property
     setID(String.valueOf(element.getAttribute("ID")));
     // Adding this model object to the model handler
     model.addModelObject(getID(), this);
   }
   if (element.hasAttribute("ReagentSetIdentifier")) {
     // Attribute property ReagentSetIdentifier
     setReagentSetIdentifier(String.valueOf(element.getAttribute("ReagentSetIdentifier")));
   }
   List<Element> Description_nodeList = getChildrenByTagName(element, "Description");
   if (Description_nodeList.size() > 1) {
     // TODO: Should be its own Exception
     throw new RuntimeException(
         String.format("Description node list size %d != 1", Description_nodeList.size()));
   } else if (Description_nodeList.size() != 0) {
     // Element property Description which is not complex (has no
     // sub-elements)
     setDescription(String.valueOf(Description_nodeList.get(0).getTextContent()));
   }
   // Element property Reagent which is complex (has
   // sub-elements) and occurs more than once
   List<Element> Reagent_nodeList = getChildrenByTagName(element, "Reagent");
   for (Element Reagent_element : Reagent_nodeList) {
     addReagent(new Reagent(Reagent_element, model));
   }
   // Element reference PlateRef
   List<Element> PlateRef_nodeList = getChildrenByTagName(element, "PlateRef");
   for (Element PlateRef_element : PlateRef_nodeList) {
     PlateRef plateLinks_reference = new PlateRef();
     plateLinks_reference.setID(PlateRef_element.getAttribute("ID"));
     model.addReference(this, plateLinks_reference);
   }
   // Element reference AnnotationRef
   List<Element> AnnotationRef_nodeList = getChildrenByTagName(element, "AnnotationRef");
   for (Element AnnotationRef_element : AnnotationRef_nodeList) {
     AnnotationRef annotationLinks_reference = new AnnotationRef();
     annotationLinks_reference.setID(AnnotationRef_element.getAttribute("ID"));
     model.addReference(this, annotationLinks_reference);
   }
 }