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


Java QName類代碼示例

本文整理匯總了Java中org.alfresco.service.namespace.QName的典型用法代碼示例。如果您正苦於以下問題:Java QName類的具體用法?Java QName怎麽用?Java QName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: setTaskOwner

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * @param task Task
 * @param properties Map<QName, Serializable>
 */
private void setTaskOwner(Task task, Map<QName, Serializable> properties)
{
    QName ownerKey = ContentModel.PROP_OWNER;
    if (properties.containsKey(ownerKey))
    {
        Serializable owner = properties.get(ownerKey);
        if (owner != null && !(owner instanceof String))
        {
            throw getInvalidPropertyValueException(ownerKey, owner);
        }
        String assignee = (String) owner;
        String currentAssignee = task.getAssignee();
        // Only set the assignee if the value has changes to prevent
        // triggering assignementhandlers when not needed
        if (ObjectUtils.equals(currentAssignee, assignee)==false)
        {
            activitiUtil.getTaskService().setAssignee(task.getId(), assignee);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:ActivitiPropertyConverter.java

示例2: init

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
public void init()
{
    policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"), ContentModel.TYPE_BASE, new JavaBehaviour(this, "onMoveNode"));
    
    policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), ContentModel.TYPE_AUTHORITY_CONTAINER, new JavaBehaviour(this, "onCreateChildAssociation"));
    policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteChildAssociation"), ContentModel.TYPE_AUTHORITY_CONTAINER, new JavaBehaviour(this, "beforeDeleteChildAssociation"));
    
    onGrantLocalPermissionDelegate = policyComponent.registerClassPolicy(PermissionServicePolicies.OnGrantLocalPermission.class);
    onRevokeLocalPermissionDelegate = policyComponent.registerClassPolicy(PermissionServicePolicies.OnRevokeLocalPermission.class);
    onInheritPermissionsEnabledDelegate = policyComponent.registerClassPolicy(PermissionServicePolicies.OnInheritPermissionsEnabled.class);
    onInheritPermissionsDisabledDelegate = policyComponent.registerClassPolicy(PermissionServicePolicies.OnInheritPermissionsDisabled.class);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:PermissionServiceImpl.java

示例3: addProperty

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Add a property 
 * 
 * @param classRef  the class reference
 * @param qName		the qualified name of the property
 * @param value		the value of the property
 */
public void addProperty(QName classRef, QName qName, Serializable value) 
{
	if (classRef.equals(this.classRef) == true)
	{
		addProperty(qName, value);
	}
	else
	{
		AspectDetails aspectDetails = this.aspectCopyDetails.get(classRef);
		if (aspectDetails == null)
		{
			// Add the aspect
			aspectDetails = addAspect(classRef);
		}
		aspectDetails.addProperty(qName, value);
	}
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:PolicyScope.java

示例4: serializeCredentials

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Serializes the given {@link BaseCredentialsInfo} object to node properties.
 * 
 * @param info The Credentials object to serialize
 * @return The final set of properties to be serialized for the node
 */
public Map<QName,Serializable> serializeCredentials(BaseCredentialsInfo info)
{
    if (! (info instanceof PasswordCredentialsInfo))
    {
        throw new IllegalStateException("Incorrect registration, info must be a PasswordCredentialsInfo");
    }
    
    // Encrypt the password
    PasswordCredentialsInfo credentials = (PasswordCredentialsInfo)info;
    Serializable passwordEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_REMOTE_PASSWORD, credentials.getRemotePassword());

    // Store our specific types and return
    Map<QName,Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(RemoteCredentialsModel.PROP_REMOTE_PASSWORD, passwordEncrypted);
    return properties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:PasswordCredentialsFactory.java

示例5: invokeBeforeLock

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Invoke the before log policy
 * 
 * @param nodeRef       the node to be locked
 * @param lockType      the lock type
 */
private void invokeBeforeLock(
        NodeRef nodeRef,
        LockType lockType)
{
    if (!nodeService.exists(nodeRef))
    {
        return;
    }
    List<QName> classes = getInvokeClasses(nodeRef);
    for (QName invokeClass : classes)
    {            
        Collection<BeforeLock> policies = beforeLock.getList(invokeClass);
        for (BeforeLock policy : policies) 
        {
            policy.beforeLock(nodeRef, lockType);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:LockServiceImpl.java

示例6: createUser

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
private static void createUser(TestPerson testPerson)
{
    if (authenticationService.authenticationExists(testPerson.userName))
    {
        return;
    }
    authenticationService.createAuthentication(testPerson.userName, testPerson.password.toCharArray());

    Map<QName, Serializable> map = new HashMap<>(4);
    map.put(ContentModel.PROP_USERNAME, testPerson.userName);
    map.put(ContentModel.PROP_FIRSTNAME, testPerson.firstName);
    map.put(ContentModel.PROP_LASTNAME, testPerson.lastName);
    map.put(ContentModel.PROP_EMAIL, testPerson.email);

    personService.createPerson(map);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:ResetPasswordServiceImplTest.java

示例7: testAddProperties

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
public void testAddProperties() throws Exception
{
    Map<QName, Serializable> properties = nodeService.getProperties(rootNodeRef);
    // Add an aspect with a default value
    nodeService.addAspect(rootNodeRef, ASPECT_QNAME_TEST_TITLED, null);
    assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_TITLE));
    assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_DESCRIPTION));
    
    // Now add a map of two properties and check
    Map<QName, Serializable> addProperties = new HashMap<QName, Serializable>(11);
    addProperties.put(PROP_QNAME_TEST_TITLE, "Title");
    addProperties.put(PROP_QNAME_TEST_DESCRIPTION, "Description");
    nodeService.addProperties(rootNodeRef, addProperties);
    
    // Check
    Map<QName, Serializable> checkProperties = nodeService.getProperties(rootNodeRef);
    assertEquals("Title", checkProperties.get(PROP_QNAME_TEST_TITLE));
    assertEquals("Description", checkProperties.get(PROP_QNAME_TEST_DESCRIPTION));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:20,代碼來源:BaseNodeServiceTest.java

示例8: createBlogDetails

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Create a BlogDetails object from a node that has the blogDetails aspect applied.
 * 
 * @param nodeService   the node service
 * @param nodeRef       the node reference
 * @return BlogDetails  the blog details 
 */
public static BlogDetails createBlogDetails(NodeService nodeService, NodeRef nodeRef)
{
    // Check for the blog details aspect
    if (nodeService.hasAspect(nodeRef, ASPECT_BLOG_DETAILS) == false)
    {
        throw new BlogIntegrationRuntimeException("Can not create blog details object since node does not have blogDetails aspect.");
    }
    
    // Get the blog details
    Map<QName, Serializable> props = nodeService.getProperties(nodeRef);
    return new BlogDetails(
            (String)props.get(PROP_BLOG_IMPLEMENTATION),
            (String)props.get(PROP_ID),
            (String)props.get(PROP_URL),
            (String)props.get(PROP_USER_NAME),
            (String)props.get(PROP_PASSWORD),
            (String)props.get(PROP_NAME),
            (String)props.get(PROP_DESCRIPTION),
            nodeRef);        
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:28,代碼來源:BlogDetails.java

示例9: getQNameCrc

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Find a CRC value for the full QName using UTF-8 conversion.
 * 
 * @param qname                 the association qname
 * @return                      Returns the CRC value (UTF-8 compatible)
 */
public static Long getQNameCrc(QName qname)
{
    CRC32 crc = new CRC32();
    try
    {
        crc.update(qname.getNamespaceURI().getBytes("UTF-8"));
        crc.update(qname.getLocalName().getBytes("UTF-8"));
    }
    catch (UnsupportedEncodingException e)
    {
        throw new RuntimeException("UTF-8 encoding is not supported");
    }
    return crc.getValue();
    
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:22,代碼來源:ChildAssocEntity.java

示例10: setDefaultRenditionNodeType

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Sets the default rendition-node type.
 * 
 * @param type String
 */
public void setDefaultRenditionNodeType(String type)
{
    QName qname;
    try
    {
        qname = QName.createQName(type);
    }
    catch (NamespaceException nx)
    {
        if (logger.isErrorEnabled())
        {
            logger.error("Error when setting default rendition node type: ", nx);
        }
        throw nx;
    }

    if (logger.isInfoEnabled())
    {
        logger.info("Using default rendition node type: " + qname);
    }
    this.defaultRenditionNodeType = qname;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:28,代碼來源:AbstractRenderingEngine.java

示例11: testHasAspectEphemeralLock

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
@Test
public void testHasAspectEphemeralLock()
{
    QName nodeName = QName.createQName("http://www.alfresco.org/test/" + getClass().getSimpleName(), "testNode");
    NodeRef nodeRef = nodeService.createNode(
                rootNode,
                ContentModel.ASSOC_CHILDREN,
                nodeName,
                ContentModel.TYPE_BASE).getChildRef();
    
    assertFalse("Node should not be reported as lockable",
                nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE));
    
    lockStore.set(nodeRef, LockState.createLock(nodeRef, LockType.WRITE_LOCK, lockOwner, null, Lifetime.EPHEMERAL, null));
    
    assertTrue("Node should be reported as lockable",
                nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:19,代碼來源:LockableAspectInterceptorTest.java

示例12: onMoveNode

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * Deny renames.
 */
public void onMoveNode(ChildAssociationRef oldChildAssocRef,
      ChildAssociationRef newChildAssocRef) 
{
   NodeRef oldParent = oldChildAssocRef.getParentRef();
   NodeRef newParent = newChildAssocRef.getParentRef();
   
   // Deny renames
   if (oldParent.equals(newParent))
   {
       QName type = nodeService.getType((oldChildAssocRef.getChildRef()));
       if (dictionaryService.isSubClass(type, SiteModel.TYPE_SITE))
       {
           throw new SiteServiceException("Sites can not be renamed.");
       }
       else
       {
           throw new SiteServiceException("Site containers can not be renamed.");
       }
   }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:SiteAspect.java

示例13: testRequiredPermissions

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
public void testRequiredPermissions()
{
    Set<PermissionReference> required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base",
            namespacePrefixResolver), "Read"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(3, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "ReadContent"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(1, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "_ReadContent"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(0, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("cm", "cmobject", namespacePrefixResolver),
            "Coordinator"), QName.createQName("cm", "cmobject", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(17, required.size());

    required = permissionModelDAO.getRequiredPermissions(SimplePermissionReference.getPermissionReference(QName.createQName("sys", "base", namespacePrefixResolver),
            "FullControl"), QName.createQName("sys", "base", namespacePrefixResolver), Collections.<QName> emptySet(), On.NODE);
    assertEquals(17, required.size());

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:PermissionModelTest.java

示例14: testFileSpecificMetadata

import org.alfresco.service.namespace.QName; //導入依賴的package包/類
/**
 * We also provide the creation date - check that
 */
protected void testFileSpecificMetadata(String mimetype,
      Map<QName, Serializable> properties) 
{
   // Check for extra fields
   assertEquals(
         "Property " + ContentModel.PROP_AUTHOR + " not found for mimetype " + mimetype,
         "Nevin Nollop",
         DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_AUTHOR)));
   
   // Ensure that we can also get things which are standard
   //  Tika metadata properties, if we so choose to
   assertTrue( 
         "Test Property " + TIKA_LAST_AUTHOR_TEST_PROPERTY + " not found for mimetype " + mimetype,
         properties.containsKey(TIKA_LAST_AUTHOR_TEST_PROPERTY)
   );
   assertEquals(
         "Test Property " + TIKA_LAST_AUTHOR_TEST_PROPERTY + " incorrect for mimetype " + mimetype,
         "paolon",
         DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(TIKA_LAST_AUTHOR_TEST_PROPERTY)));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:DWGMetadataExtracterTest.java

示例15: createFolderNode

import org.alfresco.service.namespace.QName; //導入依賴的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


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