close

Filter

loading table of contents...

Site Manager Developer Manual / Version 2301

Table Of Contents

4.6 Program Own Predicate Classes

Predicate classes enable selective view of objects. They can filter different types of objects.

Interface to implement

For own predicates you need to implement the interface java.util.function.Predicate<Object> with the method test.

Parameters to use

The include method gets only one parameter of type Object. Depending on the element of the editor.xml file where the predicate is used, the method can be called with different object types.

  • <Filter>

  • If the <Predicate> element is used in a <Filter> element, the documents shown in the document overview of the Site Manager can be filtered, due to different conditions. Thus, the objects to be filtered are documents of the type hox.corem.editor.proxy.DocumentTypeModel.

  • <Treefilter>

  • If the <Predicate> element is used in a <Treefilter> element, the folders shown in the folder view of the Site Manager can be filtered. The objects to be filtered are folders of the type hox.corem.editor.proxy.ResourceHolder.

  • <DocumentTypes>

  • If a <Predicate> or <DocumentTypePredicate> element is used in a <DocumentTypes> element, the document types which can be created, moved, copied or selected in document choosers are filtered. Thus, the objects to be filtered are document types hox.corem.editor.proxy.DocumentTypeModel.

  • <Processes>

  • If the <Predicate> element is used in a <Processes> element, the workflows offered for initiating in the Menu File|New Workflow... are filtered. The objects to be filtered are workflows of the type com.coremedia.workflow.WfProcess.

Integrate your predicate into the Site Manager using editor.xml

You can integrate your predicate into the Site Manager using the element Predicate or DocumentTypePredicate of editor.xml as shown in example.

<Explorer name="configurable-explorer-factory">
	<Filter name="ownFilter>
		<Predicate class="mySimplePredicate"/>
 		.
 		.                
	</Filter>
<Editor>

Example 4.8. How to integrate the Predicate class


Example

The next example shows a predicate which simply returns "false" for all input. As a result, all items are filtered!

package com.customer.example;

import java.util.function.Predicate;
import hox.corem.editor.Editor;

public class NewPredicate implements Predicate<Object> {
  public boolean test(Object obj) {
    boolean result = false;
    Editor.getLog().debug("NewPredicate.include(): "+obj);
    return result;
  }
}

Example 4.9. Example of a customized Predicate class


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.