本文整理汇总了Java中org.apache.olingo.commons.api.data.Entity.setMediaContentType方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.setMediaContentType方法的具体用法?Java Entity.setMediaContentType怎么用?Java Entity.setMediaContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.data.Entity
的用法示例。
在下文中一共展示了Entity.setMediaContentType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createESMedia
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
private EntityCollection createESMedia(final Edm edm, final OData odata) {
EntityCollection entityCollection = new EntityCollection();
Entity entity =
new Entity().addProperty(createPrimitive("PropertyInt16", (short) 1)).addProperty(
createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"1\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(1)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity().addProperty(createPrimitive("PropertyInt16", (short) 2))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"2\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(2)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity().addProperty(createPrimitive("PropertyInt16", (short) 3))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"3\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(3)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity().addProperty(createPrimitive("PropertyInt16", (short) 4))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"4\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(4)/$value"));
entityCollection.getEntities().add(entity);
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETMedia));
createEntityId(edm, odata, "ESMedia", entityCollection);
return entityCollection;
}
示例2: createESMedia
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
private EntityCollection createESMedia(final Edm edm, final OData odata) {
EntityCollection entityCollection = new EntityCollection();
Entity entity = new Entity()
.addProperty(createPrimitive("PropertyInt16", (short) 1))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"1\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(1)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
.addProperty(createPrimitive("PropertyInt16", (short) 2))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"2\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(2)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
.addProperty(createPrimitive("PropertyInt16", (short) 3))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"3\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(3)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
.addProperty(createPrimitive("PropertyInt16", (short) 4))
.addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"4\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(4)/$value"));
entityCollection.getEntities().add(entity);
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETMedia));
createEntityId(edm, odata, "ESMedia", entityCollection);
createOperations("ESMedia", entityCollection, EntityTypeProvider.nameETMedia);
return entityCollection;
}
示例3: copyEntity
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
private Entity copyEntity(final Entity entity) {
final Entity newEntity = new Entity();
newEntity.setBaseURI(entity.getBaseURI());
newEntity.setEditLink(entity.getEditLink());
newEntity.setETag(entity.getETag());
newEntity.setId(entity.getId());
newEntity.setMediaContentSource(entity.getMediaContentSource());
newEntity.setMediaContentType(entity.getMediaContentType());
newEntity.setSelfLink(entity.getSelfLink());
newEntity.setMediaETag(entity.getMediaETag());
newEntity.setType(entity.getType());
newEntity.getProperties().addAll(entity.getProperties());
return newEntity;
}
示例4: setMedia
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
public void setMedia(final Entity entity, final byte[] media, final String type) {
entity.getProperties().remove(entity.getProperty(MEDIA_PROPERTY_NAME));
entity.addProperty(DataCreator.createPrimitive(MEDIA_PROPERTY_NAME, media));
entity.setMediaContentType(type);
entity.setMediaETag("W/\"" + UUID.randomUUID() + "\"");
}
示例5: getEntity
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
@Override
public Entity getEntity(final ClientEntity odataEntity) {
final Entity entity = new Entity();
entity.setType(odataEntity.getTypeName() == null ? null : odataEntity.getTypeName().toString());
// -------------------------------------------------------------
// Add edit and self link
// -------------------------------------------------------------
final URI odataEditLink = odataEntity.getEditLink();
if (odataEditLink != null) {
final Link editLink = new Link();
editLink.setTitle(entity.getType());
editLink.setHref(odataEditLink.toASCIIString());
editLink.setRel(Constants.EDIT_LINK_REL);
entity.setEditLink(editLink);
}
if (odataEntity.isReadOnly()) {
final Link selfLink = new Link();
selfLink.setTitle(entity.getType());
selfLink.setHref(odataEntity.getLink().toASCIIString());
selfLink.setRel(Constants.SELF_LINK_REL);
entity.setSelfLink(selfLink);
}
// -------------------------------------------------------------
links(odataEntity, entity);
// -------------------------------------------------------------
// Append edit-media links
// -------------------------------------------------------------
for (ClientLink link : odataEntity.getMediaEditLinks()) {
LOG.debug("Append edit-media link\n{}", link);
entity.getMediaEditLinks().add(getLink(link));
}
// -------------------------------------------------------------
if (odataEntity.isMediaEntity()) {
entity.setMediaContentSource(odataEntity.getMediaContentSource());
entity.setMediaContentType(odataEntity.getMediaContentType());
entity.setMediaETag(odataEntity.getMediaETag());
}
for (ClientProperty property : odataEntity.getProperties()) {
entity.getProperties().add(getProperty(property));
}
entity.setId(odataEntity.getId());
annotations(odataEntity, entity);
return entity;
}
示例6: updateMedia
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
public void updateMedia(final Entity entity, final String mediaContentType, final byte[] data) {
entity.getProperties().remove(entity.getProperty(MEDIA_PROPERTY_NAME));
entity.addProperty(new Property(null, MEDIA_PROPERTY_NAME, ValueType.PRIMITIVE, data));
entity.setMediaContentType(mediaContentType);
}