Posts Tagged ‘flex filter’


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.

Advertisements

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.


Out of the 4 flex filters provided by Oracle WebCenter Sites, one of the most important and useful filter is THUMBNAIL CREATOR.

The Purpose of this filter is to create THUMBNAILS from the images which we upload.

We will now see how to create thumbnails using this filter.

CREATE A FLEX FAMILY:

The Flex filter is a part of the Flex Family. So, in order to create any filter, we need to create the Flex Family.

 

 

 

 

 

 

 

 

 

After creation of the Flex family, enable the flex family members for your site.

CREATE THE FOLLOWING FLEX ATTRIBUTES:

1.  ImageFile  – (BLOB)
2. ThumbnailFile – (BLOB)
3. ImageHeight – (STRING)
4. ImageWidth – (STRING)
5. ThumbnailWidth – (STRING)
6. ThumbnailHeight – (STRING)

CREATE NEW FLEX FILTER:

1. Click on New Sample Filter. The following screen appears.

 

 

 

 

 

 

 

 

2. Enter the Name, Description. Select THUMBNAILCREATOR option in the FILTER dropdown. Then Click on Get Arguments button. The following screen appears.

 

 

 

 

 

 

 

 

3. In the ARGUMENTS Section, make sure that you specify values for all the options in the NAME drop down list. After adding all the values, the list should consist the following key – value pairs.

Output attribute for Thumb Height = ThumbnailHeight
Output attribute for Thumb Width = ThumbnailWidth
Output attribute name = ThumbnailFile
Input attribute name = ImageFile
Output attribute for Main Width = ImageWidth
Output attribute for Main Height = ImageHeight
Enter maximum pixel size = 100

NOTE: The Maximum pixel size is the size of the Thumbnail.

It should finally look like the following screen.

 

 

 

 

 

 

 

 

4. Click on Save.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ADDING THE FLEX FILTER TO THE CONTENT DEFINITION:

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

2. Add the Flex Attribute IMAGEFILE, which was created by us above.

3. After adding the above two, 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. The below screen appears:

 

 

 

 

1. Give a name to the asset, and upload an image.

2. Save it.

3. Click on the INSPECT button. You can see the result screen which has the image file, thumbnail file, image height, image width, thumbnail height, thumbnail width.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

We haven’t added the the attributes ThumbnailFile, ImageHeight, ImageWidth, ThumbnailWidth, ThumbnailHeight in our content definition. But still, they appeared in the element inspection screen.

So, the point to note here is that these 5 attributes are used internally by the filter class to store the dimensions (width and height) of the image and thumbnails, and to display them.

That’s it. We have successfully created the Thumbnail Creator 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.