on 11-23-2005 5:05 AM
Hello,
I am creating and setting the custom properties using KM APIs
Here is a code for that
IResource resource= ResourceFactory.getInstance().getResource(aRid, rContext);
IPropertyName propertyName = (IPropertyName)new PropertyName(NAMESPACE, "Test");
IProperty propertyValued = (IProperty)resource.getProperty(propertyName);
if (propertyValued == null) {
propertyValued = new Property(propertyName,"testing123");
resource.setProperty(propertyValued);
}
But I am getting a null pointer exception.
Can anybody suggest?
Thanks
Raj
Hi Raj
I tried this for a custom property(named Department).
// getting and setting the properties of a KM Document(Property Name:Department)
IPropertyName propName = (IPropertyName) new PropertyName("http://sapportals.com/xmlns/cm", "Department");
IProperty prop = aResource.getProperty(propName);
IMutableProperty mutableProp = prop.getMutable();
mutableProp.setStringValue("Finance");
aResource.setProperty(mutableProp);
This code works for the properties that are not readonly.
Regards
Geogi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello raj,
instead of using IProperty propertyValued = (IProperty)resource.getProperty(propertyName);
,try using
IMutableProperty propertyValued = (IMutableProperty)resource.getProperty(propertyName);
with regards,
srinath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please let us know some details on the NPE first, things like the stack trace and the reason.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.