Package org.jboss.dna.connector.store.jpa.model.common

Examples of org.jboss.dna.connector.store.jpa.model.common.WorkspaceEntity


    public void process( CreateNodeRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            // Create nodes have to be defined via a path ...
            Location parentLocation = request.under();
            ActualLocation actual = getActualLocation(workspace.getId(), parentLocation);
            String parentUuidString = actual.uuid;
            assert parentUuidString != null;

            // We need to look for an existing UUID property in the request,
            // so since we have to iterate through the properties, go ahead an serialize them right away ...
            String uuidString = null;
            for (Property property : request.properties()) {
                if (property.getName().equals(DnaLexicon.UUID)) {
                    uuidString = stringFactory.create(property.getFirstValue());
                    break;
                }
            }
            if (uuidString == null) uuidString = UUID.randomUUID().toString();
            assert uuidString != null;
            createProperties(workspaceId, uuidString, request.properties());

            // Find or create the namespace for the child ...
            Name childName = request.named();
            String childNsUri = childName.getNamespaceUri();
            NamespaceEntity ns = namespaces.get(childNsUri, true);
            assert ns != null;
            final Path parentPath = actual.location.getPath();
            assert parentPath != null;

            // Figure out the next SNS index and index-in-parent for this new child ...
            actualLocation = addNewChild(workspaceId, actual, uuidString, childName, true);

            // Since we've just created this node, we know about all the children (actually, there are none).
            cache.setAllChildren(workspace.getId(), actualLocation.getPath(), new LinkedList<Location>());

            // Flush the entities ...
            // entities.flush();

        } catch (Throwable e) { // Includes PathNotFoundException
View Full Code Here


    public void process( ReadNodeRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location location = request.at();
            ActualLocation actual = getActualLocation(workspaceId, location);
            String parentUuidString = actual.uuid;
View Full Code Here

    public void process( ReadAllChildrenRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location location = request.of();
            ActualLocation actual = getActualLocation(workspaceId, location);
            actualLocation = actual.location;
View Full Code Here

        logger.trace(request.toString());
        Location actualLocation = null;
        final int startingIndex = request.startingAtIndex();
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location parentLocation = request.of();
            ActualLocation actualParent = getActualLocation(workspaceId, parentLocation);
            actualLocation = actualParent.location;
View Full Code Here

        Location actualLocation = null;
        final Location previousSibling = request.startingAfter();
        final int count = request.count();
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            ActualLocation actualSibling = getActualLocation(workspaceId, previousSibling);
            actualLocation = actualSibling.location;
            if (!actualLocation.getPath().isRoot()) {
View Full Code Here

    public void process( ReadAllPropertiesRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location location = request.at();
            ActualLocation actual = getActualLocation(workspaceId, location);
            String uuidString = actual.uuid;
View Full Code Here

        logger.trace(request.toString());
        // Process the one property that's requested ...
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            // Small optimization ...
            final Name propertyName = request.named();
            if (DnaLexicon.UUID.equals(propertyName)) {
View Full Code Here

    public void process( UpdatePropertiesRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location location = request.on();
            ActualLocation actual = getActualLocation(workspaceId, location);
            actualLocation = actual.location;
View Full Code Here

    public void process( ReadBranchRequest request ) {
        logger.trace(request.toString());
        Location actualLocation = null;
        try {
            // Find the workspace ...
            WorkspaceEntity workspace = getExistingWorkspace(request.inWorkspace(), request);
            if (workspace == null) return;
            Long workspaceId = workspace.getId();
            assert workspaceId != null;

            Location location = request.at();
            ActualLocation actual = getActualLocation(workspaceId, location);
            actualLocation = actual.location;
View Full Code Here

        logger.trace(request.toString());
        Location actualFromLocation = null;
        Location actualToLocation = null;
        try {
            // Find the workspaces ...
            WorkspaceEntity fromWorkspace = getExistingWorkspace(request.fromWorkspace(), request);
            if (fromWorkspace == null) return;
            WorkspaceEntity intoWorkspace = getExistingWorkspace(request.intoWorkspace(), request);
            if (intoWorkspace == null) return;
            Long fromWorkspaceId = fromWorkspace.getId();
            Long intoWorkspaceId = intoWorkspace.getId();
            assert fromWorkspaceId != null;
            assert intoWorkspaceId != null;
            final boolean isSameWorkspace = fromWorkspaceId == intoWorkspaceId;

            Location fromLocation = request.from();
View Full Code Here

TOP

Related Classes of org.jboss.dna.connector.store.jpa.model.common.WorkspaceEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.