on 08-09-2006 11:58 AM
Hello,
I need to read the properties (and their data) that I created (content manager -> global services -> propertie metadata -> properties) using java.
Can anyone provide me some help, or examples.
THX
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public static String getPropertyValueOfResource(String path, String namespace, String name)
{
try
{
RID file = RID.getRID(path);
IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext rContext = new ResourceContext(user);
IResource fileResource = ResourceFactory.getInstance().getResource(file, rContext);
IPropertyName pName = new PropertyName(namespace, name);
IProperty property = fileResource.getProperty(pName);
return property.getValueAsString();
}
catch(NullPointerException E)
{
return null;
}
catch(UserManagementException e)
{
return null;
}
catch(ResourceException e)
{
return null;
}
}
public static String[] getAllowedPropertyValues(String propertyId, String namespace)
{
try
{
IPropertyConfigurationService propConfigService =
(IPropertyConfigurationService)ResourceFactory.getInstance().getServiceFactory().
getService("PropertyConfigurationService");
IMetaModel metaModel = propConfigService.getMetaModel();
IPropertyName propertyName = new PropertyName(namespace, propertyId);
IMetaName metaName = metaModel.searchByPropertyName(propertyName);
IMetaValueListIterator iterator = metaName.allowedValueIterator();
String values = "";
while(iterator.hasNext())
{
IMetaValue m = iterator.next();
values += m.getValue() + ";";
}
return values.split(";");
}
catch (ResourceException e)
{
return null;
}
catch (PropertyConfigurationServiceException e)
{
return null;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.