• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NodeTypeDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getCnd

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
/**
 * Returns the namespace neutral CND of the given node type definition.
 * @param def the node type definition
 * @return the CND
 */
private static String getCnd(NodeTypeDefinition def) {
    StringWriter out = new StringWriter();
    CompactNodeTypeDefWriter cndWriter = new CompactNodeTypeDefWriter(out, new CompactNodeTypeDefWriter.NamespaceMapping(){
        @Override
        public String getNamespaceURI(String s) {
            return s;
        }
    }, false);
    try {
        cndWriter.write(def);
    } catch (IOException e) {
        // should never occur
        log.error("Error generating CND of " + def, e);
        throw new IllegalStateException(e);
    }
    return out.toString();
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:23,代码来源:NodeTypeImpl.java


示例2: beforeEach

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Override
public void beforeEach() throws Exception {
    super.beforeEach();

    URL cndResource = getClass().getResource("/nodetypes-modeshape.cnd");
    File cnd = null;
    try {
        cnd = new File(cndResource.toURI());

        SimpleProblems problems = new SimpleProblems();
        ExecutionContext context = new ExecutionContext();
        context.getNamespaceRegistry().register("sling", "http://sling.apache.org/jcr/sling/1.0");
        context.getNamespaceRegistry().register("cq", "http://www.day.com/jcr/cq/1.0");

        // Set up the importer ...
        CndImporter importer = new CndImporter(context, true);
        importer.importFrom(cnd, problems);

        List<NodeTypeDefinition> ntds = importer.getNodeTypeDefinitions();
        // Retrieve node type manager from the session
        NodeTypeManager nodeTypeManager = ((Session) session).getWorkspace().getNodeTypeManager();
        nodeTypeManager.registerNodeTypes(ntds.toArray(new NodeTypeDefinition[] {}), true);
        for (NodeTypeDefinition ntd : ntds) {
            System.out.println("Registered: " + ntd.getName());
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:31,代码来源:TestAdobeCQ.java


示例3: NodeTypeTemplateImpl

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
NodeTypeTemplateImpl(NameMapper mapper, NodeTypeDefinition definition)
        throws ConstraintViolationException {
    super(mapper, definition.getName());

    setMixin(definition.isMixin());
    setOrderableChildNodes(definition.hasOrderableChildNodes());
    setAbstract(definition.isAbstract());
    setQueryable(definition.isQueryable());
    String primaryItemName = definition.getPrimaryItemName();
    if (primaryItemName != null) {
        setPrimaryItemName(primaryItemName);
    }
    setDeclaredSuperTypeNames(definition.getDeclaredSupertypeNames());

    PropertyDefinition[] pds = definition.getDeclaredPropertyDefinitions();
    if (pds != null) {
        propertyDefinitionTemplates =
                Lists.newArrayListWithCapacity(pds.length);
        for (PropertyDefinition pd : pds) {
            propertyDefinitionTemplates.add(
                    new PropertyDefinitionTemplateImpl(mapper, pd));
        }
    }

    NodeDefinition[] nds = definition.getDeclaredChildNodeDefinitions();
    if (nds != null) {
        nodeDefinitionTemplates =
                Lists.newArrayListWithCapacity(nds.length);
        for (NodeDefinition nd : nds) {
            nodeDefinitionTemplates.add(
                    new NodeDefinitionTemplateImpl(mapper, nd));
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:35,代码来源:NodeTypeTemplateImpl.java


示例4: registerNodeType

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Override
public NodeType registerNodeType(
        NodeTypeDefinition ntd, boolean allowUpdate)
        throws RepositoryException {
    return registerNodeTypes(
            new NodeTypeDefinition[]{ntd}, allowUpdate).nextNodeType();
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:8,代码来源:ReadWriteNodeTypeManager.java


示例5: onLoaded

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Override
public void onLoaded(AbstractResourceModelContext modelContext) {
    try {
        final Session session= this.sessionFactory.getInternalSession();
        /* make sure that the scape namespace is available in fcrepo */
        final Dataset namespace =
                this.repositoryService.getNamespaceRegistryDataset(session, new DefaultIdentifierTranslator());
        UpdateAction.parseExecute(
                "INSERT {<http://scapeproject.eu/model#> <" +
                        RdfLexicon.HAS_NAMESPACE_PREFIX + "> \"scape\"} WHERE {}",
                namespace);
        session.save();
        // Get the node type manager ...
        final NodeTypeManager mgr =
                session.getWorkspace().getNodeTypeManager();

        // Create templates for the node types ...
        final NodeTypeTemplate planType = mgr.createNodeTypeTemplate();
        planType.setName("scape:plan");
        planType.setDeclaredSuperTypeNames(new String[] {
                "fedora:resource", "fedora:object"});
        planType.setMixin(true);
        planType.setQueryable(true);
        planType.setAbstract(false);
        planType.getPropertyDefinitionTemplates().add(createMultiPropertyDefTemplate(session, mgr, "scape:hasExecState"));


        // and register them
        mgr.registerNodeTypes(new NodeTypeDefinition[] {planType}, true);

    } catch (RepositoryException e) {
        LOG.error("Error while setting up scape namespace", e);
        throw new RuntimeException("Unable to setup scape on fedora");
    }
}
 
开发者ID:openpreserve,项目名称:scape-fcrepo4-planmanagement,代码行数:36,代码来源:ScapeNamespaceInitializer.java


示例6: testRdfTypeInheritance

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Test
public void testRdfTypeInheritance() throws RepositoryException {
    final Session jcrSession = getJcrSession(session);
    final NodeTypeManager mgr = jcrSession.getWorkspace().getNodeTypeManager();
    //create supertype mixin
    final NodeTypeTemplate type1 = mgr.createNodeTypeTemplate();
    type1.setName("test:aSupertype");
    type1.setMixin(true);
    final NodeTypeDefinition[] nodeTypes = new NodeTypeDefinition[]{type1};
    mgr.registerNodeTypes(nodeTypes, true);

    //create a type inheriting above supertype
    final NodeTypeTemplate type2 = mgr.createNodeTypeTemplate();
    type2.setName("test:testInher");
    type2.setMixin(true);
    type2.setDeclaredSuperTypeNames(new String[]{"test:aSupertype"});
    final NodeTypeDefinition[] nodeTypes2 = new NodeTypeDefinition[]{type2};
    mgr.registerNodeTypes(nodeTypes2, true);

    //create object with inheriting type
    FedoraResource object = containerService.findOrCreate(session, "/testNTTnheritanceObject");
    final javax.jcr.Node node = getJcrNode(object);
    node.addMixin("test:testInher");

    session.commit();
    session.expire();
    session = repo.login();

    object = containerService.findOrCreate(session, "/testNTTnheritanceObject");

    //test that supertype has been inherited as rdf:type
    final Node s = createGraphSubjectNode(object);
    final Node p = type.asNode();
    final Node o = createProperty("info:fedora/test/aSupertype").asNode();
    assertTrue("supertype test:aSupertype not found inherited in test:testInher!",
            object.getTriples(subjects, PROPERTIES).collect(toModel()).getGraph().contains(s, p, o));
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:38,代码来源:FedoraResourceImplIT.java


示例7: createNodeTypeTemplate

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Override
public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd)
        throws RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:6,代码来源:ReadOnlyNodeTypeManager.java


示例8: registerNodeType

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
/**
 * This implementation always throws a {@link UnsupportedRepositoryOperationException}.
 */
@Override
public NodeType registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate) throws RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:8,代码来源:ReadOnlyNodeTypeManager.java


示例9: registerNodeTypes

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
/**
 * This implementation always throws a {@link UnsupportedRepositoryOperationException}.
 */
@Override
public NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate) throws RepositoryException {
    throw new UnsupportedRepositoryOperationException();
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:8,代码来源:ReadOnlyNodeTypeManager.java


示例10: createNodeTypeTemplate

import javax.jcr.nodetype.NodeTypeDefinition; //导入依赖的package包/类
@Override
public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd)
        throws ConstraintViolationException {
    return new NodeTypeTemplateImpl(getNamePathMapper(), ntd);
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:6,代码来源:ReadWriteNodeTypeManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypeDescriptor类代码示例发布时间:2022-05-22
下一篇:
Java RCFileInputFormat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap