com.merkle.oss.magnolia.powernode.AbstractPowerNodeService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magnolia-powernode Show documentation
Show all versions of magnolia-powernode Show documentation
compiles and bundles generated and base classes
The newest version!
package com.merkle.oss.magnolia.powernode;
import javax.jcr.Node;
import javax.jcr.Session;
import java.util.Optional;
public abstract class AbstractPowerNodeService> {
private final NodeService nodeService;
private final AbstractPowerNodeDecorator powerNodeDecorator;
protected AbstractPowerNodeService(
final NodeService nodeService,
final AbstractPowerNodeDecorator powerNodeDecorator
) {
this.nodeService = nodeService;
this.powerNodeDecorator = powerNodeDecorator;
}
public N convertToPowerNode(final Node node) {
return powerNodeDecorator.wrapNode(node);
}
public Optional getSession(final String workspace) {
return nodeService.getSession(workspace);
}
public Optional getSystemSession(final String workspace) {
return nodeService.getSystemSession(workspace);
}
public Optional getByIdentifier(final String workspace, final String identifier) {
return nodeService.getByIdentifier(workspace, identifier).map(powerNodeDecorator::wrapNode);
}
public Optional getByIdentifier(final Session session, final String identifier) {
return nodeService.getByIdentifier(session, identifier).map(powerNodeDecorator::wrapNode);
}
public Optional getByPath(final String workspace, final String path) {
return nodeService.getByPath(workspace, path).map(powerNodeDecorator::wrapNode);
}
public Optional getByPath(final Session session, final String path) {
return nodeService.getByPath(session, path).map(powerNodeDecorator::wrapNode);
}
public Optional getRootNode(final String workspace) {
return nodeService.getRootNode(workspace).map(powerNodeDecorator::wrapNode);
}
public N getRootNode(final Session session) {
return powerNodeDecorator.wrapNode(nodeService.getRootNode(session));
}
}