cancel
Showing results for 
Search instead for 
Did you mean: 

Custom properties for ABAP Connector

Former Member
0 Kudos

Hi Experts.

I found this blog on how to set custom properties on KM controlled repositories:  http://scn.sap.com/docs/DOC-59351

But can anybody tell me how you do this via the ABAP connector ?

Thanks.

Søren Hansen

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Søren,

this has to be done in the individual ABAP implementations. Mobile Documents only offers an ABAP API which can be implemented to expose content from ABAP backends in the way you like through Mobile Documents. And if you need a special set of properties this has to be considered in the implementation.

Best regards

Alex

Former Member
0 Kudos

Hi Alex.

I understand this. I just need some details on where exactly to code this.

Currently we have a POC running, where we can get files to our mobile clients.

It has been implemented by one of your colleagues in Germany, but currently we are only using cmis standard attributes on the files. I would like to know where exactly to put the custom ones.

I assume it must be added somewhere in the structure CMIS_S_OBJECT.

And probably in the subelement PROPERTIES-PROPERTIES.

But I need to know the syntax, and prerequisites (if any).

Thanks.

Søren Hansen

0 Kudos

Hi Søren,

in general to add custom properties you have to define them in the type model. So you have to implement the methods get_type_definition, get_type_decendants and get_type_children. To add custom properties you can either extend the two base types cmis:documents and cmis:folder and add your properties to the existing property definition or you can create secondary object types which can be attached to each cmis object. (Please refer to the cmis spec for more information)

After you have extended the type model with your property you can add it to the cmis objects itself, this can be done then in a similar way as you fill the already existing default properties.

Best regards

Alex

Former Member
0 Kudos

Hi Alex.

You answer is very similar to what I received from your colleague yesterday by mail (maybe it is not a coincidence ).

I am sorry to say, but I find the description unclear.

The CMIS protocol seems very strict from my view point, and I don't suppose I can just add any properties to the base type "cmis:document".

Can you be a little bit more specific on how to add the custom properties ?

I guess I need to do something like this:

In get_type_definition for "cmis:document" add new properties.

But what are the restrictions of the properties ?

Must it be with id "cmis:secondary" or can I choose any naming ?

How does the Mobile Documents client know exactly which properties to display as custom properties ?

Correspondingly we need to set the property values in get_object method (I guess) ?

It would be nice if an example could be provided maybe just in xml or some Java code, to see exactly how some properties are defined, and values are assigned to them.

Thanks.

Søren Hansen

0 Kudos

Hi Søren,

I was not aware of that mail. So sorry for that 🙂

It is correct the cmis protocoll is quite strict when it comes to properties and it defines a set of default properties that have to be there. Nevertheless you are allowed to add your own propterties to the existing base types or create new subtypes from cmis:document and cmis:folder.

Also when it comes to names it's up to you how to name them. The only thing you have to take care is to choose the right parent type.

The rest is more or less as you say you have to add your property to the type definiton in the property definitions and fill it in the get_object (basically everywhere where this object could be returned e.g. also get_children get_descendants etc.)

I can prepare a small example on how to add a property to the existing types and how to create a secondary object type (just give me one or two days)

Would this help?

In addition I also can recommend the follwing book:

http://www.amazon.com/Apache-Chemistry-Action-Florian-M%C3%BCller/dp/1617291153/ref=sr_1_5?ie=UTF8&q...

it's more readable than the specification.

Thanks

Alex

Former Member
0 Kudos

Hi Alex.

It is great that your answer this thread, so others may also benefit from your knowledge.

If you could add a small simple example, that would be very much appreciated, and may also be helpful for others.

Thanks a lot.

Søren Hansen

0 Kudos

Hi Søren,

here is a small example how to extend the type definition:

"Create a new document type
Data: ls_extended_type type cmis_s_type_definition,
ls_custom_property
type cmis_s_property_definition.

FIELD-SYMBOLS <fs_prop_def> like LINE OF ls_extended_type-property_definitions.

"Get the cmis:document base type (ignore the import parameter)
ls_extended_type
= cl_cmis_object_factory=>create_document_type( ).

"As we are creating a subtype the property definitions from the base type need to be
"set to inherited
LOOP AT ls_extended_type-property_definitions ASSIGNING <fs_prop_def>.
<fs_prop_def>
-inherited = abap_true.
ENDLOOP.

"Now we change the name to our wishes
ls_extended_type
-id = 'custom:document'.
ls_extended_type
-local_name = 'Custom Document'.
ls_extended_type
-display_name = 'My Custom Document'.
ls_extended_type
-query_name = 'custom:document'.
ls_extended_type
-description = 'My first custom type'.
ls_extended_type
-local_namespace = 'com.custom.type'.
ls_extended_type
-parent_id = cl_cmis_constants=>base_type_id-cmis_document.

