Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.openl.rules.repository.jcr;
  
  import java.util.Date;
  import java.util.List;
  
  import javax.jcr.Node;
  
Implementation for JCR Project.

Author(s):
Aleh Bykhavets
 
 public class JcrProject extends JcrEntity implements RProject {
     // TODO: candidate to move into JcrNT
     public static final String NODE_FILES = "files";

    
Project's root folder or project->files.
 
     private JcrFolder rootFolder;
 
     private JcrCommonProject project;

    
Creates new project instance.

Note that OpenL project cannot be created inside other OpenL project. I.e. nesting is not allowed for OpenL projects.

Parameters:
parentNode parent node
nodeName name of node
Returns:
newly created project
Throws:
javax.jcr.RepositoryException if fails
 
     protected static JcrProject createProject(Node parentNodeString nodeNamethrows RepositoryException {
         Node n = NodeUtil.createNode(parentNodenodeName.true);
 
         // TODO what should be in default description?
         n.setProperty(."created " + new Date() + " by UNKNOWN");
 
         NodeUtil.createNode(n.true);
 
         parentNode.save();
         n.checkin();
         n.save();
 
         return new JcrProject(n);
     }
 
     public JcrProject(Node nodethrows RepositoryException {
         super(node);
 
         NodeUtil.checkNodeType(node.);
 
         Node files = node.getNode();
          = new JcrFolder(files);
 
          = new JcrCommonProject(node);
     }
 
     public void commit(CommonUser userthrows RRepositoryException {
         .commit(user);
     }
 
     @Override
     public void delete() throws RRepositoryException {
         throw new RRepositoryException("Use delete(CommonUser) instead"null);
     }
 
     public void delete(CommonUser userthrows RRepositoryException {
         .delete(user);
     }
 
     public void erase(CommonUser userthrows RRepositoryException {
         .erase(user);
     }
 
     public RProject getProjectVersion(CommonVersion versionthrows RRepositoryException {
         try {
             Node frozenNode = NodeUtil.getNode4Version(node(), version);
             return new JcrOldProject(getName(), frozenNodeversion);
         } catch (RepositoryException e) {
             throw new RRepositoryException("Cannot get project version."e);
         }
     }

    
 
     public RFolder getRootFolder() {
         return ;
     }
 
    public boolean isMarked4Deletion() throws RRepositoryException {
        return .isMarked4Deletion();
    }
    public void undelete(CommonUser userthrows RRepositoryException {
        .undelete(user);
    }
    public RFile createFile(String namethrows RRepositoryException {
        return .createFile(name);
    }
    public RFolder createFolder(String namethrows RRepositoryException {
        return .createFolder(name);
    }
    public List<RFilegetFiles() throws RRepositoryException {
        return .getFiles();
    }
    public List<RFoldergetFolders() throws RRepositoryException {
        return .getFolders();
    }
New to GrepCode? Check out our FAQ X