mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
44765: ALF-17164: Fix failing build in case build is not run in continuous mode 44769: ALF-17097 60k Site Performance: Admin Console | Groups | Browse Groups (include sys groups): Results isn't appeared. - Group page now supports search and browse of large volumes of groups. Tested up to 300,000 sites (60k sites). Previously this would not return. - In order to support large volumes of groups it is not practical to search for all root groups. A functional change has taken place to fix this issue. [Browse] (which initially displayed only root groups) now uses the search value entered by the user and the same query as [Search]. It could be argued that the browse functionality was not very practical anyway if there were a large number of root groups as the user would have to page through all the pages one at a time to get to the required group in order to add a new sub group. As a result of this change it is now possible to get to the required group much faster. As the 'browse' function uses the search value and Include System Groups checkbox (it already used the checkbox value) it made little sense to revert to the Search results when either of these is changed. As this was taking place, this has now been changed too. The [Search] and [Browse] options both now use the authority canned query which has been enhanced to use the sortBy field supplied by the UI. - Uses the authority canned query for [Search] and [Browse] searches on the Groups page. - Canned query may sort on "shortName", "displayName" or "authorityName" - Filter on displayName uses regular expressions to support ? and * wildcards - Canned query returns fewer (unused) columns to speed up fetch time. - Canned query no longer joins to alf_store as none of the values were used. 44772: CIFS Gedit support - rename open files. 44776: ALF-17164: Fix failing build in case build is not run in continuous mode - move generation of version.properties out of continuous mode git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@44790 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,6 +42,11 @@ public interface RuleEvaluator
|
||||
* @return Command the command to fulfil the operation
|
||||
*/
|
||||
public Command evaluate(EvaluatorContext context, Operation operation);
|
||||
|
||||
/**
|
||||
* Tell the context of a rename
|
||||
*/
|
||||
public void notifyRename(EvaluatorContext context, Operation operation, Command c);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -204,5 +204,31 @@ public class RuleEvaluatorImpl implements RuleEvaluator
|
||||
EvaluatorContextImpl impl = new EvaluatorContextImpl(sessionState);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyRename(EvaluatorContext context, Operation operation,
|
||||
Command command)
|
||||
{
|
||||
// currentScenarioInstances needs to be protected for concurrency.
|
||||
synchronized (context.getScenarioInstances())
|
||||
{
|
||||
/**
|
||||
* For each active scenario.
|
||||
*/
|
||||
Iterator<ScenarioInstance> i = context.getScenarioInstances().iterator();
|
||||
|
||||
while(i.hasNext())
|
||||
{
|
||||
ScenarioInstance scenario = i.next();
|
||||
if(scenario instanceof ScenarioInstanceRenameAware)
|
||||
{
|
||||
ScenarioInstanceRenameAware awareScenario = (ScenarioInstanceRenameAware)scenario;
|
||||
awareScenario.notifyRename(operation, command);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -23,12 +23,13 @@ import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.filesys.repo.rules.ScenarioInstance.Ranking;
|
||||
import org.alfresco.filesys.repo.rules.operations.CloseFileOperation;
|
||||
import org.alfresco.filesys.repo.rules.operations.DeleteFileOperation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* The DeleteOnClose rename shuffle is a delete on close of a file resulting in a file being deleted followed by a rename of a file from
|
||||
* somewhere else.
|
||||
* The DeleteOnClose rename shuffle is a delete on close of a file resulting in a file being deleted followed by a
|
||||
* rename or a create
|
||||
*
|
||||
* First case of this is Mac Mountain Lion Preview application.
|
||||
* and then a new copy of the file put into place.
|
||||
@@ -36,11 +37,23 @@ import org.apache.commons.logging.LogFactory;
|
||||
* a) DeleteOnClose fileA
|
||||
* b) Close fileA
|
||||
* c) Rename whatever fileA
|
||||
*
|
||||
* Second case First case of this is Mac Drag and drop.
|
||||
* and then a new copy of the file put into place.
|
||||
*
|
||||
* a) Delete fileA
|
||||
* b) Close fileA
|
||||
* c) Create fileA
|
||||
*
|
||||
* Third case Gedit.
|
||||
*
|
||||
* a) Delete fileA
|
||||
* b) Rename .goutputstream fileA
|
||||
*
|
||||
*/
|
||||
public class ScenarioDeleteOnCloseRename implements Scenario
|
||||
public class ScenarioDeleteRenameOrCreate implements Scenario
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(ScenarioDeleteOnCloseRename.class);
|
||||
private static Log logger = LogFactory.getLog(ScenarioDeleteRenameOrCreate.class);
|
||||
|
||||
/**
|
||||
* The regex pattern of a close that will trigger a new instance of
|
||||
@@ -67,9 +80,27 @@ public class ScenarioDeleteOnCloseRename implements Scenario
|
||||
{
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("New Scenario ScenarioDeleteOnCloseRename strPattern:" + pattern);
|
||||
logger.debug("New Scenario ScenarioDeleteRenameOrCreate strPattern:" + pattern);
|
||||
}
|
||||
ScenarioDeleteOnCloseRenameInstance instance = new ScenarioDeleteOnCloseRenameInstance();
|
||||
ScenarioDeleteRenameOrCreateInstance instance = new ScenarioDeleteRenameOrCreateInstance();
|
||||
instance.setTimeout(timeout);
|
||||
instance.setRanking(ranking);
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
if(operation instanceof DeleteFileOperation)
|
||||
{
|
||||
DeleteFileOperation c = (DeleteFileOperation)operation;
|
||||
|
||||
Matcher m = pattern.matcher(c.getName());
|
||||
if(m.matches())
|
||||
{
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("New Scenario ScenarioDeleteRenameOrCreate strPattern:" + pattern);
|
||||
}
|
||||
ScenarioDeleteRenameOrCreateInstance instance = new ScenarioDeleteRenameOrCreateInstance();
|
||||
instance.setTimeout(timeout);
|
||||
instance.setRanking(ranking);
|
||||
return instance;
|
@@ -28,6 +28,8 @@ import org.alfresco.filesys.repo.rules.commands.CopyContentCommand;
|
||||
import org.alfresco.filesys.repo.rules.commands.DeleteFileCommand;
|
||||
import org.alfresco.filesys.repo.rules.commands.RestoreFileCommand;
|
||||
import org.alfresco.filesys.repo.rules.operations.CloseFileOperation;
|
||||
import org.alfresco.filesys.repo.rules.operations.CreateFileOperation;
|
||||
import org.alfresco.filesys.repo.rules.operations.DeleteFileOperation;
|
||||
import org.alfresco.filesys.repo.rules.operations.MoveFileOperation;
|
||||
import org.alfresco.filesys.repo.rules.operations.RenameFileOperation;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
|
||||
@@ -46,9 +48,9 @@ import org.apache.commons.logging.LogFactory;
|
||||
* This rule will kick in and ...
|
||||
*
|
||||
*/
|
||||
class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
class ScenarioDeleteRenameOrCreateInstance implements ScenarioInstance
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(ScenarioDeleteOnCloseRenameInstance.class);
|
||||
private static Log logger = LogFactory.getLog(ScenarioDeleteRenameOrCreateInstance.class);
|
||||
|
||||
private Date startTime = new Date();
|
||||
|
||||
@@ -66,7 +68,7 @@ class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
enum InternalState
|
||||
{
|
||||
NONE,
|
||||
LOOK_FOR_RENAME
|
||||
INITIALISED
|
||||
} ;
|
||||
|
||||
InternalState state = InternalState.NONE;
|
||||
@@ -101,7 +103,7 @@ class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
CloseFileOperation c = (CloseFileOperation)operation;
|
||||
this.name = c.getName();
|
||||
logger.debug("New scenario initialised for file " + name);
|
||||
state = InternalState.LOOK_FOR_RENAME;
|
||||
state = InternalState.INITIALISED;
|
||||
|
||||
ArrayList<Command> commands = new ArrayList<Command>();
|
||||
ArrayList<Command> postCommitCommands = new ArrayList<Command>();
|
||||
@@ -110,15 +112,47 @@ class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
postCommitCommands.add(newDeleteFileCallbackCommand());
|
||||
return new CompoundCommand(commands, postCommitCommands, postErrorCommands);
|
||||
}
|
||||
if(operation instanceof DeleteFileOperation)
|
||||
{
|
||||
DeleteFileOperation c = (DeleteFileOperation)operation;
|
||||
this.name = c.getName();
|
||||
logger.debug("New scenario initialised for file " + name);
|
||||
state = InternalState.INITIALISED;
|
||||
|
||||
ArrayList<Command> commands = new ArrayList<Command>();
|
||||
ArrayList<Command> postCommitCommands = new ArrayList<Command>();
|
||||
ArrayList<Command> postErrorCommands = new ArrayList<Command>();
|
||||
commands.add(new DeleteFileCommand(c.getName(), c.getRootNodeRef(), c.getPath()));
|
||||
postCommitCommands.add(newDeleteFileCallbackCommand());
|
||||
return new CompoundCommand(commands, postCommitCommands, postErrorCommands);
|
||||
}
|
||||
break;
|
||||
|
||||
case LOOK_FOR_RENAME:
|
||||
|
||||
case INITIALISED:
|
||||
|
||||
if(operation instanceof CreateFileOperation)
|
||||
{
|
||||
CreateFileOperation c = (CreateFileOperation)operation;
|
||||
|
||||
if(c.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
isComplete = true;
|
||||
if(originalNodeRef != null)
|
||||
{
|
||||
logger.debug("Delete create shuffle fire!:" + this);
|
||||
return new RestoreFileCommand(c.getName(), c.getRootNodeRef(), c.getPath(), c.getAllocationSize(), originalNodeRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(operation instanceof RenameFileOperation)
|
||||
{
|
||||
RenameFileOperation r = (RenameFileOperation)operation;
|
||||
if(name.equals(r.getTo()))
|
||||
{
|
||||
logger.debug("Delete on close Rename shuffle - fire!");
|
||||
logger.debug("Delete Rename shuffle - fire!");
|
||||
|
||||
if(originalNodeRef != null)
|
||||
{
|
||||
@@ -155,7 +189,7 @@ class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
MoveFileOperation r = (MoveFileOperation)operation;
|
||||
if(name.equals(r.getTo()))
|
||||
{
|
||||
logger.debug("Delete on close Rename shuffle - fire!");
|
||||
logger.debug("Delete Rename shuffle - fire!");
|
||||
|
||||
if(originalNodeRef != null)
|
||||
{
|
||||
@@ -198,7 +232,7 @@ class ScenarioDeleteOnCloseRenameInstance implements ScenarioInstance
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "ScenarioDeleteOnCloseRenameShuffleInstance name:" + name ;
|
||||
return "ScenarioDeleteRenameOrCreate name:" + name ;
|
||||
}
|
||||
|
||||
public void setTimeout(long timeout)
|
@@ -0,0 +1,19 @@
|
||||
package org.alfresco.filesys.repo.rules;
|
||||
|
||||
/**
|
||||
* The scenario instance wants to be notified about rename.
|
||||
*
|
||||
* @author mrogers
|
||||
*
|
||||
*/
|
||||
public interface ScenarioInstanceRenameAware
|
||||
{
|
||||
/**
|
||||
* Notify the scenario of a successful rename operation.
|
||||
*
|
||||
* @param operation
|
||||
* @param command
|
||||
*/
|
||||
public void notifyRename(Operation operation, Command command);
|
||||
|
||||
}
|
@@ -74,7 +74,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* 4) close
|
||||
*
|
||||
*/
|
||||
class ScenarioOpenFileInstance implements ScenarioInstance, DependentInstance
|
||||
class ScenarioOpenFileInstance implements ScenarioInstance, DependentInstance, ScenarioInstanceRenameAware
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(ScenarioOpenFileInstance.class);
|
||||
|
||||
@@ -242,6 +242,20 @@ class ScenarioOpenFileInstance implements ScenarioInstance, DependentInstance
|
||||
|
||||
case OPEN:
|
||||
|
||||
if(operation instanceof RenameFileOperation)
|
||||
{
|
||||
RenameFileOperation r = (RenameFileOperation)operation;
|
||||
if(r.getFrom() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(name.equalsIgnoreCase(r.getFrom()))
|
||||
{
|
||||
logger.warn("rename of an open file");
|
||||
}
|
||||
}
|
||||
|
||||
if(operation instanceof CloseFileOperation)
|
||||
{
|
||||
CloseFileOperation c = (CloseFileOperation)operation;
|
||||
@@ -564,25 +578,70 @@ class ScenarioOpenFileInstance implements ScenarioInstance, DependentInstance
|
||||
}
|
||||
|
||||
|
||||
if(looser.scenario instanceof ScenarioDeleteOnCloseRenameInstance)
|
||||
if(looser.scenario instanceof ScenarioDeleteRenameOrCreateInstance)
|
||||
{
|
||||
CompoundCommand l = (CompoundCommand)looser.command;
|
||||
ArrayList<Command> commands = new ArrayList<Command>();
|
||||
ArrayList<Command> postCommitCommands = new ArrayList<Command>();
|
||||
ArrayList<Command> postErrorCommands = new ArrayList<Command>();
|
||||
commands.addAll(c.getCommands());
|
||||
postCommitCommands.addAll(c.getPostCommitCommands());
|
||||
// Merge in the loosing post commit
|
||||
postCommitCommands.addAll(l.getPostCommitCommands());
|
||||
postErrorCommands.addAll(c.getPostErrorCommands());
|
||||
|
||||
logger.debug("returning merged high priority executor");
|
||||
return new CompoundCommand(commands, postCommitCommands, postErrorCommands);
|
||||
Command x = looser.command;
|
||||
if(x instanceof CompoundCommand)
|
||||
{
|
||||
CompoundCommand l = (CompoundCommand)x;
|
||||
|
||||
ArrayList<Command> commands = new ArrayList<Command>();
|
||||
ArrayList<Command> postCommitCommands = new ArrayList<Command>();
|
||||
ArrayList<Command> postErrorCommands = new ArrayList<Command>();
|
||||
commands.addAll(c.getCommands());
|
||||
postCommitCommands.addAll(c.getPostCommitCommands());
|
||||
// Merge in the loosing post commit
|
||||
postCommitCommands.addAll(l.getPostCommitCommands());
|
||||
postErrorCommands.addAll(c.getPostErrorCommands());
|
||||
|
||||
logger.debug("returning merged high priority executor");
|
||||
return new CompoundCommand(commands, postCommitCommands, postErrorCommands);
|
||||
}
|
||||
else
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// No change
|
||||
return command;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyRename(Operation operation, Command command)
|
||||
{
|
||||
if(operation instanceof RenameFileOperation)
|
||||
{
|
||||
RenameFileOperation r = (RenameFileOperation)operation;
|
||||
if(r.getFrom() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(name.equalsIgnoreCase(r.getFrom()))
|
||||
{
|
||||
if(logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("rename of this scenario: to " + r.getTo());
|
||||
}
|
||||
|
||||
name = r.getTo();
|
||||
|
||||
if (fileHandleReadWrite != null)
|
||||
{
|
||||
fileHandleReadWrite.setName(r.getTo());
|
||||
fileHandleReadWrite.setFullName(r.getToPath());
|
||||
}
|
||||
|
||||
if (fileHandleReadOnly != null)
|
||||
{
|
||||
fileHandleReadOnly.setName(r.getTo());
|
||||
fileHandleReadOnly.setFullName(r.getToPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user