@Override public void setUnit(Unit unit) { String value = unit.getId(); MetaDataHelper.setString(sg, tableName, "unit", mid, value); }
/** * 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; }
createRow.setString(5, null); } else { createRow.setString(5, unit.getId());
/** * Creates a combo box displaying available units. * * @param select * Unit to be selected * @return JComboBox */ public JComboBox makeUnit(Unit select) { Vector<String> units = new Vector<String>(); units.add(""); units.add(Config.language.getProperty("Dialog.Attribute.CreateUnit")); Unit[] sorted = aog.getMetaData().getUnits().toArray(new Unit[0]); Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator()); for (Unit u : sorted) { units.add(u.getId()); } JComboBox unit = new JComboBox(units); unit.setActionCommand(UNIT); unit.addActionListener(this); if (select != null) unit.setSelectedItem(select.getId()); unit.setPreferredSize(new Dimension(this.getFieldWidth(), this.getFieldHeight())); unitBoxes.add(unit); return unit; }
dos.writeUTF(unit.getId()); else dos.writeUTF("");
@Override protected Unit storeUnit(Unit unit) { BerkeleyUnit bu = BerkeleyUnit.FACTORY.convert(unit); if (berkeley.existsInDatabase(Unit.class, unit.getId())) { berkeley.fireEventOccurred(new DuplicatedEntryEvent( Config.properties .getProperty("persistent.BerkeleyONDEXGraphMetaData.DuplicatedUnit") + unit.getId(), "[BerkeleyONDEXGraphMetaData - storeUnit]")); } else { berkeley.insertIntoDatabase(Unit.class, unit.getId(), bu.serialise()); } bu.setUpdateListener(this); return bu; }
.map ( aname -> aname.getId () + Optional.ofNullable ( aname.getUnit () ).map ( u -> u.getId () ).orElse ( "" ) + ObjectUtils.defaultIfNull ( aname.getDataTypeAsString (), "_" )
@Override public AttributeName createAttributeName(String id, String fullname, String description, Unit unit, Class<?> datatype, AttributeName specialisationOf) { try { String specialisationOfId = null; if (specialisationOf != null) specialisationOfId = specialisationOf.getId(); String unitId = null; if (unit != null) unitId = unit.getId(); soapGraph.createAttributeName(graphId, id, fullname, description, unitId, datatype.getName(), specialisationOfId); return new SOAPAttributeName(parent, id); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } return null; }
@Override public void setUnit(Unit unit) { try { JAXBElement<String> old = soapGraph.getAttributeName(graphId, id) .getUnit(); old.setValue(unit.getId()); soapGraph.getAttributeName(graphId, id).setUnit(old); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } }
/** * 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(); } }
} else if (o instanceof Unit) { Unit u = (Unit) o; myKey = berkeley.convert(u.getId()); } else if (o instanceof EvidenceType) { EvidenceType et = (EvidenceType) o;