@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DateTime date = (DateTime) source; writer.startNode(E_DATE); writer.setValue(fmt.print(date)); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DateTime date = (DateTime) source; writer.startNode(E_DATE); writer.setValue(fmt.print(date)); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DateTime date = ((DateTime) source).toDateTime(DateTimeZone.UTC); writer.startNode(E_DATE); writer.setValue(fmt.print(date)); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DateTime date = ((DateTime) source).toDateTime(DateTimeZone.UTC); writer.startNode(E_DATE); writer.setValue(fmt.print(date)); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DateTimeInterval interval = (DateTimeInterval) source; if( interval.getStart() > -1){ writer.addAttribute(A_START, String.valueOf(interval.getStart())); } if( interval.getEnd() > -1){ writer.addAttribute(A_END, String.valueOf(interval.getEnd())); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); EventManager manager = (EventManager) source; for (DcsEvent event : manager.getEvents("", new String[]{})) { writer.startNode(EventConverter.E_EVENT); context.convertAnother(event); writer.endNode(); //End object entry node } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context){ super.marshal(source, writer, context); final Point point = (Point) source; writer.startNode(E_COORDINATE); writer.setValue(point.toString()); writer.endNode(); } @Override
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final Map<String, List<String>> disciplines = (Map<String, List<String>>) source; for (String disciplineGroup : disciplines.keySet()) { writer.startNode(E_DISCIPLINE_GROUP); writer.addAttribute(A_DISCIPLINE_GROUP_NAME, disciplineGroup); for (String discipline : disciplines.get(disciplineGroup)) { writer.startNode(E_DISCIPLINE); writer.setValue(discipline); writer.endNode(); } writer.endNode(); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); BusinessObjectManager manager = (BusinessObjectManager) source; Map<BusinessObject, String> boMap = manager.createMap(); if (boMap != null && !boMap.isEmpty()) { for (Entry<BusinessObject, String> objectEntry : boMap.entrySet()) { writer.startNode(E_BUSINESS_OBJECT_ENTRY); writer.addAttribute(A_BUSINESS_OBJECT_LOCAL_ID, objectEntry.getValue()); writer.addAttribute(A_BUSINESS_OBJECT_CLASS, manager.getType(objectEntry.getValue()).getName()); writer.startNode(E_BUSINESS_OBJECT); startObjectNode(writer, objectEntry.getKey()); context.convertAnother(objectEntry.getKey()); writer.endNode(); //End business object specific node writer.endNode(); //End business object node writer.endNode(); //End object entry node } } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context){ super.marshal(source, writer, context); Relation relation = (Relation) source; if( !isEmptyOrNull(relation.getObject())) { writer.addAttribute(A_OBJECT, relation.getObject()); } if( !isEmptyOrNull(relation.getPredicate().toString())){ writer.addAttribute(A_PREDICATE, relation.getPredicate().toString()); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); EventManager manager = (EventManager) source; for (DcsEvent event : manager.getEvents("", new String[]{})) { writer.startNode(EventConverter.E_EVENT); context.convertAnother(event); writer.endNode(); //End object entry node } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); BusinessObjectManager manager = (BusinessObjectManager) source; Map<BusinessObject, String> boMap = manager.createMap(); if (boMap != null && !boMap.isEmpty()) { for (Entry<BusinessObject, String> objectEntry : boMap.entrySet()) { writer.startNode(E_BUSINESS_OBJECT_ENTRY); writer.addAttribute(A_BUSINESS_OBJECT_LOCAL_ID, objectEntry.getValue()); writer.addAttribute(A_BUSINESS_OBJECT_CLASS, manager.getType(objectEntry.getValue()).getName()); writer.startNode(E_BUSINESS_OBJECT); startObjectNode(writer, objectEntry.getKey()); context.convertAnother(objectEntry.getKey()); writer.endNode(); //End business object specific node writer.endNode(); //End business object node writer.endNode(); //End object entry node } } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); IngestPhase phase = (IngestPhase) source; if (phase.getPhaseNumber() != null) { writer.startNode(E_PHASE_NUMBER); writer.setValue(String.valueOf(phase.getPhaseNumber())); writer.endNode(); } writer.startNode(E_HALT_INGEST); writer.setValue(String.valueOf(phase.getPauseIngest())); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); IngestPhase phase = (IngestPhase) source; if (phase.getPhaseNumber() != null) { writer.startNode(E_PHASE_NUMBER); writer.setValue(String.valueOf(phase.getPhaseNumber())); writer.endNode(); } writer.startNode(E_HALT_INGEST); writer.setValue(String.valueOf(phase.getPauseIngest())); writer.endNode(); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); // Inside <metadata> if (source instanceof DcsMetadata) { final DcsMetadata md = (DcsMetadata) source; final String schemaUri = md.getSchemaUri(); final String metadataBlob = md.getMetadata(); if (!isEmptyOrNull(metadataBlob)) { if (!isEmptyOrNull(schemaUri)) { writer.addAttribute(A_SCHEMA, schemaUri); } try { final DcsStaxWriter staxWriter = (DcsStaxWriter) writer.underlyingWriter(); log.trace("Copying metadata blob: \n{}", metadataBlob); staxWriter.copyNode(metadataBlob, staxWriter.getXMLStreamWriter()); } catch (XMLStreamException e) { throw new ConversionException(e.getMessage(), e); } } } else if (source instanceof DcsMetadataRef) { final DcsMetadataRef mdRef = (DcsMetadataRef) source; final String ref = mdRef.getRef(); if (!isEmptyOrNull(ref)) { writer.addAttribute(A_REF, ref); } } else { log.warn("Unable to marshal metadata source object {} of type {}", source, source.getClass().getName()); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); PackageDescription description = (PackageDescription) source; if (description.getRelationships() != null && !description.getRelationships().isEmpty()) { writer.startNode(E_RELATIONSHIPS); for (Triple relationship : description.getRelationships()) { writer.startNode(TripleConverter.E_TRIPLE); context.convertAnother(relationship); writer.endNode(); } writer.endNode(); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final Relationship relationship = (Relationship) source; if (!isEmptyOrNull(relationship.getSubject())) { writer.addAttribute(A_RELATIONSHIP_SUBJECT, relationship.getSubject()); } if (!isEmptyOrNull(relationship.getPredicate().toString())) { writer.addAttribute(A_RELATIONSHIP_PREDICATE, relationship.getPredicate().toString()); } if (!isEmptyOrNull(relationship.getObject())) { writer.addAttribute(A_RELATIONSHIP_OBJECT, relationship.getObject()); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final Relationship relationship = (Relationship) source; if (!isEmptyOrNull(relationship.getSubject())) { writer.addAttribute(A_RELATIONSHIP_SUBJECT, relationship.getSubject()); } if (!isEmptyOrNull(relationship.getPredicate().toString())) { writer.addAttribute(A_RELATIONSHIP_PREDICATE, relationship.getPredicate().toString()); } if (!isEmptyOrNull(relationship.getObject())) { writer.addAttribute(A_RELATIONSHIP_OBJECT, relationship.getObject()); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context){ super.marshal(source, writer, context); final GQMList gqmList = (GQMList) source; final List<GQM> gqms = gqmList.getGQMs(); writer.addAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); writer.addAttribute("xsi:schemaLocation", "http://dataconservancy.org/schemas/gqm/1.0"); if(!gqms.isEmpty()){ writer.startNode(E_GQMS); for(GQM gqm : gqms) { writer.startNode(GqmConverter.E_GQM); context.convertAnother(gqm); writer.endNode(); } writer.endNode(); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context){ super.marshal(source, writer, context); final Location location = (Location) source; if( location.getGeometry() != null){ writer.startNode(GeometryConverter.E_GEOMETRY); context.convertAnother(location.getGeometry()); writer.endNode(); } if( !isEmptyOrNull(location.getSrid().toString())){ writer.startNode(E_SRID); writer.setValue(location.getSrid().toString()); writer.endNode(); } } @Override