當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentModel.TYPE_CONTAINER屬性代碼示例

本文整理匯總了Java中org.alfresco.model.ContentModel.TYPE_CONTAINER屬性的典型用法代碼示例。如果您正苦於以下問題:Java ContentModel.TYPE_CONTAINER屬性的具體用法?Java ContentModel.TYPE_CONTAINER怎麽用?Java ContentModel.TYPE_CONTAINER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.alfresco.model.ContentModel的用法示例。


在下文中一共展示了ContentModel.TYPE_CONTAINER屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEditions

/** {@inheritDoc} */
public VersionHistory getEditions(NodeRef mlContainer)
{
    VersionHistory editionHistory = null;

    // Only the mlContainer can have editions
    if (nodeService.getType(mlContainer).equals(
            ContentModel.TYPE_MULTILINGUAL_CONTAINER))
    {
        // get the editions of the mlContainer
        editionHistory = versionService.getVersionHistory(mlContainer);
    }

    else
    {
        throw new IllegalArgumentException("The type of the node must be "
                + ContentModel.TYPE_CONTAINER);
    }

    if (logger.isDebugEnabled())
    {
        logger.debug("Found all editions: \n" + "   Node:     "
                + mlContainer + " (type "
                + ContentModel.TYPE_MULTILINGUAL_CONTAINER + ")\n"
                + "   Editions: " + editionHistory);
    }

    return editionHistory;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:29,代碼來源:EditionServiceImpl.java

示例2: createUser

public static void createUser(
        String userName, 
        String password, 
        String email,
        NodeRef rootNodeRef,
        NodeService nodeService,
        MutableAuthenticationService authenticationService)
{    
    // ignore if the user's authentication already exists
    if (authenticationService.authenticationExists(userName))
    {
        // ignore
        return;
    }
    QName children = ContentModel.ASSOC_CHILDREN;
    QName system = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
    QName container = ContentModel.TYPE_CONTAINER;
    QName types = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "people");
    
    NodeRef systemNodeRef = nodeService.createNode(rootNodeRef, children, system, container).getChildRef();
    NodeRef typesNodeRef = nodeService.createNode(systemNodeRef, children, types, container).getChildRef();
    
    HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(ContentModel.PROP_USERNAME, userName);
    if (email != null && email.length() != 0)
    {
        properties.put(ContentModel.PROP_EMAIL, email);
    }
    nodeService.createNode(typesNodeRef, children, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, userName) , container, properties);
    
    // Create the users
    authenticationService.createAuthentication(userName, password.toCharArray()); 
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:TestWithUserUtils.java

示例3: getRegistryRootNodeRef

private NodeRef getRegistryRootNodeRef()
{
    NodeRef registryRootNodeRef = null;
    // Ensure that the registry root node is present
    NodeRef storeRootNodeRef = nodeService.getRootNode(registryStoreRef);
    List<NodeRef> nodeRefs = searchService.selectNodes(
            storeRootNodeRef,
            registryRootPath,
            new QueryParameterDefinition[] {},
            namespaceService,
            false,
            SearchService.LANGUAGE_XPATH);
    if (nodeRefs.size() == 0)
    {
        throw new AlfrescoRuntimeException(
                "Registry root not present: \n" +
                "   Store: " + registryStoreRef + "\n" +
                "   Path:  " + registryRootPath);
    }
    else if (nodeRefs.size() > 1)
    {
        throw new AlfrescoRuntimeException(
                "Registry root path has multiple targets: \n" +
                "   Store: " + registryStoreRef + "\n" +
                "   Path:  " + registryRootPath);
    }
    else
    {
        registryRootNodeRef = nodeRefs.get(0);
    }
    
    // Check the root
    QName typeQName = nodeService.getType(registryRootNodeRef);
    if (!typeQName.equals(ContentModel.TYPE_CONTAINER))
    {
        throw new AlfrescoRuntimeException(
                "Registry root is not of type " + ContentModel.TYPE_CONTAINER + ": \n" +
                "   Node: " + registryRootNodeRef + "\n" +
                "   Type: " + typeQName);
    }
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug(
                "Found root for registry: \n" +
                "   Store: " + registryStoreRef + "\n" +
                "   Path : " + registryRootPath + "\n" +
                "   Root:  " + registryRootNodeRef);
    }
    return registryRootNodeRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:51,代碼來源:RegistryServiceImpl.java

示例4: setUp

public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    aclDaoComponent = (AclDAO) applicationContext.getBean("aclDAO");
    
    nodeService = (NodeService) applicationContext.getBean("nodeService");
    dictionaryService = (DictionaryService) applicationContext.getBean(ServiceRegistry.DICTIONARY_SERVICE
            .getLocalName());
    permissionService = (PermissionServiceSPI) applicationContext.getBean("permissionService");
    namespacePrefixResolver = (NamespacePrefixResolver) applicationContext
            .getBean(ServiceRegistry.NAMESPACE_SERVICE.getLocalName());
    authenticationService = (MutableAuthenticationService) applicationContext.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    permissionModelDAO = (ModelDAO) applicationContext.getBean("permissionsModelDAO");
    personService = (PersonService) applicationContext.getBean("personService");
    authorityService = (AuthorityService) applicationContext.getBean("authorityService");
    
    authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
    authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("authenticationDao");
    transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
    
    testTX = transactionService.getUserTransaction();
    testTX.begin();
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime());
    rootNodeRef = nodeService.getRootNode(storeRef);

    QName children = ContentModel.ASSOC_CHILDREN;
    QName system = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
    QName container = ContentModel.TYPE_CONTAINER;
    QName types = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "people");

    systemNodeRef = nodeService.createNode(rootNodeRef, children, system, container).getChildRef();
    NodeRef typesNodeRef = nodeService.createNode(systemNodeRef, children, types, container).getChildRef();
    Map<QName, Serializable> props = createPersonProperties("andy");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
    props = createPersonProperties("lemur");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();

    // create an authentication object e.g. the user
    if(authenticationDAO.userExists("andy"))
    {
        authenticationService.deleteAuthentication("andy");
    }
    authenticationService.createAuthentication("andy", "andy".toCharArray());

    if(authenticationDAO.userExists("lemur"))
    {
        authenticationService.deleteAuthentication("lemur");
    }
    authenticationService.createAuthentication("lemur", "lemur".toCharArray());
    
    if(authenticationDAO.userExists(AuthenticationUtil.getAdminUserName()))
    {
        authenticationService.deleteAuthentication(AuthenticationUtil.getAdminUserName());
    }
    authenticationService.createAuthentication(AuthenticationUtil.getAdminUserName(), "admin".toCharArray());
    
    authenticationComponent.clearCurrentSecurityContext();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:68,代碼來源:AclDaoComponentTest.java


注:本文中的org.alfresco.model.ContentModel.TYPE_CONTAINER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。