mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
78403: Merged EOL (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 75700: ACE-2149: EOL AVM / WCM - Remove most of the AVM and WCM beans, scripts, classes, patches, etc - The Explorer client is very broken for compilation - TODO: Remove all WCM-related functionality, which I thought would be best left to a UI dev I've murdered many of the classes and beans but there's more to do - The repository compiles TODO: Get it running again - TODO: Check if we can wipe the 'deployment' project as well git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82540 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,14 +24,11 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||
@@ -41,8 +38,6 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
@@ -65,7 +60,6 @@ public class Repository implements ApplicationContextAware
|
||||
private NodeService nodeService;
|
||||
private FileFolderService fileFolderService;
|
||||
private PersonService personService;
|
||||
private AVMService avmService;
|
||||
|
||||
// company home
|
||||
private StoreRef companyHomeStore; // ie. workspace://SpaceStore
|
||||
@@ -149,14 +143,6 @@ public class Repository implements ApplicationContextAware
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the AVM service
|
||||
*/
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
lifecycle.setApplicationContext(applicationContext);
|
||||
@@ -330,137 +316,93 @@ public class Repository implements ApplicationContextAware
|
||||
* <br/>
|
||||
* Resolve to node via its display path.
|
||||
* <br/>
|
||||
* 3) AVM Path - {store_id}/{path}
|
||||
* <br/>
|
||||
* Resolve to AVM node via its display path
|
||||
* <br/>
|
||||
* 4) QName - {store_type}/{store_id}/{child_qname_path} TODO: Implement
|
||||
* 3) QName - {store_type}/{store_id}/{child_qname_path} TODO: Implement
|
||||
* <br/>
|
||||
* Resolve to node via its child qname path.
|
||||
*
|
||||
* @param referenceType one of node, path, avmpath or qname
|
||||
* @param referenceType one of node, path or qname
|
||||
* @return reference array of reference segments (as described above for each reference type)
|
||||
*/
|
||||
public NodeRef findNodeRef(String referenceType, String[] reference)
|
||||
{
|
||||
NodeRef nodeRef = null;
|
||||
|
||||
if (referenceType.equals("avmpath"))
|
||||
// construct store reference
|
||||
if (reference.length < 3)
|
||||
{
|
||||
if (reference.length == 0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Reference " + Arrays.toString(reference) + " is not properly formed");
|
||||
}
|
||||
String path = reference[0] + ":/";
|
||||
if (reference.length > 1)
|
||||
{
|
||||
Object[] pathElements = ArrayUtils.subarray(reference, 1, reference.length);
|
||||
path += StringUtils.join(pathElements, "/");
|
||||
}
|
||||
AVMNodeDescriptor nodeDesc = avmService.lookup(-1, path);
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
|
||||
}
|
||||
throw new AlfrescoRuntimeException("Reference " + Arrays.toString(reference) + " is not properly formed");
|
||||
}
|
||||
else
|
||||
StoreRef storeRef = new StoreRef(reference[0], reference[1]);
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
// construct store reference
|
||||
if (reference.length < 3)
|
||||
if (referenceType.equals("node"))
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Reference " + Arrays.toString(reference) + " is not properly formed");
|
||||
}
|
||||
StoreRef storeRef = new StoreRef(reference[0], reference[1]);
|
||||
if (nodeService.exists(storeRef))
|
||||
{
|
||||
if (referenceType.equals("node"))
|
||||
// find the node the rest of the path is relative to
|
||||
NodeRef relRef = new NodeRef(storeRef, reference[2]);
|
||||
if (nodeService.exists(relRef))
|
||||
{
|
||||
// find the node the rest of the path is relative to
|
||||
NodeRef relRef = new NodeRef(storeRef, reference[2]);
|
||||
if (nodeService.exists(relRef))
|
||||
// are there any relative path elements to process?
|
||||
if (reference.length == 3 || reference.length == 4)
|
||||
{
|
||||
// are there any relative path elements to process?
|
||||
if (reference.length == 3 || reference.length == 4)
|
||||
{
|
||||
// just the NodeRef can be specified
|
||||
nodeRef = relRef;
|
||||
}
|
||||
else
|
||||
{
|
||||
// process optional path elements
|
||||
List<String> paths = new ArrayList<String>(reference.length - 3);
|
||||
for (int i=3; i<reference.length; i++)
|
||||
{
|
||||
paths.add(reference[i]);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
NodeRef parentRef = nodeService.getPrimaryParent(relRef).getParentRef();
|
||||
FileInfo fileInfo = fileFolderService.resolveNamePath(parentRef, paths);
|
||||
nodeRef = fileInfo.getNodeRef();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// NOTE: return null node ref
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (referenceType.equals("path"))
|
||||
{
|
||||
// NOTE: special case for avm based path
|
||||
if (reference[0].equals(StoreRef.PROTOCOL_AVM))
|
||||
{
|
||||
String path = reference[1] + ":/";
|
||||
if (reference.length > 2)
|
||||
{
|
||||
Object[] pathElements = ArrayUtils.subarray(reference, 2, reference.length);
|
||||
path += StringUtils.join(pathElements, "/");
|
||||
}
|
||||
AVMNodeDescriptor nodeDesc = avmService.lookup(-1, path);
|
||||
if (nodeDesc != null)
|
||||
{
|
||||
nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
|
||||
}
|
||||
// just the NodeRef can be specified
|
||||
nodeRef = relRef;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Allow a root path to be specified - for now, hard-code to Company Home
|
||||
//NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
NodeRef rootNodeRef = getCompanyHome();
|
||||
if (reference.length == 3)
|
||||
// process optional path elements
|
||||
List<String> paths = new ArrayList<String>(reference.length - 3);
|
||||
for (int i=3; i<reference.length; i++)
|
||||
{
|
||||
if (reference[2].equals(nodeService.getPrimaryParent(rootNodeRef).getQName().toPrefixString(namespaceService)))
|
||||
{
|
||||
nodeRef = rootNodeRef;
|
||||
}
|
||||
paths.add(reference[i]);
|
||||
}
|
||||
else
|
||||
|
||||
try
|
||||
{
|
||||
String[] path = new String[reference.length - /*2*/3];
|
||||
System.arraycopy(reference, /*2*/3, path, 0, path.length);
|
||||
|
||||
try
|
||||
{
|
||||
FileInfo fileInfo = fileFolderService.resolveNamePath(rootNodeRef, Arrays.asList(path));
|
||||
nodeRef = fileInfo.getNodeRef();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// NOTE: return null node ref
|
||||
}
|
||||
NodeRef parentRef = nodeService.getPrimaryParent(relRef).getParentRef();
|
||||
FileInfo fileInfo = fileFolderService.resolveNamePath(parentRef, paths);
|
||||
nodeRef = fileInfo.getNodeRef();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// NOTE: return null node ref
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (referenceType.equals("path"))
|
||||
{
|
||||
// TODO: Allow a root path to be specified - for now, hard-code to Company Home
|
||||
//NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
NodeRef rootNodeRef = getCompanyHome();
|
||||
if (reference.length == 3)
|
||||
{
|
||||
if (reference[2].equals(nodeService.getPrimaryParent(rootNodeRef).getQName().toPrefixString(namespaceService)))
|
||||
{
|
||||
nodeRef = rootNodeRef;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Implement 'qname' style
|
||||
throw new AlfrescoRuntimeException("Web Script Node URL specified an invalid reference style of '" + referenceType + "'");
|
||||
String[] path = new String[reference.length - /*2*/3];
|
||||
System.arraycopy(reference, /*2*/3, path, 0, path.length);
|
||||
|
||||
try
|
||||
{
|
||||
FileInfo fileInfo = fileFolderService.resolveNamePath(rootNodeRef, Arrays.asList(path));
|
||||
nodeRef = fileInfo.getNodeRef();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// NOTE: return null node ref
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// TODO: Implement 'qname' style
|
||||
throw new AlfrescoRuntimeException("Web Script Node URL specified an invalid reference style of '" + referenceType + "'");
|
||||
}
|
||||
}
|
||||
|
||||
return nodeRef;
|
||||
|
@@ -79,8 +79,7 @@ public class MLContentInterceptor implements MethodInterceptor
|
||||
NodeRef nodeRef = (NodeRef) args[0];
|
||||
|
||||
// Shortcut it if the node is not an empty translation
|
||||
if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM) ||
|
||||
!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
{
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
Reference in New Issue
Block a user