/** * * @param properties * @return EntitySerializerPropertiesBuilder */ public static EntitySerializerPropertiesBuilder fromProperties (final EntitySerializerProperties properties) { final EntitySerializerPropertiesBuilder builder = EntitySerializerProperties.serviceRoot(properties.getServiceRoot()); return builder.fromProperties(properties); } }
/** * * @param properties * @return EntitySerializerPropertiesBuilder */ public static EntitySerializerPropertiesBuilder fromProperties (final EntitySerializerProperties properties) { final EntitySerializerPropertiesBuilder builder = EntitySerializerProperties.serviceRoot(properties.getServiceRoot()); return builder.fromProperties(properties); } }
private String createCustomTargetLink(final EntityInfoAggregator entityInfo, final String navigationPropertyName, final Map<String, Object> key) throws EntityProviderException, EdmException { String target; final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( entityInfo.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) entityInfo.getEntityType().getProperty(navigationPropertyName))); target = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + AtomEntryEntitySerializer.createSelfLink(targetEntityInfo, key, null, properties.isKeyAutoGenerated(), false); return target; }
try { writer.writeStartElement(FormatXml.ATOM_ID); String idlocation = properties.getServiceRoot().toASCIIString() + createSelfLink( eia, data, null, properties.isKeyAutoGenerated(), true);; writer.writeCharacters(idlocation);
if (properties.getServiceRoot() == null) { throw new EntityProviderProducerException(EntityProviderException.MANDATORY_WRITE_PROPERTY); writer.writeAttribute(Edm.PREFIX_XML, Edm.NAMESPACE_XML_1998, FormatXml.XML_BASE, properties.getServiceRoot() .toASCIIString());
private void appendInlineFeed(final XMLStreamWriter writer, final String navigationPropertyName, final EntityInfoAggregator eia, final Entity data) throws EntityProviderException, XMLStreamException, EdmException { if (eia.getNavigationPropertyNames().contains(navigationPropertyName) && data != null && data.getNavigations().containsKey(navigationPropertyName)) { EdmNavigationProperty navProp = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName); if (navProp == null) { throw new EntityProviderProducerException(EntityProviderException.EXPANDNOTSUPPORTED); } EntityCollection inlineData; inlineData = (EntityCollection) data.getNavigation(navigationPropertyName); if (inlineData == null) { inlineData = new EntityCollection(); } if (inlineData.getEntities().isEmpty()) { return; } writer.writeStartElement(Edm.NAMESPACE_M_2007_08, FormatXml.M_INLINE); EntityCollectionSerializerProperties inlineProperties = inlineData.getCollectionProperties() == null ? EntityCollectionSerializerProperties.serviceRoot(data.getWriteProperties().getServiceRoot()).build() : inlineData.getCollectionProperties(); EdmEntitySet inlineEntitySet = eia.getEntitySet().getRelatedEntitySet(navProp); AtomFeedSerializer inlineFeedProducer = new AtomFeedSerializer(inlineProperties); inlineData.setCollectionProperties(inlineProperties); EntityInfoAggregator inlineEia = EntityInfoAggregator.create(inlineEntitySet, null); inlineFeedProducer.append(writer, inlineEia, inlineData, true); writer.writeEndElement(); } }
private void writeMetadata(final EntityInfoAggregator entityInfo, final Map<String, Object> data, final EdmEntityType type) throws IOException, EntityProviderException, EdmException { if (properties.getServiceRoot() == null) { location = ""; idlocation = ""; } else { location = properties.getServiceRoot().toASCIIString() + AtomEntryEntitySerializer.createSelfLink(entityInfo, data, null, properties.isKeyAutoGenerated(), false); idlocation = properties.getServiceRoot().toASCIIString() + AtomEntryEntitySerializer.createSelfLink(entityInfo, data, null, properties.isKeyAutoGenerated(), true);
serviceRoot(properties.getServiceRoot()).build() : inlineData.getCollectionProperties(); JsonFeedEntitySerializer jsonFeedEntityProducer = new JsonFeedEntitySerializer(inlineProperties); final EntitySerializerProperties inlineProperties = inlineData.getWriteProperties() == null ? EntitySerializerProperties. serviceRoot(properties.getServiceRoot()).build() : inlineData.getWriteProperties(); final EntityInfoAggregator inlineEntityInfo = EntityInfoAggregator.create(inlineEntitySet, null);