Skip to Content
author's profile photo Former Member
Former Member

Updating KM Metadata properties using KM API

Hi All,

We are tring to update the custom Metadata properties using KM API from the Abstract Portal Component.

We have written the below code for updating the metadata.

We have checkbox called "Region" which has multiple option values like "Asia,America,Europe". I was able to update this property with single value. But when i try to update with multiple value it is not working. I tried with comma seperated but it didn't work.

Can somebody through light on this. How to update multiple values?

Code snippet

-


IUserManagementService service=(IUserManagementService)PortalRuntime.getRuntimeResources().getService(IUserManagementService.KEY);

com.sapportals.portal.security.usermanagement.IUser user =null;

user= service.getDefaultFactory().getEP5User(request.getUser());

IResourceContext context = new ResourceContext(user);

RID path = RID.getRID("/documents/src/ex1.doc");

IResource res = ResourceFactory.getInstance().getResource(path,context);

IPropertyName propName = new PropertyName("http://ars.com/xmlns/cm","Region");

IMutablePropertyMap map = new MutablePropertyMap();

IProperty property = new Property(propName,"Asia");//How to pass multiple Values?

map.put(property);

res.setProperty(property);

Helpful answer would be appreciated and Rewarded....

Regards,

Birla.

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 02:05 PM

    Hi Birla,

    try this:

    IResource res = ResourceFactory.getInstance().getResource(path,context);

    IPropertyName propName = new PropertyName("http://ars.com/xmlns/cm","Region");

    java.util.List values = new List();

    values.add("Asia");

    values.add("America");

    values.add("Muenster, Germany");

    IProperty property = new Property(propName, PropertyType.STRING, values);

    res.setProperty(property);

    Best regards,

    Michael

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 02:04 PM

    Hi,

    have a look at the JavaDocs for the Property class and you'll find some constructors for creating multi-valued properties:

    http://media.sdn.sap.com/html/submitted_docs/nw_kmc/javadoc/index.html

    Add comment
    10|10000 characters needed characters exceeded