Search in sources :

Example 1 with SoftRenameFileCommand

use of org.alfresco.filesys.repo.rules.commands.SoftRenameFileCommand in project alfresco-repository by Alfresco.

the class ScenarioRenameCreateShuffleInstance method evaluate.

/**
 * Evaluate the next operation
 * @param operation
 */
public Command evaluate(Operation operation) {
    /**
     * Anti-pattern : timeout
     */
    Date now = new Date();
    if (now.getTime() > startTime.getTime() + getTimeout()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Instance timed out");
        }
        isComplete = true;
        return null;
    }
    switch(state) {
        case NONE:
            if (operation instanceof RenameFileOperation) {
                logger.debug("New scenario initialised");
                RenameFileOperation r = (RenameFileOperation) operation;
                this.from = r.getFrom();
                this.to = r.getTo();
                state = InternalState.INITIALISED;
                SoftRenameFileCommand r1 = new SoftRenameFileCommand(from, to, r.getRootNodeRef(), r.getFromPath(), r.getToPath());
                isComplete = true;
                return r1;
            }
            break;
    }
    return null;
}
Also used : SoftRenameFileCommand(org.alfresco.filesys.repo.rules.commands.SoftRenameFileCommand) Date(java.util.Date) RenameFileOperation(org.alfresco.filesys.repo.rules.operations.RenameFileOperation)

Aggregations

Date (java.util.Date)1 SoftRenameFileCommand (org.alfresco.filesys.repo.rules.commands.SoftRenameFileCommand)1 RenameFileOperation (org.alfresco.filesys.repo.rules.operations.RenameFileOperation)1