return descriptor;
}
DefaultPolicyDescriptor descriptor = null;
Policy policy = definitions.getPolicy(policyName);
if (policy != null) {
// Create the basic policy descriptor
descriptor = new DefaultPolicyDescriptor();
// Set the descriptive name
String nameProperty =
DeviceRepositoryConstants.POLICY_RESOURCE_PREFIX +
policyName +
DeviceRepositoryConstants.NAME_PROPERTY_SUFFIX;
String name = createProperties(locale).getProperty(nameProperty);
if (name == null) {
descriptor.setPolicyDescriptiveName(policyName);
} else {
descriptor.setPolicyDescriptiveName(name);
}
descriptor.setLanguage((String) localeToLocaleFound.get(locale));
// Set the help
String descriptionProperty =
DeviceRepositoryConstants.POLICY_RESOURCE_PREFIX +
policyName +
DeviceRepositoryConstants.DESCRIPTION_PROPERTY_SUFFIX;
String help = createProperties(locale).getProperty(descriptionProperty);
if (help == null) {
descriptor.setPolicyHelp(policyName);
} else {
descriptor.setPolicyHelp(help);
}
// Set the category (short) name
descriptor.setCategory(policy.getCategory().getName());
// TODO: later: set the category long name/description as well so
// that the UpdateClient merge report can access it from there
// rather than using the old JDOM accessor code as it does now.
// Set the the type
// Work out the type of the policy.
final TypeContainer typeContainer = policy.getTypeContainer();
String typeName = typeContainer.getName();
Type type = typeContainer.getType();
if (typeName != null && type == null) {
// this is a reference to a declared type.
TypeDeclaration declaration = definitions.getType(typeName);