{ } }
Tree PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.workplace.wcm.api.extensions.validation
Interface ItemValidationPlugin
- All Superinterfaces:
- AuthoringPlugin, Localized
public interface ItemValidationPlugin- extends Localized, AuthoringPlugin
Represents an ItemValidation plugin.
An ItemValidation plugin is used to validate a TemplatedDocument prior to it being committed to the repository. It will be invoked as part of the standard item validation step.
There are any number of validation that can be performed. Some examples include:
- Cross field relationships can be managed
- Perform complex custom field validation
- Ensure the correct workflow is selected for an item based on type and location in the repository
- ...
The plugin is registered with WCM by providing a plugin.xml in the JAR file including the implementation and specifying and extension provider similar to this:
<extension point="com.ibm.workplace.wcm.api.ItemValidationPlugin" id="SampleItemValidation"> <provider class="com.yourco.validation.SampleItemValidation"/> </extension>Each ItemValidationPlugin plugin must also have a constructor with no arguments
- Since:
- 8.0
- Note:
This interface is designed to be implemented by clients.
Method Summary ItemValidationResult validate(ItemContext context)
Validate the item being committed and determine whether the item in its current state should be stored in the WCM repository.DocumentId<? extends AbstractAuthoringTemplate>[] validationScope()
The validation scope defines when the validation plugin will be invoked.
Methods inherited from interface com.ibm.portal.Localized getDescription, getLocales, getTitle
Methods inherited from interface com.ibm.workplace.wcm.api.plugin.AuthoringPlugin isShownInAuthoringUI
Method Detail validationScope
DocumentId<? extends AbstractAuthoringTemplate>[] validationScope()
- The validation scope defines when the validation plugin will be invoked. The scope is limited to items that are based on an Authoring Template returned from this method.
The validation scope will be called once when the plugin is loaded. To change the scope the plugin will need to be removed and re-installed or the system restarted.
- Returns:
- the array of Authoring Template DocumentIds to identify the items based on these templates when saved should invoke the validation plugin
validate
ItemValidationResult validate(ItemContext context)
- Validate the item being committed and determine whether the item in its current state should be stored in the WCM repository.
Note: The item can be changed in this method, typically by updating fields on the item. However, any action performed on the item that causes a commit to the database will result in an exception being thrown and a warning printed to the logs. For instance, the item's workflow can be changed, but the item can not be moved to the next workflow stage.
- Parameters:
- context - context for this validation. The item being validated and additional information on the context of this action.
- Returns:
- ItemValidationResult to define if the item should be committed. If null is returned then the document will be considered valid.
Tree PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD