use of com.enonic.xp.schema.xdata.XDatas in project xp by enonic.
the class ImageContentProcessor method processCreate.
@Override
public ProcessCreateResult processCreate(final ProcessCreateParams params) {
final CreateContentParams createContentParams = params.getCreateContentParams();
final MediaInfo mediaInfo = params.getMediaInfo();
final CreateAttachments originalAttachments = createContentParams.getCreateAttachments();
Preconditions.checkArgument(originalAttachments.getSize() == 1, "Expected only one attachment");
final CreateAttachment sourceAttachment = originalAttachments.first();
final XDatas contentXDatas = getXDatas(createContentParams.getType());
ExtraDatas extraDatas = null;
if (mediaInfo != null) {
extraDatas = extractMetadata(mediaInfo, contentXDatas, sourceAttachment);
}
final CreateAttachments.Builder builder = CreateAttachments.create();
builder.add(sourceAttachment);
return new ProcessCreateResult(CreateContentParams.create(createContentParams).createAttachments(builder.build()).extraDatas(extraDatas).build());
}
use of com.enonic.xp.schema.xdata.XDatas in project xp by enonic.
the class XDataServiceImplTest method testSystemMixins.
@Test
public void testSystemMixins() {
XDatas xDatas = service.getAll();
assertNotNull(xDatas);
assertEquals(3, xDatas.getSize());
xDatas = service.getByApplication(ApplicationKey.MEDIA_MOD);
assertNotNull(xDatas);
assertEquals(2, xDatas.getSize());
XData xData = service.getByName(MediaInfo.GPS_INFO_METADATA_NAME);
assertNotNull(xData);
xData = service.getByName(MediaInfo.IMAGE_INFO_METADATA_NAME);
assertNotNull(xData);
xData = service.getByName(MediaInfo.CAMERA_INFO_METADATA_NAME);
assertNotNull(xData);
}
use of com.enonic.xp.schema.xdata.XDatas in project xp by enonic.
the class XDataServiceImplTest method testEmpty.
@Test
public void testEmpty() {
final XDatas types1 = this.service.getAll();
assertNotNull(types1);
assertEquals(3, types1.getSize());
final XDatas types2 = this.service.getByApplication(ApplicationKey.from("other"));
assertNotNull(types2);
assertEquals(0, types2.getSize());
final XData xData = service.getByName(XDataName.from("other:mytype"));
assertEquals(null, xData);
}
use of com.enonic.xp.schema.xdata.XDatas in project xp by enonic.
the class BuiltinXDataTypesTest method testGetAll.
@Test
public void testGetAll() {
final XDatas xdatas = new BuiltinXDataTypes().getAll();
assertEquals(3, xdatas.getSize());
assertSchema(xdatas.get(0), XDataName.from(ApplicationKey.MEDIA_MOD + ":imageInfo"), false);
assertSchema(xdatas.get(1), XDataName.from(ApplicationKey.MEDIA_MOD + ":cameraInfo"), false);
assertSchema(xdatas.get(2), XDataName.from(ApplicationKey.BASE + ":gpsInfo"), false);
}
use of com.enonic.xp.schema.xdata.XDatas in project xp by enonic.
the class BuiltinXDataTypesTest method getGetByApplication.
@Test
public void getGetByApplication() {
XDatas xdatas = new BuiltinXDataTypes().getByApplication(ApplicationKey.MEDIA_MOD);
assertEquals(2, xdatas.getSize());
assertSchema(xdatas.get(0), XDataName.from(ApplicationKey.MEDIA_MOD + ":imageInfo"), false);
assertSchema(xdatas.get(1), XDataName.from(ApplicationKey.MEDIA_MOD + ":cameraInfo"), false);
xdatas = new BuiltinXDataTypes().getByApplication(ApplicationKey.BASE);
assertEquals(1, xdatas.getSize());
assertSchema(xdatas.get(0), XDataName.from(ApplicationKey.BASE + ":gpsInfo"), false);
}
Aggregations