All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.merkle.oss.magnolia.powernode.AbstractPowerNodeService Maven / Gradle / Ivy

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));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy