cancel
Showing results for 
Search instead for 
Did you mean: 

Updating KM Metadata properties using KM API

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

former_member189326
Active Participant
0 Kudos

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