Search in sources :

Example 16 with RenameFileOperation

use of org.alfresco.filesys.repo.rules.operations.RenameFileOperation in project alfresco-repository by Alfresco.

the class ScenarioRenameShuffle method createInstance.

@Override
public ScenarioInstance createInstance(final EvaluatorContext ctx, Operation operation) {
    /**
     * This scenario is triggered by a rename of a file matching
     * the pattern
     */
    if (operation instanceof RenameFileOperation) {
        RenameFileOperation r = (RenameFileOperation) operation;
        Matcher m = pattern.matcher(r.getTo());
        if (m.matches()) {
            if (logger.isDebugEnabled()) {
                logger.debug("New Scenario Rename Shuffle Instance strPattern:" + pattern);
            }
            ScenarioRenameShuffleInstance instance = new ScenarioRenameShuffleInstance();
            instance.setTimeout(timeout);
            instance.setRanking(ranking);
            return instance;
        }
    }
    // No not interested.
    return null;
}
Also used : Matcher(java.util.regex.Matcher) RenameFileOperation(org.alfresco.filesys.repo.rules.operations.RenameFileOperation)

Aggregations

RenameFileOperation (org.alfresco.filesys.repo.rules.operations.RenameFileOperation)16 Date (java.util.Date)9 ArrayList (java.util.ArrayList)8 CompoundCommand (org.alfresco.filesys.repo.rules.commands.CompoundCommand)7 CopyContentCommand (org.alfresco.filesys.repo.rules.commands.CopyContentCommand)7 DeleteFileOperation (org.alfresco.filesys.repo.rules.operations.DeleteFileOperation)7 Matcher (java.util.regex.Matcher)6 DeleteFileCommand (org.alfresco.filesys.repo.rules.commands.DeleteFileCommand)6 RenameFileCommand (org.alfresco.filesys.repo.rules.commands.RenameFileCommand)6 CreateFileOperation (org.alfresco.filesys.repo.rules.operations.CreateFileOperation)6 CloseFileOperation (org.alfresco.filesys.repo.rules.operations.CloseFileOperation)4 MoveFileOperation (org.alfresco.filesys.repo.rules.operations.MoveFileOperation)4 CloseFileCommand (org.alfresco.filesys.repo.rules.commands.CloseFileCommand)3 RestoreFileCommand (org.alfresco.filesys.repo.rules.commands.RestoreFileCommand)2 OpenFileOperation (org.alfresco.filesys.repo.rules.operations.OpenFileOperation)2 TempNetworkFile (org.alfresco.filesys.repo.TempNetworkFile)1 Command (org.alfresco.filesys.repo.rules.Command)1 EvaluatorContext (org.alfresco.filesys.repo.rules.EvaluatorContext)1 Operation (org.alfresco.filesys.repo.rules.Operation)1 CallbackCommand (org.alfresco.filesys.repo.rules.commands.CallbackCommand)1