mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
The Node Browser in the UI can now navigate AVM stores.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3553 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -57,6 +57,9 @@
|
|||||||
<property name="storeArchiveMap">
|
<property name="storeArchiveMap">
|
||||||
<ref bean="storeArchiveMap"/>
|
<ref bean="storeArchiveMap"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="avmNodeService">
|
||||||
|
<ref bean="avmNodeService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- AVMNodeService -->
|
<!-- AVMNodeService -->
|
||||||
|
@@ -99,6 +99,13 @@ public class AVMNodeConverter
|
|||||||
*/
|
*/
|
||||||
public static String [] SplitBase(String path)
|
public static String [] SplitBase(String path)
|
||||||
{
|
{
|
||||||
|
if (path.endsWith(":/"))
|
||||||
|
{
|
||||||
|
String [] res = new String[2];
|
||||||
|
res[0] = null;
|
||||||
|
res[1] = "";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
int off = path.lastIndexOf("/");
|
int off = path.lastIndexOf("/");
|
||||||
if (off == -1)
|
if (off == -1)
|
||||||
{
|
{
|
||||||
@@ -106,6 +113,10 @@ public class AVMNodeConverter
|
|||||||
}
|
}
|
||||||
String [] decomposed = new String[2];
|
String [] decomposed = new String[2];
|
||||||
decomposed[0] = path.substring(0, off);
|
decomposed[0] = path.substring(0, off);
|
||||||
|
if (decomposed[0].endsWith(":"))
|
||||||
|
{
|
||||||
|
decomposed[0] = decomposed[0] + "/";
|
||||||
|
}
|
||||||
decomposed[1] = path.substring(off + 1);
|
decomposed[1] = path.substring(off + 1);
|
||||||
return decomposed;
|
return decomposed;
|
||||||
}
|
}
|
||||||
|
@@ -356,7 +356,7 @@ public class AVMNodeService implements NodeService
|
|||||||
throw new InvalidNodeRefException("Invalid src path.", nodeToMoveRef);
|
throw new InvalidNodeRefException("Invalid src path.", nodeToMoveRef);
|
||||||
}
|
}
|
||||||
String srcParent = splitSrc[0];
|
String srcParent = splitSrc[0];
|
||||||
if (srcParent.endsWith(":"))
|
if (srcParent == null)
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Cannot rename root node.", nodeToMoveRef);
|
throw new InvalidNodeRefException("Cannot rename root node.", nodeToMoveRef);
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ public class AVMNodeService implements NodeService
|
|||||||
throw new InvalidNodeRefException("Read only store.", nodeRef);
|
throw new InvalidNodeRefException("Read only store.", nodeRef);
|
||||||
}
|
}
|
||||||
String [] avmPathBase = AVMNodeConverter.SplitBase((String)avmVersionPath[1]);
|
String [] avmPathBase = AVMNodeConverter.SplitBase((String)avmVersionPath[1]);
|
||||||
if (avmPathBase[0].endsWith(":"))
|
if (avmPathBase[0] == null)
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Cannot delete root node.", nodeRef);
|
throw new InvalidNodeRefException("Cannot delete root node.", nodeRef);
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ public class AVMNodeService implements NodeService
|
|||||||
String parentPath = (String)parentVersionPath[1];
|
String parentPath = (String)parentVersionPath[1];
|
||||||
String childPath = (String)childVersionPath[1];
|
String childPath = (String)childVersionPath[1];
|
||||||
String [] childPathBase = AVMNodeConverter.SplitBase(childPath);
|
String [] childPathBase = AVMNodeConverter.SplitBase(childPath);
|
||||||
if (!childPathBase[0].equals(parentPath))
|
if (childPathBase[0] == null || !childPathBase[0].equals(parentPath))
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Not a child.", childRef);
|
throw new InvalidNodeRefException("Not a child.", childRef);
|
||||||
}
|
}
|
||||||
@@ -875,7 +875,10 @@ public class AVMNodeService implements NodeService
|
|||||||
String path = (String)avmVersionPath[1];
|
String path = (String)avmVersionPath[1];
|
||||||
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>();
|
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>();
|
||||||
String [] splitPath = AVMNodeConverter.SplitBase(path);
|
String [] splitPath = AVMNodeConverter.SplitBase(path);
|
||||||
if (splitPath[0].endsWith(":"))
|
// TODO Remove when you figure this out.
|
||||||
|
fgLogger.error(splitPath[0]);
|
||||||
|
fgLogger.error(splitPath[1]);
|
||||||
|
if (splitPath[0] == null)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1029,7 +1032,7 @@ public class AVMNodeService implements NodeService
|
|||||||
List<ChildAssociationRef> parents = getParentAssocs(nodeRef);
|
List<ChildAssociationRef> parents = getParentAssocs(nodeRef);
|
||||||
if (parents.size() == 0)
|
if (parents.size() == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return new ChildAssociationRef(null, null, null, nodeRef);
|
||||||
}
|
}
|
||||||
return parents.get(0);
|
return parents.get(0);
|
||||||
}
|
}
|
||||||
@@ -1123,6 +1126,8 @@ public class AVMNodeService implements NodeService
|
|||||||
String [] splitPath = AVMNodeConverter.SplitBase(currPath);
|
String [] splitPath = AVMNodeConverter.SplitBase(currPath);
|
||||||
String parentPath = splitPath[0];
|
String parentPath = splitPath[0];
|
||||||
String name = splitPath[1];
|
String name = splitPath[1];
|
||||||
|
// TODO Remove when understood.
|
||||||
|
fgLogger.error("parentpath = " + parentPath);
|
||||||
ChildAssociationRef caRef =
|
ChildAssociationRef caRef =
|
||||||
new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
|
new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
|
||||||
AVMNodeConverter.ToNodeRef(version, parentPath),
|
AVMNodeConverter.ToNodeRef(version, parentPath),
|
||||||
@@ -1132,7 +1137,14 @@ public class AVMNodeService implements NodeService
|
|||||||
true,
|
true,
|
||||||
-1);
|
-1);
|
||||||
path.prepend(new Path.ChildAssocElement(caRef));
|
path.prepend(new Path.ChildAssocElement(caRef));
|
||||||
|
currPath = parentPath;
|
||||||
}
|
}
|
||||||
|
ChildAssociationRef caRef = new ChildAssociationRef(null, null, null,
|
||||||
|
AVMNodeConverter.ToNodeRef(version,
|
||||||
|
currPath));
|
||||||
|
path.prepend(new Path.ChildAssocElement(caRef));
|
||||||
|
// TODO Get rid of this when you figure this out.
|
||||||
|
fgLogger.error(path);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,12 +96,16 @@ class HibernateRetryingTransactionHelper extends HibernateTemplate implements Re
|
|||||||
t.printStackTrace(System.err);
|
t.printStackTrace(System.err);
|
||||||
throw new AVMException("Unrecoverable error.", t);
|
throw new AVMException("Unrecoverable error.", t);
|
||||||
}
|
}
|
||||||
if (!status.isCompleted())
|
if (newTxn && !status.isCompleted())
|
||||||
{
|
{
|
||||||
fTransactionManager.rollback(status);
|
fTransactionManager.rollback(status);
|
||||||
}
|
}
|
||||||
if (!newTxn)
|
if (!newTxn)
|
||||||
{
|
{
|
||||||
|
if (t instanceof AVMException)
|
||||||
|
{
|
||||||
|
throw (AVMException)t;
|
||||||
|
}
|
||||||
throw new AVMException("Unrecoverable error.", t);
|
throw new AVMException("Unrecoverable error.", t);
|
||||||
}
|
}
|
||||||
// If we've lost a race or we've deadlocked, retry.
|
// If we've lost a race or we've deadlocked, retry.
|
||||||
|
@@ -56,6 +56,7 @@ import org.alfresco.service.cmr.repository.InvalidChildAssociationRefException;
|
|||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
|
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.Path;
|
import org.alfresco.service.cmr.repository.Path;
|
||||||
import org.alfresco.service.cmr.repository.StoreExistsException;
|
import org.alfresco.service.cmr.repository.StoreExistsException;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
@@ -79,6 +80,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
private NodeDaoService nodeDaoService;
|
private NodeDaoService nodeDaoService;
|
||||||
private StoreArchiveMap storeArchiveMap;
|
private StoreArchiveMap storeArchiveMap;
|
||||||
|
private NodeService avmNodeService;
|
||||||
|
|
||||||
public DbNodeServiceImpl()
|
public DbNodeServiceImpl()
|
||||||
{
|
{
|
||||||
@@ -100,6 +102,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
this.storeArchiveMap = storeArchiveMap;
|
this.storeArchiveMap = storeArchiveMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAvmNodeService(NodeService avmNodeService)
|
||||||
|
{
|
||||||
|
this.avmNodeService = avmNodeService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a null-safe get of the node
|
* Performs a null-safe get of the node
|
||||||
*
|
*
|
||||||
@@ -159,7 +166,10 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
storeRefs.add(store.getStoreRef());
|
storeRefs.add(store.getStoreRef());
|
||||||
}
|
}
|
||||||
// done
|
// Now get the AVMStores.
|
||||||
|
List<StoreRef> avmStores = avmNodeService.getStores();
|
||||||
|
storeRefs.addAll(avmStores);
|
||||||
|
// Return them all.
|
||||||
return storeRefs;
|
return storeRefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user