"The other attributes can stay as they are or if for your scenario neccessary
"adaped according to the CMIS spec. Below you see the current settings
*    ls_extended_type-creatable = abap_true.
*    ls_extended_type-fileable = abap_true.
*    ls_extended_type-queryable = abap_true.
*    ls_extended_type-full_text_indexed = abap_false.
*    ls_extended_type-included_in_supertype_query = abap_false.
*    ls_extended_type-controllable_policy = abap_false.
*    ls_extended_type-controllable_acl = abap_true.
*    ls_extended_type-type_mutability-create = abap_false.
*    ls_extended_type-type_mutability-delete = abap_false.
*    ls_extended_type-type_mutability-update = abap_false.

"Now we add our custom property
ls_custom_property
-id = 'myTypes:stringProperty'.
ls_custom_property
-local_name = 'myTypes:stringProperty'.
ls_custom_property
-local_namespace = 'com.custom.type'.
ls_custom_property
-display_name = 'My String Property'.
ls_custom_property
-query_name = 'myTypes:stringProperty'.
ls_custom_property
-description = 'This is my first string property'.
ls_custom_property
-property_type = cl_cmis_constants=>property_type-string.
ls_custom_property
-cardinality = cl_cmis_constants=>cardinality-single.
ls_custom_property
-updatability = cl_cmis_constants=>updatability-read_write.
ls_custom_property
-inherited = abap_false.

"Refer to the spec if those settings suit your scenario
ls_custom_property
-required = abap_false.
ls_custom_property
-queryable = abap_false.
ls_custom_property
-orderable = abap_false.
ls_custom_property
-openchoice = abap_true.

"Add it to the type
APPEND ls_custom_property to ls_extended_type-property_definitions.
clear ls_custom_property.
"Repeat for more properties

"Create a secondary type
DATA: ls_secondary_type TYPE cmis_s_type_definition.

ls_secondary_type
-id = 'custom:mySecondaryType'.
ls_secondary_type
-local_name = 'Custom Secondary Type'.
ls_secondary_type
-display_name = 'My Secondary Type'.
ls_secondary_type
-query_name = 'custom:mySecondaryType'.
ls_secondary_type
-description = 'My first secondary type'.
ls_secondary_type
-local_namespace = 'com.custom.type'.
ls_secondary_type
-parent_id = cl_cmis_constants=>base_type_id-cmis_secondary.
ls_secondary_type
-base_id = cl_cmis_constants=>base_type_id-cmis_secondary.


"These settings must not be changed
ls_secondary_type
-creatable                   = abap_false.
ls_secondary_type
-fileable                    = abap_false.

ls_secondary_type-controllable_policy         = abap_false.
ls_secondary_type
-controllable_acl            = abap_false.


"Adapt the rest of the values according to your needs
ls_secondary_type
-queryable                   = abap_false.
ls_secondary_type
-full_text_indexed           = abap_false.
ls_secondary_type
-included_in_supertype_query = abap_false.
ls_secondary_type-type_mutability-create      = abap_false.
ls_secondary_type
-type_mutability-delete      = abap_false.
ls_secondary_type
-type_mutability-update      = abap_false.

"For the property definitions do follow the above example

The let Mobile Documents know your new types you have to adapt the three type related methods: get_type_definition, get_type_children and get_type_descendants. Ensure that you also provide the base types and not only your own type definitions. If you only want to add a custom property to “cmis:document” or “cmis:Folder” just add the properties like in the examples above.

To fill the properties on the objects just proceed as if they were one of the default properties. In case of a secondary type you need to add your secondary type id to the “cmis:secondaryTypeIds” property (only if a secondary type applies for that object).

I hope that helps to define your own custom type.

Best regards
Alex

Former Member
0 Kudos

Hi Alex.

It is very much appreciated. I am leaving for vacation today, so it will be at least 3 weeks until I will have time to test it.

I already tried extending the base type "cmis:document" in a way that is similar to your custom property, but it did not appear in the Web based Mobile Docs client ( I did modify the methods get_type_definition, get_type_children and get_type_descendants accordingly).

I did not, however, create the secondary type.

Can you briefly explain the relationship and the roles of the Custom Property and the Secondary Type ?

Are both needed ?

And are they related in any way (to me it does not seem so) ?

And one more thing, will the custom properties be displayed even if no value is assigned to them (via get_object method) ?

Thanks a lot for the assistance.

Søren Hansen