/** * Generate metadata for Unit. * @param unit * A Unit (from the Ondex API). * @return JSONObject * JSONObject containing information about the Unit. */ private JSONObject buildUnit(Unit unit) { JSONObject unitJson= new JSONObject(); unitJson.put(JSONAttributeNames.ID, unit.getId()); unitJson.put(JSONAttributeNames.FULLNAME, unit.getFullname()); unitJson.put(JSONAttributeNames.DESCRIPTION, unit.getDescription()); return unitJson; }
/** * Generate metadata for Unit. * @param unit * A Unit (from the Ondex API). * @return JSONObject * JSONObject containing information about the Unit. */ private JSONObject buildUnit(Unit unit) { JSONObject unitJson= new JSONObject(); unitJson.put(JSONAttributeNames.ID, unit.getId()); unitJson.put(JSONAttributeNames.FULLNAME, unit.getFullname()); unitJson.put(JSONAttributeNames.DESCRIPTION, unit.getDescription()); return unitJson; }
/** * Builds the content of a unittype xml tag with the content of the Unit * object. * * @param xmlw * xml stream to write in * @param unit * a Unit object * @throws XMLStreamException * if xml writing fails */ private void buildUnitContent(XMLStreamWriter2 xmlw, Unit unit, RefOrVal rov) throws XMLStreamException { switch (rov) { case REF: buildIdRef(xmlw, unit); break; case VAL: xmlw.writeStartElement(XMLTagNames.ID); xmlw.writeCharacters(unit.getId()); xmlw.writeEndElement(); xmlw.writeStartElement(XMLTagNames.FULLNAME); xmlw.writeCharacters(unit.getFullname()); xmlw.writeEndElement(); xmlw.writeStartElement(XMLTagNames.DESCRIPTION); xmlw.writeCharacters(unit.getDescription()); xmlw.writeEndElement(); } }
nomd.createUnit(u.getId(), u.getFullname(), u.getDescription());