use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_with_parent.
@Test
public void resolve_with_parent() throws Exception {
Content content1 = createContent(ContentPath.ROOT);
Content content2 = createContent(content1.getPath());
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.from(content1.getId(), content2.getId())).target(WS_OTHER).build());
assertEquals(content1.getId(), result.first());
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_hierarchy.
@Test
public void resolve_hierarchy() throws Exception {
Content content1 = createContent(ContentPath.ROOT);
Content content2 = createContent(content1.getPath());
Content content3 = createContent(content2.getPath());
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.from(content1.getId(), content2.getId(), content3.getId())).target(WS_OTHER).build());
assertTrue(result.getSize() == 2);
assertTrue(result.contains(content1.getId()));
assertTrue(result.contains(content2.getId()));
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class ContentServiceImplTest_resolveRequiredDependencies method resolve_empty.
@Test
public void resolve_empty() throws Exception {
content1 = createContent(ContentPath.ROOT);
content2 = createContent(content1.getPath());
content3 = createContent(content2.getPath());
refresh();
final ContentIds result = this.contentService.resolveRequiredDependencies(ResolveRequiredDependenciesParams.create().contentIds(ContentIds.empty()).target(WS_OTHER).build());
assertTrue(result.getSize() == 0);
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class UnpublishContentCommand method removePublishInfo.
private Void removePublishInfo(final ContentIds contentIds) {
final Instant now = Instant.now();
for (final ContentId contentId : contentIds) {
this.nodeService.update(UpdateNodeParams.create().editor(toBeEdited -> {
if (toBeEdited.data.getInstant(ContentPropertyNames.PUBLISH_INFO + PropertyPath.ELEMENT_DIVIDER + ContentPropertyNames.PUBLISH_FROM) != null) {
PropertySet publishInfo = toBeEdited.data.getSet(ContentPropertyNames.PUBLISH_INFO);
if (publishInfo.hasProperty(ContentPropertyNames.PUBLISH_FROM)) {
publishInfo.removeProperty(ContentPropertyNames.PUBLISH_FROM);
}
if (publishInfo.hasProperty(ContentPropertyNames.PUBLISH_TO)) {
publishInfo.removeProperty(ContentPropertyNames.PUBLISH_TO);
}
if (publishInfo.getInstant(ContentPropertyNames.PUBLISH_FIRST).compareTo(Instant.now()) > 0) {
publishInfo.removeProperty(ContentPropertyNames.PUBLISH_FIRST);
}
}
}).id(NodeId.from(contentId)).build());
commitUnpublishedNode(contentId);
}
return null;
}
use of com.enonic.xp.content.ContentIds in project xp by enonic.
the class ContentNodeHelperTest method toNodeIds.
@Test
public void toNodeIds() {
final ContentIds contentIds = ContentIds.from("e1f57280-d672-4cd8-b674-98e26e5b69ae", "45d67001-7f2b-4093-99ae-639be9fdd1f6");
final NodeIds nodeIds = ContentNodeHelper.toNodeIds(contentIds);
assertEquals(NodeIds.from("e1f57280-d672-4cd8-b674-98e26e5b69ae", "45d67001-7f2b-4093-99ae-639be9fdd1f6"), nodeIds);
}
Aggregations