当前位置: 首页>>代码示例>>Java>>正文


Java Node.addMixin方法代码示例

本文整理汇总了Java中javax.jcr.Node.addMixin方法的典型用法代码示例。如果您正苦于以下问题:Java Node.addMixin方法的具体用法?Java Node.addMixin怎么用?Java Node.addMixin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jcr.Node的用法示例。


在下文中一共展示了Node.addMixin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createProject

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public RepositoryFile createProject(String projectName, User user,boolean classify) throws Exception{
	if(!permissionService.isAdmin()){
		throw new NoPermissionException();
	}
	repositoryInteceptor.createProject(projectName);
	Node rootNode=getRootNode();
	if(rootNode.hasNode(projectName)){
		throw new RuleException("Project ["+projectName+"] already exist.");
	}
	Node projectNode=rootNode.addNode(projectName);
	projectNode.addMixin("mix:versionable");
	projectNode.setProperty(FILE, true);
	projectNode.setProperty(CRATE_USER,user.getUsername());
	projectNode.setProperty(COMPANY_ID, user.getCompanyId());
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(new Date());
	DateValue dateValue = new DateValue(calendar);
	projectNode.setProperty(CRATE_DATE, dateValue);
	session.save();
	createResourcePackageFile(projectName,user);
	createClientConfigFile(projectName, user);
	RepositoryFile projectFileInfo=buildProjectFile(projectNode, null ,classify,null);
	return projectFileInfo;
}
 
开发者ID:youseries,项目名称:urule,代码行数:26,代码来源:RepositoryServiceImpl.java

示例2: lockPath

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void lockPath(String path,User user) throws Exception{
	path = processPath(path);
	int pos=path.indexOf(":");
	if(pos!=-1){
		path=path.substring(0,pos);
	}
	Node rootNode=getRootNode();
	if (!rootNode.hasNode(path)) {
		throw new RuleException("File [" + path + "] not exist.");
	}
	Node fileNode = rootNode.getNode(path);
	String topAbsPath=fileNode.getPath();
	if(lockManager.isLocked(topAbsPath)){
		String owner=lockManager.getLock(topAbsPath).getLockOwner();
		throw new NodeLockException("【"+path+"】已被"+owner+"锁定,您不能进行再次锁定!");
	}
	List<Node> nodeList=new ArrayList<Node>();
	unlockAllChildNodes(fileNode, user, nodeList, path);
	for(Node node:nodeList){
		if(!lockManager.isLocked(node.getPath())){
			continue;
		}
		Lock lock=lockManager.getLock(node.getPath());
		lockManager.unlock(lock.getNode().getPath());
	}
	if(!fileNode.isNodeType(NodeType.MIX_LOCKABLE)){
		if (!fileNode.isCheckedOut()) {
			versionManager.checkout(fileNode.getPath());
		}
		fileNode.addMixin("mix:lockable");
		session.save();
	}
	lockManager.lock(topAbsPath, true, true, Long.MAX_VALUE, user.getUsername());				
}
 
开发者ID:youseries,项目名称:urule,代码行数:36,代码来源:RepositoryServiceImpl.java

示例3: createFileNode

import javax.jcr.Node; //导入方法依赖的package包/类
private void createFileNode(String path, String content,User user,boolean isFile) throws Exception{
	String createUser=user.getUsername();
	repositoryInteceptor.createFile(path,content);
	Node rootNode=getRootNode();
	path = processPath(path);
	try {
		if (rootNode.hasNode(path)) {
			throw new RuleException("File [" + path + "] already exist.");
		}
		Node fileNode = rootNode.addNode(path);
		fileNode.addMixin("mix:versionable");
		fileNode.addMixin("mix:lockable");
		Binary fileBinary = new BinaryImpl(content.getBytes());
		fileNode.setProperty(DATA, fileBinary);
		if(isFile){
			fileNode.setProperty(FILE, true);				
		}
		fileNode.setProperty(CRATE_USER, createUser);
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(new Date());
		DateValue dateValue = new DateValue(calendar);
		fileNode.setProperty(CRATE_DATE, dateValue);
		session.save();
	} catch (Exception ex) {
		throw new RuleException(ex);
	}
}
 
开发者ID:youseries,项目名称:urule,代码行数:28,代码来源:RepositoryServiceImpl.java

示例4: getOrAddNodeByPath

