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


Java ContentModel类代码示例

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


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

示例1: NodeImporter

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/**
 * Construct
 * 
 * @param rootRef NodeRef
 * @param location Location
 * @param binding ImporterBinding
 * @param streamHandler ImportPackageHandler
 * @param progress ImporterProgress
 */
private NodeImporter(NodeRef rootRef, Location location, ImporterBinding binding, ImportPackageHandler streamHandler, ImporterProgress progress)
{
    this.rootRef = rootRef;
    this.rootAssocType = location.getChildAssocType();
    this.location = location;
    this.binding = binding;
    this.progress = progress;
    this.streamHandler = streamHandler;
    this.importStrategy = createNodeImporterStrategy(binding == null ? null : binding.getUUIDBinding());
    this.updateStrategy = new UpdateExistingNodeImporterStrategy();

    // initialise list of content models to exclude from import
    if (binding == null || binding.getExcludedClasses() == null)
    {
        this.excludedClasses = new QName[] { ContentModel.ASPECT_REFERENCEABLE };
    }
    else
    {
        this.excludedClasses = binding.getExcludedClasses();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ImporterComponent.java

示例2: createUser

import org.alfresco.model.ContentModel; //导入依赖的package包/类
private void createUser(String userName, String password)
{
    if (this.authenticationService.authenticationExists(userName) == false)
    {
        this.authenticationService.createAuthentication(userName, password.toCharArray());
        
        PropertyMap ppOne = new PropertyMap(4);
        ppOne.put(ContentModel.PROP_USERNAME, userName);
        ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName");
        ppOne.put(ContentModel.PROP_LASTNAME, "lastName");
        ppOne.put(ContentModel.PROP_EMAIL, "[email protected]");
        ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle");
        
        this.personService.createPerson(ppOne);
    }        
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:LoginTest.java

示例3: getMLContainerRoot

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/**
 * @return Returns a reference to the node that will hold all the <b>cm:mlContainer</b> nodes.
 */
private NodeRef getMLContainerRoot()
{
    NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    List<ChildAssociationRef> assocRefs = nodeService.getChildAssocs(
            rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QNAME_ASSOC_ML_ROOT);
    if (assocRefs.size() != 1)
    {
        throw new AlfrescoRuntimeException(
                "Unable to find bootstrap location for ML Root using query: " + QNAME_ASSOC_ML_ROOT);
    }
    NodeRef mlRootNodeRef = assocRefs.get(0).getChildRef();
    // Done
    return mlRootNodeRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:MultilingualContentServiceImpl.java

示例4: loginLogoutUser

import org.alfresco.model.ContentModel; //导入依赖的package包/类
private void loginLogoutUser(String username, String password)
{
    // authenticate via the authentication service
    authenticationService.authenticate(username, password.toCharArray());
    
    // set the user name as stored by the back end 
    username = authenticationService.getCurrentUserName();
    
    NodeRef personRef = personService.getPerson(username);
    NodeRef homeSpaceRef = (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER);
    
    // check that the home space node exists - else user cannot login
    if (nodeService.exists(homeSpaceRef) == false)
    {
       throw new InvalidNodeRefException(homeSpaceRef);
    }
    
    // logout
    authenticationService.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:MultiTDemoTest.java

示例5: processWorkingCopy

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/**
 * Determines whether the given node represents a working copy, if it does
 * the name field is searched for and set to protected as the name field
 * should not be edited for a working copy.
 * 
 * If the node is not a working copy this method has no effect.
 * 
 * @param nodeRef NodeRef of node to check and potentially process
 * @param form The generated form
 */
protected void processWorkingCopy(NodeRef nodeRef, Form form)
{
    // if the node is a working copy ensure that the name field (id present)
    // is set to be protected as it can not be edited
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
    {
        // go through fields looking for name field
        for (FieldDefinition fieldDef : form.getFieldDefinitions())
        {
            if (fieldDef.getName().equals(ContentModel.PROP_NAME.toPrefixString(this.namespaceService)))
            {
                fieldDef.setProtectedField(true);
                
                if (getLogger().isDebugEnabled())
                {
                    getLogger().debug("Set " + ContentModel.PROP_NAME.toPrefixString(this.namespaceService) +
                                "field to protected as it is a working copy");
                }
                
                break;
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:NodeFormProcessor.java

示例6: testCheckHidden

import org.alfresco.model.ContentModel; //导入依赖的package包/类
@SuppressWarnings("unused")
@Test
public void testCheckHidden() throws Exception
{
    String nodeName = GUID.generate();

    interceptor.setEnabled(false);

    try
    {
        // Create some nodes that should be hidden but aren't
        NodeRef node = fileFolderService.create(topNodeRef, nodeName, ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node11 = fileFolderService.create(node, nodeName + ".11", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node12 = fileFolderService.create(node, ".12", ContentModel.TYPE_CONTENT).getNodeRef();
        NodeRef node21 = fileFolderService.create(node11, nodeName + ".21", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node22 = fileFolderService.create(node11, nodeName + ".22", ContentModel.TYPE_CONTENT).getNodeRef();
        NodeRef node31 = fileFolderService.create(node21, ".31", ContentModel.TYPE_FOLDER).getNodeRef();
        NodeRef node41 = fileFolderService.create(node31, nodeName + ".41", ContentModel.TYPE_CONTENT).getNodeRef();

        txn.commit();
    }
    finally
    {
        interceptor.setEnabled(true);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:HiddenAspectTest.java

示例7: buildBlogPost

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/**
 * Builds up a {@link BlogPostInfo} object for the given node
 */
private BlogPostInfo buildBlogPost(NodeRef nodeRef, NodeRef parentNodeRef, String postName)
{
   BlogPostInfoImpl post = new BlogPostInfoImpl(nodeRef, parentNodeRef, postName);
   
   // Grab all the properties, we need the bulk of them anyway
   Map<QName,Serializable> props = nodeService.getProperties(nodeRef);

   // Populate them
   post.setTitle((String)props.get(ContentModel.PROP_TITLE));
   // TODO Populate the rest
   
   // Finally set tags
   // TODO
   
   // All done
   return post;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:BlogServiceImpl.java

示例8: getBlogPostList

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/**
 * Fetches all posts of the given blog
 */
private PagingResults<BlogPostInfo> getBlogPostList(SiteInfo site, NodeRef nonSiteContainer, 
      Date fromDate, Date toDate, String tag, PagingRequest pagingReq)
{
    // Currently we only support CannedQuery-based gets without tags:
    if (tag == null || tag.trim().isEmpty())
    {
        return getBlogResultsImpl(site, nonSiteContainer, fromDate, toDate, pagingReq);
    }
    else
    {
        RangedDateProperty dateRange = new RangedDateProperty(fromDate, toDate, ContentModel.PROP_CREATED);  
        if(site != null)
        {
           return blogService.findBlogPosts(site.getShortName(), dateRange, tag, pagingReq);
        }
        else
        {
           return blogService.findBlogPosts(nonSiteContainer, dateRange, tag, pagingReq);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:AbstractGetBlogWebScript.java

示例9: testCreateEmptyTranslation

import org.alfresco.model.ContentModel; //导入依赖的package包/类
@SuppressWarnings("unused")
public void testCreateEmptyTranslation() throws Exception
{
    NodeRef chineseContentNodeRef = createContent("Document.txt");
    multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);

    // This should use the pivot language
    NodeRef emptyNodeRef = multilingualContentService.addEmptyTranslation(chineseContentNodeRef, "Document.txt", Locale.CANADA);

    // Ensure that the empty translation is not null
    assertNotNull("The creation of the empty document failed ", emptyNodeRef);
    // Ensure that the empty translation has the mlDocument aspect
    assertTrue("The empty document must have the mlDocument aspect",
            nodeService.hasAspect(emptyNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
    // Ensure that the empty translation has the mlEmptyTranslation aspect
    assertTrue("The empty document must have the mlEmptyTranslation aspect",
            nodeService.hasAspect(emptyNodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION));
    // Check that the auto renaming worked
    String emptyName = DefaultTypeConverter.INSTANCE.convert(String.class,
            nodeService.getProperty(emptyNodeRef, ContentModel.PROP_NAME));
    assertEquals("Empty auto-rename didn't work for same-named document", "Document_en_CA.txt", emptyName);

    // Check that the content is identical
    ContentData chineseContentData = fileFolderService.getReader(chineseContentNodeRef).getContentData();
    ContentData emptyContentData = fileFolderService.getReader(emptyNodeRef).getContentData();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:MultilingualContentServiceImplTest.java

示例10: searchSimple

import org.alfresco.model.ContentModel; //导入依赖的package包/类
@Override
public NodeRef searchSimple(NodeRef contextNodeRef, String name)
{
    ParameterCheck.mandatory("name", name);
    ParameterCheck.mandatory("contextNodeRef", contextNodeRef);
    
    NodeRef childNodeRef = nodeService.getChildByName(contextNodeRef, ContentModel.ASSOC_CONTAINS, name);
    if (logger.isTraceEnabled())
    {
        logger.trace(
                "Simple name search results: \n" +
                "   parent: " + contextNodeRef + "\n" +
                "   name: " + name + "\n" +
                "   result: " + childNodeRef);
    }
    return childNodeRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:FileFolderServiceImpl.java

示例11: testCreateStore

import org.alfresco.model.ContentModel; //导入依赖的package包/类
public void testCreateStore() throws Exception
{
    StoreRef storeRef = createStore();
    
    // check that it exists
    assertTrue("NodeService reports that store doesn't exist", nodeService.exists(storeRef));
    
    // get the root node
    NodeRef storeRootNode = nodeService.getRootNode(storeRef);
    // make sure that it has the root aspect
    boolean isRoot = nodeService.hasAspect(storeRootNode, ContentModel.ASPECT_ROOT);
    assertTrue("Root node of store does not have root aspect", isRoot);
    // and is of the correct type
    QName rootType = nodeService.getType(storeRootNode);
    assertEquals("Store root node of incorrect type", ContentModel.TYPE_STOREROOT, rootType);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:BaseNodeServiceTest.java

示例12: clearUsage

import org.alfresco.model.ContentModel; //导入依赖的package包/类
private void clearUsage(String userName)
{
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // authenticate as super-admin
    
    // find person
    final NodeRef personNodeRef = personService.getPerson(userName);
    // clear user usage
    nodeService.setProperty(personNodeRef, ContentModel.PROP_SIZE_CURRENT, new Long(-1L));
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            usageService.deleteDeltas(personNodeRef);
            return null;
        }
    }, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:MultiTDemoTest.java

示例13: createFolderNode

import org.alfresco.model.ContentModel; //导入依赖的package包/类
private NodeRef createFolderNode(NodeRef parentFolderNodeRef, String nameValue)
{
    if (nameValue != null)
    {       
        Map<QName, Serializable> folderProps = new HashMap<QName, Serializable>();
        folderProps.put(ContentModel.PROP_NAME, nameValue);
        
        return this.nodeService.createNode(
                parentFolderNodeRef, 
                ContentModel.ASSOC_CONTAINS, 
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nameValue),
                ContentModel.TYPE_FOLDER,
                folderProps).getChildRef();
    }
    
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:MultiTDemoTest.java

示例14: setupTest

import org.alfresco.model.ContentModel; //导入依赖的package包/类
@BeforeClass public static void setupTest() throws Exception
{
	
	SERVICE_REGISTRY          = (ServiceRegistry)APP_CONTEXT_INIT.getApplicationContext().getBean(ServiceRegistry.SERVICE_REGISTRY);
    NODE_SERVICE              = SERVICE_REGISTRY.getNodeService();
    TRANSACTION_HELPER        = SERVICE_REGISTRY.getTransactionService().getRetryingTransactionHelper();
    ACTION_SERVICE			  = SERVICE_REGISTRY.getActionService();
    RULE_SERVICE			  = SERVICE_REGISTRY.getRuleService();
    CONTENT_SERVICE 		  = SERVICE_REGISTRY.getContentService();
    MAIL_ACTION_EXECUTER 		  = APP_CONTEXT_INIT.getApplicationContext().getBean("OutboundSMTP", ApplicationContextFactory.class).getApplicationContext().getBean("mail", MailActionExecuter.class);
    
    WAS_IN_TEST_MODE = MAIL_ACTION_EXECUTER.isTestMode();
    MAIL_ACTION_EXECUTER.setTestMode(true);
    
    Repository repositoryHelper = (Repository) APP_CONTEXT_INIT.getApplicationContext().getBean("repositoryHelper");
    COMPANY_HOME = repositoryHelper.getCompanyHome();
    
    // Create some static test content
    TEST_FOLDER = STATIC_TEST_NODES.createNode(COMPANY_HOME, "testFolder", ContentModel.TYPE_FOLDER, AuthenticationUtil.getAdminUserName());
   
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:RuleServiceIntegrationTest.java

示例15: testExecutionRejectWhenDestinationSameAsSource

import org.alfresco.model.ContentModel; //导入依赖的package包/类
/** Test for MNT-14730*/
public void testExecutionRejectWhenDestinationSameAsSource()
{
    addWorkflowAspect(node, sourceFolder, Boolean.FALSE, Boolean.FALSE);
    
    assertTrue(nodeService.hasAspect(node, ApplicationModel.ASPECT_SIMPLE_WORKFLOW));
    NodeRef pParent = nodeService.getPrimaryParent(node).getParentRef();
    assertEquals(sourceFolder, pParent);
    assertEquals(0, nodeService.getChildAssocs(destinationFolder).size());
    
    ActionImpl action = new ActionImpl(null, ID, "reject-simpleworkflow", null);
    rejectExecuter.execute(action, node);
    
    assertFalse(nodeService.hasAspect(node, ApplicationModel.ASPECT_SIMPLE_WORKFLOW));
    pParent = nodeService.getPrimaryParent(node).getParentRef();
    assertEquals(sourceFolder, pParent);        
    assertEquals(0, nodeService.getChildAssocs(destinationFolder).size());
    
    String copyName = QName.createValidLocalName("Copy of my node.txt");
    NodeRef nodeRef = nodeService.getChildByName(sourceFolder, ContentModel.ASSOC_CONTAINS, copyName);
    assertNotNull(nodeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:TransitionSimpleWorkflowActionExecuterTest.java


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