Create fields for custom media gallery object types
Add fields to contain information about custom object type media gallery photos and videos. After creating fields, create labels for each field.
Before starting
Create an .ear file that declares an OSGi extension that uses JavaScriptâ„¢ to define your custom fields. For additional information about creating an IBM Websphere Application Server OSGi extension, see the WAS documentation about plugin.xml.
About this task
To include your fields with photos and videos users upload to media galleries, you define the fields as "logical types" within a CMIS object type definition. For example, you can define a photo object type such that photos of that type display a search term field for users to type a search term and perform a search of the public IBM web site. You can create a new object type or add custom logical types to existing definitions.After adding custom fields to an object type, create labels and descriptions to display with those fields. For example, for the search term field you could create the field title "Search term" and the description, "IBM search keyword."
Procedure
- Create an .ear file defining your fields. For example, right-click this link to download an OSGi plugin defining a searchTerm logical type: CustomRenderers.ear
- Create a CMIS object type definition document that includes definitions for your custom logical types. See Work with CMIS API object types.
Note: In the localName element use the name of the logical type, for example searchTerm. In the localNamespace element use the following namespace: http://www.ibm.com/xmlns/prod/sn/cmis/logicaltypes
For example, this photo object type definition includes definitions for search term, date and time fields:
<?xml version="1.0" encoding="UTF-8"?> <cmisra:type xsi:type="cmis:{http://docs.oasis-open.org/ns/cmis/core/200908/}cmisTypeDocumentDefinitionType" xmlns:cmism="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:lcmis="http://www.ibm.com/xmlns/prod/sn/cmis" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"> <cmis:localName>photo2</cmis:localName> <cmis:localNamespace>http://www.ibm.com/xmlns/prod/sn/cmis/socialmedia</cmis:localNamespace> <lcmis:displayNameKey>photo2_title_key</lcmis:displayNameKey> <cmis:queryName>custom:photo2</cmis:queryName> <lcmis:descriptionKey>photo2_summary_key</lcmis:descriptionKey> <cmis:baseId>cmis:document</cmis:baseId> <cmis:parentId>snx:file</cmis:parentId> <cmis:creatable>true</cmis:creatable> <cmis:fileable>false</cmis:fileable> <cmis:queryable>true</cmis:queryable> <cmis:fulltextIndexed>false</cmis:fulltextIndexed> <cmis:includedInSupertypeQuery>true</cmis:includedInSupertypeQuery> <cmis:controllablePolicy>false</cmis:controllablePolicy> <cmis:controllableACL>false</cmis:controllableACL> <cmis:versionable>false</cmis:versionable> <cmis:contentStreamAllowed>required</cmis:contentStreamAllowed> <cmis:propertyStringDefinition> <cmis:localName>searchTerm</cmis:localName> <cmis:localNamespace>http://www.ibm.com/xmlns/prod/sn/cmis/logicaltypes</cmis:localNamespace> <lcmis:displayNameKey>photo1_string1_key</lcmis:displayNameKey> <cmis:queryName>custom:string1</cmis:queryName> <lcmis:descriptionKey>photo1_string1_summary_key</lcmis:descriptionKey> <cmis:propertyType>string</cmis:propertyType> <cmis:cardinality>single</cmis:cardinality> <cmis:updatability>readwrite</cmis:updatability> <cmis:inherited>false</cmis:inherited> <cmis:required>false</cmis:required> <cmis:queryable>true</cmis:queryable> <cmis:orderable>true</cmis:orderable> <cmis:openChoice>false</cmis:openChoice> <cmis:maxLength>64</cmis:maxLength> </cmis:propertyStringDefinition> <cmis:propertyDateTimeDefinition> <cmis:localName>date</cmis:localName> <cmis:localNamespace>http://www.ibm.com/xmlns/prod/sn/cmis/logicaltypes</cmis:localNamespace> <lcmis:displayNameKey>photo1_date2_key</lcmis:displayNameKey> <cmis:queryName>custom:date1</cmis:queryName> <lcmis:descriptionKey>photo1_date2_summary_key</lcmis:descriptionKey> <cmis:propertyType>datetime</cmis:propertyType> <cmis:cardinality>single</cmis:cardinality> <cmis:updatability>readwrite</cmis:updatability> <cmis:inherited>false</cmis:inherited> <cmis:required>false</cmis:required> <cmis:queryable>true</cmis:queryable> <cmis:orderable>true</cmis:orderable> <cmis:openChoice>false</cmis:openChoice> </cmis:propertyDateTimeDefinition> <cmis:propertyDateTimeDefinition> <cmis:localName>time</cmis:localName> <cmis:localNamespace>http://www.ibm.com/xmlns/prod/sn/cmis/logicaltypes</cmis:localNamespace> <lcmis:displayNameKey>photo1_time1_key</lcmis:displayNameKey> <cmis:queryName>custom:time1</cmis:queryName> <lcmis:descriptionKey>photo1_time1_summary_key</lcmis:descriptionKey> <cmis:propertyType>datetime</cmis:propertyType> <cmis:cardinality>single</cmis:cardinality> <cmis:updatability>readwrite</cmis:updatability> <cmis:inherited>false</cmis:inherited> <cmis:required>false</cmis:required> <cmis:queryable>true</cmis:queryable> <cmis:orderable>true</cmis:orderable> <cmis:openChoice>false</cmis:openChoice> </cmis:propertyDateTimeDefinition> </cmisra:type>
- Add labels and descriptions to display your custom logical type information in the user interface.
- Open the com.ibm.lconn.files.strings.cmis_en.properties file to create text for browsers displaying English.
- Add key value pairs to define display text for the logical types. Typically you would create value pairs for the field name (the displayNameKey property) and description (the descriptionKey property). For example:
photo2_title_key=Custom Photo photo2_summary_key=Description of custom photo photo1_string1_key=Search term photo1_string1_summary_key=IBM search keyword photo1_date2_key=Date taken photo1_date2_summary_key=Date that photo was taken photo1_time1_key=Time taken photo1_time1_summary_key=Time that photo was takenNote: See Add labels to media gallery fields.
- Import the CMIS object type definition into IBM Connections. See Create custom media gallery object types.
Parent topic
Create custom media gallery object types
Related tasks
Add labels to media gallery fieldsRelated reference
Work with CMIS API object types