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


Java NodeTypeManagerImpl类代码示例

本文整理汇总了Java中org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl的典型用法代码示例。如果您正苦于以下问题:Java NodeTypeManagerImpl类的具体用法?Java NodeTypeManagerImpl怎么用?Java NodeTypeManagerImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NodeTypeManagerImpl类属于org.apache.jackrabbit.core.nodetype包,在下文中一共展示了NodeTypeManagerImpl类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerNodeTypes

import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl; //导入依赖的package包/类
@Override
protected void registerNodeTypes() throws Exception {
    if (!ObjectUtils.isEmpty(nodeDefinitions)) {

        Session session = getBareSession();
        Workspace ws = session.getWorkspace();

        NodeTypeManagerImpl jackrabbitNodeTypeManager = (NodeTypeManagerImpl) ws.getNodeTypeManager();

        boolean debug = LOG.isDebugEnabled();
        for (int i = 0; i < nodeDefinitions.length; i++) {
            Resource resource = nodeDefinitions[i];
            if (debug) {
                LOG.debug("adding node type definitions from " + resource.getDescription());
            }
            try {
                //                    ws.getNodeTypeManager().registerNodeType(ntd, allowUpdate)
                jackrabbitNodeTypeManager.registerNodeTypes(resource.getInputStream(), contentType);
            } catch (RepositoryException ex) {
                LOG.error("Error registering nodetypes ", ex.getCause());
            }
        }
        session.logout();
    }
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:26,代码来源:JackrabbitSessionFactory.java

示例2: createNodeTypes

import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void createNodeTypes() throws RepositoryException {
   	Session session = SessionFactoryUtils.getSession(getTemplate().getSessionFactory(), false);
   	Workspace workspace = session.getWorkspace();
   	
   	LOG.info("Registering namespace 'next' -> http://nextreports.ro/jcr/2.0");
       NamespaceRegistry namespaceRegistry = workspace.getNamespaceRegistry();
       namespaceRegistry.registerNamespace("next", "http://nextreports.ro/jcr/2.0");

   	/*
       // check if the node type is registered already
	if (nodeTypeManager.hasNodeType(NEXT_REPORT_MIXIN)) {
		return;
	}
	*/

   	LOG.info("Creating node type mixin '" + StorageConstants.NEXT_REPORT_MIXIN + "'");
   	NodeTypeManagerImpl nodeTypeManager = (NodeTypeManagerImpl) workspace.getNodeTypeManager();
   	NodeTypeTemplate nodeTypeTemplate = nodeTypeManager.createNodeTypeTemplate();
   	nodeTypeTemplate.setName(StorageConstants.NEXT_REPORT_MIXIN);
   	nodeTypeTemplate.setMixin(true);
   	nodeTypeTemplate.setOrderableChildNodes(false);
   	nodeTypeTemplate.setPrimaryItemName("nt:unstructured");
   	nodeTypeTemplate.setDeclaredSuperTypeNames(new String[] { "mix:referenceable", "mix:versionable" });

   	/*
   	PropertyDefinitionTemplate propertyDefinitionTemplate = nodeTypeManager.createPropertyDefinitionTemplate();
   	propertyDefinitionTemplate.setName("*");
   	propertyDefinitionTemplate.setRequiredType(PropertyType.UNDEFINED);
   	propertyDefinitionTemplate.setAutoCreated(false);
   	propertyDefinitionTemplate.setMandatory(false);
   	propertyDefinitionTemplate.setOnParentVersion(OnParentVersionAction.COPY);
   	propertyDefinitionTemplate.setProtected(false);
   	propertyDefinitionTemplate.setMultiple(false);

   	nodeTypeTemplate.getPropertyDefinitionTemplates().add(propertyDefinitionTemplate);
   	*/

   	NodeDefinitionTemplate nodeDefinitionTemplate = nodeTypeManager.createNodeDefinitionTemplate();
   	nodeDefinitionTemplate.setName("runHistory");
   	nodeDefinitionTemplate.setDefaultPrimaryTypeName("nt:unstructured");
   	nodeDefinitionTemplate.setRequiredPrimaryTypeNames(new String[] { "nt:unstructured" });
   	nodeDefinitionTemplate.setAutoCreated(true);
   	nodeDefinitionTemplate.setMandatory(false);
   	nodeDefinitionTemplate.setOnParentVersion(OnParentVersionAction.IGNORE);
   	nodeDefinitionTemplate.setProtected(false);
   	nodeDefinitionTemplate.setSameNameSiblings(false);

   	nodeTypeTemplate.getNodeDefinitionTemplates().add(nodeDefinitionTemplate);

   	LOG.info("Registering node type mixin '" + StorageConstants.NEXT_REPORT_MIXIN + "'");
   	nodeTypeManager.registerNodeType(nodeTypeTemplate, true);

   	getTemplate().save();
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:56,代码来源:StorageUpdate0.java

示例3: createNodeTemplates

import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
	private void createNodeTemplates() throws RepositoryException {
		Session session = SessionFactoryUtils.getSession(getTemplate().getSessionFactory(), false);
    	Workspace workspace = session.getWorkspace();
    	    	
    	NodeTypeManagerImpl nodeTypeManager = (NodeTypeManagerImpl) workspace.getNodeTypeManager();
//    	nodeTypeManager.unregisterNodeType(StorageConstants.NEXT_REPORT_MIXIN);
    	    	
    	NodeTypeTemplate nodeTypeTemplate = nodeTypeManager.createNodeTypeTemplate();
    	nodeTypeTemplate.setName(StorageConstants.NEXT_REPORT_MIXIN);
    	nodeTypeTemplate.setMixin(true);
    	nodeTypeTemplate.setOrderableChildNodes(false);
    	nodeTypeTemplate.setPrimaryItemName("nt:unstructured");
    	nodeTypeTemplate.setDeclaredSuperTypeNames(new String[] { "mix:referenceable", "mix:versionable" });   
    	
    	NodeDefinitionTemplate nodeDefinitionTemplate = nodeTypeManager.createNodeDefinitionTemplate();
    	nodeDefinitionTemplate.setName("runHistory");
    	nodeDefinitionTemplate.setDefaultPrimaryTypeName("nt:unstructured");
    	nodeDefinitionTemplate.setRequiredPrimaryTypeNames(new String[] { "nt:unstructured" });
    	nodeDefinitionTemplate.setAutoCreated(true);
    	nodeDefinitionTemplate.setMandatory(false);
    	nodeDefinitionTemplate.setOnParentVersion(OnParentVersionAction.IGNORE);
    	nodeDefinitionTemplate.setProtected(false);
    	nodeDefinitionTemplate.setSameNameSiblings(false);

    	nodeTypeTemplate.getNodeDefinitionTemplates().add(nodeDefinitionTemplate);
    	    	
    	NodeDefinitionTemplate nodeDefinitionTemplate2 = nodeTypeManager.createNodeDefinitionTemplate();
    	nodeDefinitionTemplate2.setName("templates");
    	nodeDefinitionTemplate2.setDefaultPrimaryTypeName("nt:unstructured");
    	nodeDefinitionTemplate2.setRequiredPrimaryTypeNames(new String[] { "nt:unstructured" });
    	nodeDefinitionTemplate2.setAutoCreated(true);
    	nodeDefinitionTemplate2.setMandatory(false);
    	nodeDefinitionTemplate2.setOnParentVersion(OnParentVersionAction.IGNORE);
    	nodeDefinitionTemplate2.setProtected(false);
    	nodeDefinitionTemplate2.setSameNameSiblings(false);
    	
    	nodeTypeTemplate.getNodeDefinitionTemplates().add(nodeDefinitionTemplate2);

    	LOG.info("Registering node type mixin '" + StorageConstants.NEXT_REPORT_MIXIN + "'");
    	nodeTypeManager.registerNodeType(nodeTypeTemplate, true);
    	
    	// add templates node to all existing reports
    	String statement = 
				"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) + 
				"//*[@className='ro.nextreports.server.domain.Report']";
		  
		QueryResult queryResult = getTemplate().query(statement);
		NodeIterator nodes = queryResult.getNodes();
		
		LOG.info("Create templates nodes : Found " + nodes.getSize() + " report nodes");
		while (nodes.hasNext()) {			
			Node node = nodes.nextNode();
			node.addNode("templates");
		}					

    	getTemplate().save();
	}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:59,代码来源:StorageUpdate13.java


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