info.magnolia.module.delta
Class SetPropertyTask

java.lang.Object
  extended by info.magnolia.module.delta.AbstractTask
      extended by info.magnolia.module.delta.PropertyValuesTask
          extended by info.magnolia.module.delta.SetPropertyTask
All Implemented Interfaces:
Task

public class SetPropertyTask
extends PropertyValuesTask

Sets a new value for a property. Consider using CheckAndModifyPropertyValueTask if you want your update tasks to only modify expected values.

Version:
$Revision: $ ($Author: $)
Author:
fgiust
See Also:
CheckAndModifyPropertyValueTask

Field Summary
 
Fields inherited from class info.magnolia.module.delta.AbstractTask
log
 
Constructor Summary
SetPropertyTask(String workspaceName, String nodePath, String propertyName, String newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, BigDecimal newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, javax.jcr.Binary newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, Boolean newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, Calendar newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, Double newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, InputStream newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, Long newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, javax.jcr.Node newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, String newValue)
           
SetPropertyTask(String taskName, String workspaceName, String nodePath, String propertyName, javax.jcr.Value newValue)
           
 
Method Summary
 void execute(InstallContext installContext)
          A good-citizen task should execute itself responsibly: it should know what to do in case of problems: for instance, fixable or irrelevant issues should usually just be logged used the InstallContext methods, when the user can fix them later on.
 
Methods inherited from class info.magnolia.module.delta.PropertyValuesTask
checkAndModifyPartOfPropertyValue, checkAndModifyPropertyValue, checkAndModifyPropertyValue, checkAndModifyPropertyValue, checkOrCreateProperty, format, format, format, newProperty, newProperty
 
Methods inherited from class info.magnolia.module.delta.AbstractTask
getDescription, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetPropertyTask

public SetPropertyTask(String workspaceName,
                       String nodePath,
                       String propertyName,
                       String newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       String newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       javax.jcr.Value newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       javax.jcr.Node newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       javax.jcr.Binary newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       Calendar newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       BigDecimal newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       Long newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       Double newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       Boolean newValue)

SetPropertyTask

public SetPropertyTask(String taskName,
                       String workspaceName,
                       String nodePath,
                       String propertyName,
                       InputStream newValue)
Method Detail

execute

public void execute(InstallContext installContext)
A good-citizen task should execute itself responsibly: it should know what to do in case of problems: for instance, fixable or irrelevant issues should usually just be logged used the InstallContext methods, when the user can fix them later on. The task could also potentially do backups of nodes it needs to modify extensively, so the user could refer to the backups in case of problem. In the event of an unrecoverable issue, the Task could also throw a TaskExecutionException, knowing that will cancel the whole module's installation, update and startup. If a TaskExecutionException must be thrown, keep in mind that the exception message will still be shown to the end user, so try to keep them human readable.



Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.