import javax.jcr.Node; //导入方法依赖的package包/类
private Node getOrAddNodeByPath( Node baseNode, String name, String nodeType )
    throws RepositoryException
{
    Node node = baseNode;
    for ( String n : name.split( "/" ) )
    {
        node = JcrUtils.getOrAddNode( node, n );
        if ( nodeType != null )
        {
            node.addMixin( nodeType );
        }
    }
    return node;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:15,代码来源:JcrMetadataRepository.java

示例5: getOrAddProjectNode

import javax.jcr.Node; //导入方法依赖的package包/类
private Node getOrAddProjectNode( String repositoryId, String namespace, String projectId )
    throws RepositoryException
{
    Node namespaceNode = getOrAddNamespaceNode( repositoryId, namespace );
    Node node = JcrUtils.getOrAddNode( namespaceNode, projectId );
    node.addMixin( PROJECT_NODE_TYPE );
    return node;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:9,代码来源:JcrMetadataRepository.java

示例6: getOrAddProjectVersionNode

import javax.jcr.Node; //导入方法依赖的package包/类
private Node getOrAddProjectVersionNode( String repositoryId, String namespace, String projectId,
                                         String projectVersion )
    throws RepositoryException
{
    Node projectNode = getOrAddProjectNode( repositoryId, namespace, projectId );
    Node node = JcrUtils.getOrAddNode( projectNode, projectVersion );
    node.addMixin( PROJECT_VERSION_NODE_TYPE );
    return node;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:10,代码来源:JcrMetadataRepository.java

示例7: getOrAddArtifactNode

import javax.jcr.Node; //导入方法依赖的package包/类
private Node getOrAddArtifactNode( String repositoryId, String namespace, String projectId, String projectVersion,
                                   String id )
    throws RepositoryException
{
    Node versionNode = getOrAddProjectVersionNode( repositoryId, namespace, projectId, projectVersion );
    Node node = JcrUtils.getOrAddNode( versionNode, id );
    node.addMixin( ARTIFACT_NODE_TYPE );
    return node;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:10,代码来源:JcrMetadataRepository.java

示例8: setMixin

import javax.jcr.Node; //导入方法依赖的package包/类
/**
 * Sets the mixin.
 *
 * @param post the post
 * @param mixinName the mixin name
 */
private void setMixin(Resource post, String mixinName) {
	try {
       	Node postNode = post.adaptTo(Node.class);
       	postNode.addMixin(mixinName);
       } catch (Exception e) {
		e.printStackTrace();
	}		
}
 
开发者ID:auniverseaway,项目名称:aem-touch-admin-console,代码行数:15,代码来源:UptimeEntryServlet.java

示例9: createDir

import javax.jcr.Node; //导入方法依赖的package包/类
public void createDir(String path,User user) throws Exception{
	if(!permissionService.isAdmin()){
		throw new NoPermissionException();
	}
	repositoryInteceptor.createDir(path);
	Node rootNode=getRootNode();
	path = processPath(path);
	if (rootNode.hasNode(path)) {
		throw new RuleException("Dir [" + path + "] already exist.");
	}
	boolean add = false;
	String[] subpaths = path.split("/");
	Node parentNode = rootNode;
	for (String subpath : subpaths) {
		if (StringUtils.isEmpty(subpath)) {
			continue;
		}
		String subDirs[] = subpath.split("\\.");
		for (String dir : subDirs) {
			if (StringUtils.isEmpty(dir)) {
				continue;
			}
			if (parentNode.hasNode(dir)) {
				parentNode = parentNode.getNode(dir);
			} else {
				parentNode = parentNode.addNode(dir);
				parentNode.addMixin("mix:versionable");
				parentNode.addMixin("mix:lockable");
				parentNode.setProperty(DIR_TAG, true);
				parentNode.setProperty(FILE, true);
				parentNode.setProperty(CRATE_USER,user.getUsername());
				Calendar calendar = Calendar.getInstance();
				calendar.setTime(new Date());
				DateValue dateValue = new DateValue(calendar);
				parentNode.setProperty(CRATE_DATE, dateValue);
				add = true;
			}
		}
	}
	if (add) {
		session.save();
	}
}
 
开发者ID:youseries,项目名称:urule,代码行数:44,代码来源:RepositoryServiceImpl.java

示例10: updateArtifact

import javax.jcr.Node; //导入方法依赖的package包/类
@Override
public void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
                            ArtifactMetadata artifactMeta )
    throws MetadataRepositoryException
{
    updateNamespace( repositoryId, namespace );

    try
    {
        Node node =
            getOrAddArtifactNode( repositoryId, namespace, projectId, projectVersion, artifactMeta.getId() );

        Calendar cal = Calendar.getInstance();
        cal.setTime( artifactMeta.getFileLastModified() );
        node.setProperty( JCR_LAST_MODIFIED, cal );

        cal = Calendar.getInstance();
        cal.setTime( artifactMeta.getWhenGathered() );
        node.setProperty( "whenGathered", cal );

        node.setProperty( "size", artifactMeta.getSize() );
        node.setProperty( "md5", artifactMeta.getMd5() );
        node.setProperty( "sha1", artifactMeta.getSha1() );

        node.setProperty( "version", artifactMeta.getVersion() );

        // iterate over available facets to update/add/remove from the artifactMetadata
        for ( String facetId : metadataFacetFactories.keySet() )
        {
            MetadataFacet metadataFacet = artifactMeta.getFacet( facetId );
            if ( metadataFacet == null )
            {
                continue;
            }
            if ( node.hasNode( facetId ) )
            {
                node.getNode( facetId ).remove();
            }
            if ( metadataFacet != null )
            {
                // recreate, to ensure properties are removed
                Node n = node.addNode( facetId );
                n.addMixin( FACET_NODE_TYPE );

                for ( Map.Entry<String, String> entry : metadataFacet.toProperties().entrySet() )
                {
                    n.setProperty( entry.getKey(), entry.getValue() );
                }
            }
        }
    }
    catch ( RepositoryException e )
    {
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:57,代码来源:JcrMetadataRepository.java

示例11: addMixinThrowsException

import javax.jcr.Node; //导入方法依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void addMixinThrowsException() throws Exception {
	Node testObj = aNode("/content");
	
	testObj.addMixin(null);
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:7,代码来源:MockNodeTest.java


注:本文中的javax.jcr.Node.addMixin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。