Java Code Examples for org.alfresco.service.cmr.repository.StoreRef#getIdentifier()

The following examples show how to use org.alfresco.service.cmr.repository.StoreRef#getIdentifier() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamContent.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
ObjectReference(StoreRef ref, String id)
{
    String[] relativePath = id.split("/");

    // bug fix MNT-16380
    // for using a relative path to a node id eg. 18cc-.../folder1/.../folderN/fileA.txt
    // if only one slash we don't have a relative path
    if (relativePath.length <= 2)
    {
        if (id.indexOf('/') != -1)
        {
            id = id.substring(0, id.indexOf('/'));
        }
        this.ref = new NodeRef(ref, id);
    }
    else
    {
        String[] reference = new String[relativePath.length + 2];
        reference[0] = ref.getProtocol();
        reference[1] = ref.getIdentifier();
        System.arraycopy(relativePath, 0, reference, 2, relativePath.length);
        this.ref = repository.findNodeRef("node", reference);
    }
}
 
Example 2
Source File: RepositoryLocation.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param storeRef       the store reference (e.g. 'workspace://SpacesStore' )
 * @param path           the path (e.g. '/app:company_home/app:dictionary/app:models' )
 * @param queryLanguage  the query language (e.g. 'xpath' or 'lucence')
 */
public RepositoryLocation(StoreRef storeRef, String path, String queryLanguage)
{
    this.storeProtocol = storeRef.getProtocol();
    this.storeId = storeRef.getIdentifier();
    this.path = path;
    
    setQueryLanguage(queryLanguage);
}
 
Example 3
Source File: PlainStringifier.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String stringifyRepositoryLocation(RepositoryNodeRef repositoryNodeRef) throws ReferenceEncodingException
{
    NodeRef nodeRef = repositoryNodeRef.getNodeRef();
    StoreRef storeRef = nodeRef.getStoreRef();

    return NODE + DELIMITER + storeRef.getProtocol() + DELIMITER + storeRef.getIdentifier() + DELIMITER
                + nodeRef.getId();
}
 
Example 4
Source File: NodeProtocol.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Reference propagateNodeRefMutations(NodeRef mutatedNodeRef, Reference reference)
{
    StoreRef storeRef = mutatedNodeRef.getStoreRef();
    String storeId = storeRef.getIdentifier();
    String protocol = storeRef.getProtocol();

    if (Version2Model.STORE_ID.equals(storeId) || VersionModel.STORE_ID.equals(storeId)
                || VersionBaseModel.STORE_PROTOCOL.equals(protocol))
    {
        Resource resource = reference.getResource();
        if (resource instanceof RepositoryResource)
        {
            RepositoryResource repositoryResource = (RepositoryResource) resource;
            RepositoryLocation location = repositoryResource.getLocation();
            if (location instanceof RepositoryNodeRef)
            {
                RepositoryNodeRef repositoryNodeRef = (RepositoryNodeRef) location;
                NodeRef nodeRef = repositoryNodeRef.getNodeRef();
                NodeRef nodeRefPropagation = new NodeRef(mutatedNodeRef.getStoreRef(),
                                                         nodeRef.getId());
                Resource resourcePropagation = new RepositoryResource(new RepositoryNodeRef(nodeRefPropagation));

                return new Reference(reference.getEncoding(),
                                     reference.getProtocol(),
                                     resourcePropagation,
                                     reference.getParameters());
            }
        }
    }

    // default branch

    return reference;
}
 
Example 5
Source File: StreamContent.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
ObjectReference(StoreRef ref, String[] path)
{
    String[] reference = new String[path.length + 2];
    reference[0] = ref.getProtocol();
    reference[1] = ref.getIdentifier();
    System.arraycopy(path, 0, reference, 2, path.length);
    this.ref = repository.findNodeRef("path", reference);
}
 
Example 6
Source File: MultiTenantShareMapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Create a tenant domain specific share
 */
private final DiskSharedDevice createTenantShare(String tenantDomain)
{
    logger.debug("create tenant share for domain " + tenantDomain);
       StoreRef storeRef = new StoreRef(getStoreName());
       NodeRef rootNodeRef = new NodeRef(storeRef.getProtocol(), storeRef.getIdentifier(), "dummy"); 
       
       // Root nodeRef is required for storeRef part
       
       rootNodeRef = m_alfrescoConfig.getTenantService().getRootNode(
               m_alfrescoConfig.getNodeService(), 
               m_alfrescoConfig.getSearchService(),
       		m_alfrescoConfig.getNamespaceService(), 
       		getRootPath(), 
       		rootNodeRef);

       //  Create the disk driver and context

       DiskInterface diskDrv = getRepoDiskInterface();
       ContentContext diskCtx = new ContentContext(m_tenantShareName, getStoreName(), getRootPath(), rootNodeRef);
       
       // Set a quota manager for the share, if enabled
       
       if ( m_quotaManager != null)
       {
       	diskCtx.setQuotaManager( m_quotaManager);
       }
       
       if(m_config instanceof ServerConfigurationBean)
       {
           ServerConfigurationBean config = (ServerConfigurationBean)m_config;
           
           config.initialiseRuntimeContext("cifs.tenant." + tenantDomain, diskCtx);
       }
       else
       {
           throw new AlfrescoRuntimeException("configuration error, unknown configuration bean");
       }
       
       //  Default the filesystem to look like an 80Gb sized disk with 90% free space

       diskCtx.setDiskInformation(new SrvDiskInfo(2560, 64, 512, 2304));

       //  Create a temporary shared device for the user to access the tenant company home directory

       return new DiskSharedDevice(m_tenantShareName, diskDrv, diskCtx);
}
 
Example 7
Source File: VersionUtil.java    From alfresco-repository with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Create Version Store Ref
 * 
 * @param  storeRef ref
 * @return  store ref for version store
 */
public static StoreRef convertStoreRef(StoreRef storeRef)
{
    return new StoreRef(StoreRef.PROTOCOL_WORKSPACE, storeRef.getIdentifier());
}