use of com.enonic.xp.content.ContentId in project xp by enonic.
the class RestoreContentHandler method executeRestore.
private List<String> executeRestore() {
final ContentId sourceId;
final ContentPath sourcePath;
if (this.content.startsWith("/")) {
// source is path
sourcePath = ContentPath.from(this.content);
final Content sourceContent = contentService.getByPath(sourcePath);
sourceId = sourceContent.getId();
} else {
// source is key
sourceId = ContentId.from(this.content);
}
final ContentPath pathToRestore = nullToEmpty(path).isBlank() ? null : ContentPath.from(path);
return restore(sourceId, pathToRestore);
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class HighlightMapper method serializeHighlight.
private static void serializeHighlight(final MapGenerator gen, final ImmutableMap<ContentId, HighlightedProperties> value) {
for (ContentId id : value.keySet()) {
gen.map(id.toString());
value.get(id).forEach(highlightedField -> {
gen.array(highlightedField.getName());
highlightedField.getFragments().forEach(gen::value);
gen.end();
});
gen.end();
}
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class GetAttachmentStreamHandlerTest method getById_notFound.
@Test
public void getById_notFound() throws Exception {
final ContentId id = ContentId.from("123456");
Mockito.when(this.contentService.getById(id)).thenThrow(new ContentNotFoundException(id, null));
runFunction("/test/GetAttachmentStreamHandlerTest.js", "getAttachmentStreamById_notFound");
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class GetAttachmentsHandlerTest method getById_notFound.
@Test
public void getById_notFound() throws Exception {
final ContentId id = ContentId.from("123456");
Mockito.when(this.contentService.getById(id)).thenThrow(new ContentNotFoundException(id, null));
runFunction("/test/GetAttachmentsHandlerTest.js", "getById_notFound");
}
use of com.enonic.xp.content.ContentId in project xp by enonic.
the class PublishContentResultMapper method serializeContentIds.
private void serializeContentIds(final MapGenerator gen, final String name, final ContentIds contents) {
gen.array(name);
for (ContentId id : contents) {
gen.value(id.toString());
}
gen.end();
}
Aggregations