Posts Tagged ‘flex filters in oracle webcenter sites’


The DocType Flex Filter is one of the four filters which are supplied by WebCenter Sites. It is the short form for DOCUMENT TYPE.

The DocType filter is used to know the file-types (for example pdf, doc, etc..), mime-types (for example      application/pdf , etc..) of a particular document  Knowing the file types and mime types of a document are important in some situations. This filter could be used in such situations.

CREATION OF ATTRIBUTES:

First Things First. Create the following attributes, that would be utilized by the filter.

1. SampleDocument – (BLOB)

2. SampleDocumentFileType – (STRING)

3. SampleDocumentMimeType – (STRING)

CREATION OF FILTER:

1. Go to the Filter creation screen.

2. Enter the Name and Description of your choice.

3. In the FILTER drop down, select DocType, and click on GET ARGUMENTS button.

4. In the ARGUMENTS section, in the name drop-down, select each of the options, and enter the values as follows:

  • ATTRIBUTE TO HOLD DERIVED FILETYPE  –  SampleDocumentFileType
  • ATTRIBUTE TO HOLD DERIVED MIMETYPE – SampleDocumentMimeType
  • INPUT ATTRIBUTE NAME – SampleDocument

Finally the screen should look like following screen:

5. Save it.

6. Add the Filter to the content definition.

TESTING THE DOCTYPE FLEX FILTER:

1. Go to the asset creation screen, select the content definition for which you have added the filter.

2. Give a name.

3. Upload a document. Say a sample PDF document.

4. Save it. Click on Inspect. You will be able to see the uploaded document’s FILE TYPE & MIME TYPE. Check the below screen.

We haven’t added the SampleDocumentFileType & SampleDocumentMimeType in the content definition. But still they have appeared in the Asset Inspection Screen. Coz, these attributes are added by the DOCTYPE FLEX FILTER.

That’s it..

DocType Flex Filter perfectly works.


We will now see the implementation of FieldCopier Flex Filter in Oracle WebCenter Sites / Fatwire.

Purpose: The purpose of this filter is to get information from the system attributes such as NAME, FLEX DEFINITION, CREATED DATE, etc. There are totally 18 system attributes, out of which, a few are inaccessible through code. Under such circumstances, we will use this FieldCopier filter to gather the values from the system attributes, and place the values in our custom attributes.

We will try to copy the name and content definition attributes (system attributes) to our custom attributes in the following implementation.

 
CREATE FLEX ATTRIBUTES:

Create the below two flex attributes.

1. Name-FieldCopier   –  (String)
2. ContentDefinition-FieldCopier –  (String)

CREATE FLEX FILTER:

Now, create the flex filter for field copier:

1. Click on new Flex Filter.

2. Give a name.

3. In the FILTER drop down, select the FIELDCOPIER option. Then Click on the GET ARGUMENTS button.

4. In the ARGUMENTS section, you will see a drop down box. In that dropdown, select the following options.

  •   name    –   In the value text box, enter  Name-FieldCopier    –  Click on ADD button.
  •   FlexDefinition     –   In the value text box, enter  ContentDefinition-FieldCopier   –  Click on ADD button

5. Save.

After saving the filter, the screen should look like follows:

ADDING THE FLEX FILTER TO THE CONTENT DEFINITION:

1. Add the filter to either new content definitions or existing content definitions.

2. After adding the filter, the content definition looks as follows.

FINALLY, TEST THE FILTER:

Now, its time to test the filter which we have created. Create a new asset of type SAMPLE_C, and select the above content definition.

Give a name to the asset. Click on Save. Then, click on Inspect button. The following screen appears.

The two attributes which we have created, Name-FieldCopier, ContentDefinition-FieldCopier are appended to the assets meta-data, as shown in the above screen.

That’s it. We have successfully created the FIELD COPIER filter.


What is a Flex Filter?

A FLEX FILTER is a utility, that performs operations on the flex assets, for which that filter is assigned. The filter will be called only after the particular asset (for which this filter is assigned)  is saved. Flex filter classes implement the functionality of flex filter assets.

How many types of filters are there in total?

Oracle WebCenter Sites / Fatwire Content Server ships with FOUR Flex Filters by default. We also have the provision to create our custom filters. This can be done by creating new jar files, and registering them in the database. Following are the different types of Flex Filters available.

1.   Doc-Type Filter – Used to get the MIME Type / File Types.

2.   Thumbnail Creator – Used to convert an image into a thumbnail.

3.   Field Copier – Used to copy the contents of a system-defined attributes like name, template, etc (Totally 18 system attributes are there) into a user-defined attribute, to be used within the code.

4.   Document Transformation – Converts a document from one file type into another.

We will discuss about these Filters in detail, in the upcoming posts.