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


Java QName.toString方法代碼示例

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


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

示例1: getSystemContainer

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Return the system container for the specified assoc name.
 * The containers are cached in a thread safe Tenant aware cache.
 *
 * @return System container, <b>which must exist</b>
 */
private NodeRef getSystemContainer(QName assocQName)
{
    final String cacheKey = KEY_SYSTEMCONTAINER_NODEREF + "." + assocQName.toString();
    NodeRef systemContainerRef = (NodeRef)singletonCache.get(cacheKey);
    if (systemContainerRef == null)
    {
        NodeRef rootNodeRef = nodeService.getRootNode(this.storeRef);
        List<ChildAssociationRef> results = nodeService.getChildAssocs(rootNodeRef, RegexQNamePattern.MATCH_ALL, qnameAssocSystem, false);
        if (results.size() == 0)
        {
            throw new AlfrescoRuntimeException("Required system path not found: " + qnameAssocSystem);
        }
        NodeRef sysNodeRef = results.get(0).getChildRef();
        results = nodeService.getChildAssocs(sysNodeRef, RegexQNamePattern.MATCH_ALL, assocQName, false);
        if (results.size() == 0)
        {
            throw new AlfrescoRuntimeException("Required path not found: " + assocQName);
        }
        systemContainerRef = results.get(0).getChildRef();
        singletonCache.put(cacheKey, systemContainerRef);
    }
    return systemContainerRef;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:AuthorityDAOImpl.java

示例2: getElementQName

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
public String getElementQName(Object o)
{
    QName qName = ((ChildAssociationRef) o).getQName();
    if(qName == null)
    {
        return "";
    }
    String escapedLocalName = ISO9075.encode(qName.getLocalName());
    if (EqualsHelper.nullSafeEquals(escapedLocalName, qName.getLocalName()))        
    {
        return qName.toString();
    }
    else
    {
        return QName.createQName(qName.getNamespaceURI(), escapedLocalName).toString();
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:DocumentNavigator.java

示例3: nameToString

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Convert a qname to a string - either full or short prefixed named.
 * 
 * @param qname QName
 * @param isShortName boolean
 * @return qname string.
 */
private String nameToString(final QName qname, final boolean isShortName)
{
    String result;
    if (isShortName)
    {
        final Map<String, String> cache = namespacePrefixCache.get();
        String prefix = cache.get(qname.getNamespaceURI());
        if (prefix == null)
        {
            // first request for this namespace prefix, get and cache result
            Collection<String> prefixes = this.namespaceService.getPrefixes(qname.getNamespaceURI());
            prefix = prefixes.size() != 0 ? prefixes.iterator().next() : "";
            cache.put(qname.getNamespaceURI(), prefix);
        }
        result = prefix + QName.NAMESPACE_PREFIX + qname.getLocalName();
    }
    else
    {
        result = qname.toString();
    }
    return result;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:JSONConversionComponent.java

示例4: recordNodeRefsForRepointing

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Helper method to transactionally record <code>NodeRef</code> properties so that they
 * can later be fixed up to point to the relative, after-copy locations.
 * <p>
 * When the copy has been completed, the second stage of the process can be applied.
 * 
 * @param sourceNodeRef             the node that is being copied
 * @param properties                the node properties being copied
 * @param propertyQName             the qualified name of the property to check
 * 
 * @see #repointNodeRefs(NodeRef, NodeRef, QName, Map, NodeService)
 */
public void recordNodeRefsForRepointing(
        NodeRef sourceNodeRef,
        Map<QName, Serializable> properties,
        QName propertyQName)
{
    Serializable parameterValue = properties.get(propertyQName);
    if (parameterValue != null &&
            (parameterValue instanceof Collection<?> || parameterValue instanceof NodeRef))
    {
        String key = KEY_NODEREF_REPOINTING_PREFIX + propertyQName.toString();
        // Store it for later
        Map<NodeRef, Serializable> map = TransactionalResourceHelper.getMap(key);
        map.put(sourceNodeRef, parameterValue);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:28,代碼來源:AbstractCopyBehaviourCallback.java

示例5: getLuceneQueryStatement

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Get the Lucene query statement for models, based on the path
 *
 * @return  the Lucene query statement
 */
public String getLuceneQueryStatement(QName contentModelType)
{
    String result = "+TYPE:\"" + contentModelType.toString() + "\"";
    
    if ((this.path != null) && (! this.path.equals("")))
    {
        result += " +PATH:\"" + this.path + "\"";
    }
   
    return result;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:RepositoryLocation.java

示例6: getCustomProperties

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Get a map of the sites custom properties
 * 
 * @return map of names and values
 */
public ScriptableQNameMap<String, CustomProperty> getCustomProperties()
{
    if (this.customProperties == null)
    {
        // create the custom properties map
        ScriptNode siteNode = new ScriptNode(this.siteInfo.getNodeRef(), this.serviceRegistry);
        // set the scope, for use when converting props to javascript objects
        siteNode.setScope(scope);
        this.customProperties = new ContentAwareScriptableQNameMap<String, CustomProperty>(siteNode, this.serviceRegistry);
        
        Map<QName, Serializable> props = siteInfo.getCustomProperties();
        for (QName qname : props.keySet())
        {
            // get the property value
            Serializable propValue = props.get(qname);
            
            // convert the value
            NodeValueConverter valueConverter = siteNode.new NodeValueConverter();
            Serializable value = valueConverter.convertValueForScript(qname, propValue);
            
            // get the type and label information from the dictionary
            String title = null;
            String type = null;
            PropertyDefinition propDef = this.serviceRegistry.getDictionaryService().getProperty(qname);
            if (propDef != null)
            {
                type = propDef.getDataType().getName().toString();
                title = propDef.getTitle(this.serviceRegistry.getDictionaryService());
            }
            
            // create the custom property and add to the map
            CustomProperty customProp = new CustomProperty(qname.toString(), value, type, title);
            this.customProperties.put(qname.toString(), customProp);
        }
    }
    return this.customProperties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:43,代碼來源:Site.java

示例7: invokeCalculateVersionLabel

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Invoke the calculate version label policy behaviour
 * 
 * @param classRef QName
 * @param preceedingVersion Version
 * @param versionNumber int
 * @return String
 */
protected String invokeCalculateVersionLabel(
		QName classRef,
		Version preceedingVersion, 
		int versionNumber, 
		Map<String, Serializable>versionProperties)
{
	String versionLabel = null;
	
	Collection<CalculateVersionLabelPolicy> behaviours = this.calculateVersionLabelDelegate.getList(classRef);
	if (behaviours.size() == 0)
	{
           // Default the version label to the SerialVersionLabelPolicy
           SerialVersionLabelPolicy defaultVersionLabelPolicy = new SerialVersionLabelPolicy();
           versionLabel = defaultVersionLabelPolicy.calculateVersionLabel(classRef, preceedingVersion, versionNumber, versionProperties);
	}
	else if (behaviours.size() == 1)
	{
		// Call the policy behaviour
		CalculateVersionLabelPolicy[] arr = behaviours.toArray(new CalculateVersionLabelPolicy[]{});
		versionLabel = arr[0].calculateVersionLabel(classRef, preceedingVersion, versionNumber, versionProperties);
	}
	else
	{
		// Error since we can only deal with a single caculate version label policy
		throw new VersionServiceException("More than one CalculateVersionLabelPolicy behaviour has been registered for the type " + classRef.toString());
	}
	
	return versionLabel;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:38,代碼來源:AbstractVersionServiceImpl.java

示例8: getAttributeQName

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
public String getAttributeQName(Object o)
{
    QName qName = ((Property) o).qname;
    String escapedLocalName = ISO9075.encode(qName.getLocalName());
    if (EqualsHelper.nullSafeEquals(escapedLocalName, qName.getLocalName()))        
    {
        return qName.toString();
    }
    else
    {
        return QName.createQName(qName.getNamespaceURI(), escapedLocalName).toString();
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:14,代碼來源:DocumentNavigator.java

示例9: convertQNameToName

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
public static String convertQNameToName(QName name, NamespacePrefixResolver prefixResolver)
{
    // NOTE: Map names using old conversion scheme (i.e. : -> _) as well as new scheme (i.e. } -> _)
    String nameStr = name.toPrefixString(prefixResolver);
    if (nameStr.indexOf('_') != -1 && nameStr.indexOf('_') < nameStr.indexOf(':'))
    {
        // Return full QName string.
        return name.toString();
    }
    // Return prefixed QName string.
    return nameStr.replace(':', '_');
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:WorkflowQNameConverter.java

示例10: getTypePropertyNames

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Return all the property names defined for this node's type as an array.
 * 
 * @param useShortQNames if true short-form qnames will be returned, else long-form.
 * @return Array of property names for this node's type.
 */
public Scriptable getTypePropertyNames(boolean useShortQNames)
{
    Set<QName> props = this.services.getDictionaryService().getClass(this.getQNameType()).getProperties().keySet();
    Object[] result = new Object[props.size()];
    int count = 0;
    for (QName qname : props)
    {
        result[count++] = useShortQNames ? getShortQName(qname).toString() : qname.toString();
    }
    return Context.getCurrentContext().newArray(this.scope, result);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ScriptNode.java

示例11: getPropertyNames

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Return all the property names defined for this node as an array.
 * 
 * @param useShortQNames if true short-form qnames will be returned, else long-form.
 * @return Array of property names for this node type and optionally parent properties.
 */
public Scriptable getPropertyNames(boolean useShortQNames)
{
    Set<QName> props = this.nodeService.getProperties(this.nodeRef).keySet();
    Object[] result = new Object[props.size()];
    int count = 0;
    for (QName qname : props)
    {
        result[count++] = useShortQNames ? getShortQName(qname).toString() : qname.toString();
    }
    return Context.getCurrentContext().newArray(this.scope, result);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ScriptNode.java

示例12: getAspects

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * @return The array of aspects applied to this node as fully qualified qname strings
 */
public Scriptable getAspects()
{
    Set<QName> aspects = getAspectsSet();
    Object[] result = new Object[aspects.size()];
    int count = 0;
    for (QName qname : aspects)
    {
        result[count++] = qname.toString();
    }
    return Context.getCurrentContext().newArray(this.scope, result);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:15,代碼來源:ScriptNode.java

示例13: getLongNameWithEscapedBraces

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Given a QName this method returns the long-form String with the braces
 * escaped.
 */
private String getLongNameWithEscapedBraces(QName qn)
{
    String longName = qn.toString();
    String escapedBraces = longName.replace("{", "\\{").replace("}", "\\}");
    return escapedBraces;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:11,代碼來源:RenditionServiceIntegrationTest.java

示例14: streamContent

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
/**
 * Streams the content on a given node's content property to the response of the web script.
 *
 * @param req            Request
 * @param res            Response
 * @param nodeRef        The node reference
 * @param propertyQName  The content property name
 * @param attach         Indicates whether the content should be streamed as an attachment or not
 * @param attachFileName Optional file name to use when attach is <code>true</code>
 * @throws IOException
 */
public void streamContent(WebScriptRequest req,
            WebScriptResponse res,
            NodeRef nodeRef,
            QName propertyQName,
            boolean attach,
            String attachFileName,
            Map<String, Object> model) throws IOException
{
    if (logger.isDebugEnabled())
        logger.debug("Retrieving content from node ref " + nodeRef.toString() + " (property: " + propertyQName.toString() + ") (attach: " + attach + ")");

    // TODO
    // This was commented out to accomadate records management permissions.  We need to review how we cope with this
    // hard coded permission checked.

    // check that the user has at least READ_CONTENT access - else redirect to the login page
    //        if (permissionService.hasPermission(nodeRef, PermissionService.READ_CONTENT) == AccessStatus.DENIED)
    //        {
    //            throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Permission denied");
    //        }

    // check If-Modified-Since header and set Last-Modified header as appropriate
    Date modified = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
    if (modified != null)
    {
        long modifiedSince = -1;
        String modifiedSinceStr = req.getHeader("If-Modified-Since");
        if (modifiedSinceStr != null)
        {
            try
            {
                modifiedSince = dateFormat.parse(modifiedSinceStr).getTime();
            }
            catch (Throwable e)
            {
                if (logger.isInfoEnabled())
                    logger.info("Browser sent badly-formatted If-Modified-Since header: " + modifiedSinceStr);
            }

            if (modifiedSince > 0L)
            {
                // round the date to the ignore millisecond value which is not supplied by header
                long modDate = (modified.getTime() / 1000L) * 1000L;
                if (modDate <= modifiedSince)
                {
                    res.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                    return;
                }
            }
        }
    }

    // get the content reader
    ContentReader reader = contentService.getReader(nodeRef, propertyQName);
    if (reader == null || !reader.exists())
    {
        throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to locate content for node ref " + nodeRef + " (property: " + propertyQName.toString() + ")");
    }

    // Stream the content
    streamContentImpl(req, res, reader, nodeRef, propertyQName, attach, modified, modified == null ? null : Long.toString(modified.getTime()), attachFileName, model);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:74,代碼來源:ContentStreamer.java

示例15: formatQName

import org.alfresco.service.namespace.QName; //導入方法依賴的package包/類
private String formatQName(QName qname)
{
    return qname.toString();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:5,代碼來源:XMLTransferManifestWriter.java


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