use of com.enonic.xp.content.ContentAccessException in project xp by enonic.
the class ArchiveContentCommand method execute.
ArchiveContentsResult execute() {
params.validate();
try {
final ArchiveContentsResult archivedContents = doExecute();
this.nodeService.refresh(RefreshMode.ALL);
return archivedContents;
} catch (MoveNodeException e) {
throw new ArchiveContentException(e.getMessage(), ContentNodeHelper.translateNodePathToContentPath(e.getPath()));
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.content.ContentAccessException 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);
}
}
use of com.enonic.xp.content.ContentAccessException in project xp by enonic.
the class MoveContentCommand method execute.
MoveContentsResult execute() {
params.validate();
try {
final MoveContentsResult movedContents = doExecute();
this.nodeService.refresh(RefreshMode.ALL);
return movedContents;
} catch (MoveNodeException e) {
throw new MoveContentException(e.getMessage(), ContentPath.from(e.getPath().toString()));
} catch (NodeAlreadyExistAtPathException e) {
throw new ContentAlreadyExistsException(ContentPath.from(e.getNode().toString()), e.getRepositoryId(), e.getBranch());
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.content.ContentAccessException in project xp by enonic.
the class UpdateContentCommand method execute.
Content execute() {
params.validate();
validateCreateAttachments(params.getCreateAttachments());
try {
return doExecute();
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.content.ContentAccessException in project xp by enonic.
the class CreateContentCommand method doExecute.
private Content doExecute() {
final ContentType contentType = contentTypeService.getByName(new GetContentTypeParams().contentTypeName(params.getType()));
validateContentType(contentType);
formDefaultValuesProcessor.setDefaultValues(contentType.getForm(), params.getData());
// TODO apply default values to xData
CreateContentParams processedParams = runContentProcessors(this.params, contentType);
validateBlockingChecks(processedParams);
final CreateContentTranslatorParams createContentTranslatorParams = createContentTranslatorParams(processedParams);
final CreateNodeParams createNodeParams = CreateNodeParamsFactory.create(createContentTranslatorParams).contentTypeService(this.contentTypeService).pageDescriptorService(this.pageDescriptorService).xDataService(this.xDataService).partDescriptorService(this.partDescriptorService).layoutDescriptorService(this.layoutDescriptorService).contentDataSerializer(this.contentDataSerializer).siteService(this.siteService).build().produce();
try {
final Node createdNode = nodeService.create(createNodeParams);
if (params.isRefresh()) {
nodeService.refresh(RefreshMode.SEARCH);
}
return translator.fromNode(createdNode, false);
} catch (NodeAlreadyExistAtPathException e) {
throw new ContentAlreadyExistsException(ContentPath.from(createContentTranslatorParams.getParent(), createContentTranslatorParams.getName().toString()), e.getRepositoryId(), e.getBranch());
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
Aggregations