use of com.enonic.xp.node.Node in project xp by enonic.
the class ApplicationServiceImplTest method install_global_denied.
@Test
public void install_global_denied() throws Exception {
when(appFilterService.accept(any(ApplicationKey.class))).thenReturn(false);
final Node applicationNode = Node.create().id(NodeId.from("myNode")).parentPath(NodePath.ROOT).name("myNode").build();
final String bundleName = "my-bundle";
mockRepoCreateNode(applicationNode);
mockRepoGetNode(applicationNode, bundleName);
final ByteSource byteSource = createBundleSource(bundleName);
assertThrows(ApplicationInstallException.class, () -> this.service.installGlobalApplication(byteSource, bundleName));
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ApplicationServiceImplTest method install_local_invalid.
@Test
public void install_local_invalid() throws Exception {
final Node applicationNode = Node.create().id(NodeId.from("myNode")).parentPath(NodePath.ROOT).name("myNode").build();
final String bundleName = "my-bundle";
mockRepoCreateNode(applicationNode);
mockRepoGetNode(applicationNode, bundleName);
final ByteSource source = createBundleSource(bundleName, false);
assertThrows(ApplicationInstallException.class, () -> this.service.installLocalApplication(source, bundleName));
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class CreateAuditLogCommand method createNode.
private Node createNode() {
NodeId id = new NodeId();
CreateNodeParams createNodeParams = AuditLogSerializer.toCreateNodeParams(params).setNodeId(id).name(id.toString()).parent(NodePath.ROOT).childOrder(AuditLogConstants.AUDIT_LOG_REPO_DEFAULT_CHILD_ORDER).build();
Node node = nodeService.create(createNodeParams);
nodeService.refresh(RefreshMode.ALL);
return node;
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ArchiveContentCommand method doExecute.
private ArchiveContentsResult doExecute() {
validateLocation();
unpublish();
final Node nodeToArchive = updateProperties(NodeId.from(params.getContentId()));
rename(nodeToArchive);
move(nodeToArchive.id());
commitNode(nodeToArchive.id(), ContentConstants.ARCHIVE_COMMIT_PREFIX);
return ArchiveContentsResult.create().addArchived(params.getContentId()).build();
}
use of com.enonic.xp.node.Node in project xp by enonic.
the class ContentServiceImpl method setChildOrder.
@Override
public Content setChildOrder(final SetContentChildOrderParams params) {
try {
final SetNodeChildOrderParams.Builder builder = SetNodeChildOrderParams.create().nodeId(NodeId.from(params.getContentId())).childOrder(params.getChildOrder());
if (params.stopInherit()) {
builder.processor(new SetContentChildOrderProcessor());
}
final Node node = nodeService.setChildOrder(builder.build());
final Content content = translator.fromNode(node, true);
contentAuditLogSupport.setChildOrder(params, content);
return content;
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
Aggregations