use of com.enonic.xp.content.ContentId in project xp by enonic.
the class SyncContentServiceImplTest method testWorkflowInfo.
@Test
public void testWorkflowInfo() throws Exception {
final Content source = sourceContext.callWith(() -> createContent(ContentPath.ROOT));
syncCreated(source.getId());
targetContext.runWith(() -> {
contentService.update(new UpdateContentParams().contentId(source.getId()).editor(edit -> {
edit.workflowInfo = WorkflowInfo.ready();
edit.data = new PropertyTree();
}));
});
syncContentService.resetInheritance(ResetContentInheritParams.create().contentId(source.getId()).inherit(EnumSet.of(ContentInheritType.CONTENT)).projectName(targetProject.getName()).build());
targetContext.runWith(() -> {
final Content changed = contentService.getById(source.getId());
assertTrue(changed.getInherit().contains(ContentInheritType.CONTENT));
assertTrue(changed.getData().hasProperty("stringField"));
});
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class FragmentRenderer method getFragmentComponent.
private Component getFragmentComponent(final FragmentComponent component) {
final ContentId contentId = component.getFragment();
try {
final Content fragmentContent = contentService.getById(contentId);
if (!fragmentContent.hasPage() || !fragmentContent.getType().isFragment()) {
return null;
}
final Page page = fragmentContent.getPage();
return page.getFragment();
} catch (ContentNotFoundException e) {
return null;
}
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class ImageUrlBuilder method buildUrl.
@Override
protected void buildUrl(final StringBuilder url, final Multimap<String, String> params) {
super.buildUrl(url, params);
final ContentId id = resolveId();
final Media media = resolveMedia(id);
final String hash = resolveHash(media);
final String name = resolveName(media);
final String scale = resolveScale();
appendPart(url, id + ":" + hash);
appendPart(url, scale);
appendPart(url, name);
addParamIfNeeded(params, "quality", this.params.getQuality());
addParamIfNeeded(params, "background", this.params.getBackground());
addParamIfNeeded(params, "filter", this.params.getFilter());
}
Aggregations