cancel
Showing results for 
Search instead for 
Did you mean: 

access to km repository from local java program

Former Member
0 Kudos

Hi

It's possible access to a km repository (and change file properties...) from a local application that runs on my pc? If yes can someone give me an example code?

Thanks!

Andrea

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You can access KM Repository from local java application.

The following packages need to be used...

1. com.sapportals.wcm.util.*

2. com.sapportals.wcm.repository.*.

The following code may be helpful for retreiving a property..

String namespace = "your namespace";

String name = "your property";

IPropertyName propertyName = new PropertyName(namespace, name);

IProperty property = resource.getProperty(propertyName);

if( property != null ) {

// property exists

String value = property.getValueAsString();

} else {

// property is not set for this resource

}

For setting a property,

boolean value = true;

IProperty property = new Property(propertyName, value);

resource.setProperty(property);

For changing a property, use IMutableProperty..

IMutableProperty mutableProperty = property.getMutable();

mutableProperty.setBooleanValue(true);

resource.setProperty(property);

Hope, this sample code from SDN may be helpful to you....