Merged V3.2 to HEAD

17307: Merged DEV/BELARUS/V3.2-2009_10_19 to V3.2
       17121: ETHREEOH-2999: Accessing Recent snapshots fails in a web project that is created from an already existing project 
       17223: ETHREEEOH-2999: (post-review changes)
   17346: ETHREEOH-2824 - further perf improvement for multiple single submits (to active workflow sandboxes) from large modified list
   17375: Fix ETHREEOH-1643 - WCM revert file & version history, including a few unreported WCM / UI revert file issues
   17380: ETHREEOH-1643 - fix build/test fallout


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18110 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-01-19 10:26:45 +00:00
parent bb3c8a1244
commit 8db9d90a72
6 changed files with 116 additions and 53 deletions

View File

@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.avm.util.AVMUtil;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
@@ -703,10 +704,11 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
*/
public void removeNode(String parent, String name)
{
grabLock(parent + '/' + name);
String path = AVMUtil.extendAVMPath(parent, name);
grabLock(path);
fService.removeNode(parent, name);
String[] storePath = parent.split(":");
fService.createSnapshot(storePath[0], null, null);
fService.createSnapshot(storePath[0], null, "Removed "+path);
String webProject = getWebProject(storePath[0]);
if (webProject != null)
{
@@ -722,7 +724,7 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
grabLock(path);
fService.removeNode(path);
String[] storePath = path.split(":");
fService.createSnapshot(storePath[0], null, null);
fService.createSnapshot(storePath[0], null, "Removed "+path);
String webProject = getWebProject(storePath[0]);
if (webProject != null)
{

View File

@@ -1259,47 +1259,62 @@ public class AVMServiceTest extends AVMServiceTestBase
try
{
setupBasicTree();
ContentWriter writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo V1");
fService.createSnapshot("main", "v1", null);
writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo V2");
fService.createSnapshot("main", "v2", null);
writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo V3");
fService.createSnapshot("main", "v3", null);
writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo V4");
fService.createSnapshot("main", "v4", null);
writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo V5");
fService.createSnapshot("main", "v5", null);
writer = fService.getContentWriter("main:/a/b/c/foo");
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/foo HEAD");
StoreRef storeRef = AVMNodeConverter.ToStoreRef("main");
SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
ResultSet results = searchService.query(storeRef, "lucene", "TEXT:\"HEAD\"");
assertEquals(0, results.length());
results.close();
results = searchService.query(storeRef, "lucene", "TEXT:\"V5\"");
assertEquals(1, results.length());
results.close();
results = searchService.query(storeRef, "lucene", "TEXT:\"V2\"");
assertEquals(0, results.length());
results.close();
AVMNodeDescriptor desc = fService.lookup(-1, "main:/a/b/c/foo");
List<AVMNodeDescriptor> history = fService.getHistory(desc, 100);
AVMNodeDescriptor toRevert = history.get(3);
final ActionImpl action = new ActionImpl(null, GUID.generate(), AVMRevertToVersionAction.NAME);
action.setParameterValue(AVMRevertToVersionAction.TOREVERT, toRevert);
final AVMRevertToVersionAction revert = (AVMRevertToVersionAction) fContext.getBean("avm-revert-to-version");
@@ -1307,26 +1322,15 @@ public class AVMServiceTest extends AVMServiceTestBase
{
public Object execute() throws Exception
{
// note: including implicit snapshot
revert.execute(action, AVMNodeConverter.ToNodeRef(-1, "main:/a/b/c/foo"));
return null;
}
}
;
};
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
results = searchService.query(storeRef, "lucene", "TEXT:\"HEAD\"");
assertEquals(0, results.length());
results.close();
results = searchService.query(storeRef, "lucene", "TEXT:\"V5\"");
assertEquals(1, results.length());
results.close();
results = searchService.query(storeRef, "lucene", "TEXT:\"V2\"");
assertEquals(0, results.length());
results.close();
fService.createSnapshot("main", "reverted", null);
results = searchService.query(storeRef, "lucene", "TEXT:\"HEAD\"");
assertEquals(0, results.length());
results.close();
@@ -1336,7 +1340,6 @@ public class AVMServiceTest extends AVMServiceTestBase
results = searchService.query(storeRef, "lucene", "TEXT:\"V2\"");
assertEquals(1, results.length());
results.close();
}
catch (Exception e)
{

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.avm.util.AVMUtil;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
@@ -77,9 +78,12 @@ public class AVMRevertToVersionAction extends ActionExecuterAbstractBase
{
Pair<Integer, String> versionPath =
AVMNodeConverter.ToAVMVersionPath(actionedUponNodeRef);
AVMNodeDescriptor toRevert =
AVMNodeDescriptor toRevertTo =
(AVMNodeDescriptor)action.getParameterValue(TOREVERT);
fAVMService.revert(versionPath.getSecond(), toRevert);
fAVMService.revert(versionPath.getSecond(), toRevertTo);
String[] storePath = AVMUtil.splitPath(versionPath.getSecond());
fAVMService.createSnapshot(storePath[0], null, "Reverted "+versionPath.getSecond()+" to version "+toRevertTo.getVersionID());
}
/* (non-Javadoc)