use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class EntitiesModelImpl method getPropertiesViewBean.
/**
* Returns properties view bean URL for an attribute schema.
*
* @param name Name of attribute schema.
* @return properties view bean URL for an attribute schema.
*/
public String getPropertiesViewBean(String name) {
String url = null;
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(name, adminSSOToken);
ServiceSchema schema = mgr.getSchema(SchemaType.USER);
Set attributeSchemas = schema.getAttributeSchemas();
for (Iterator i = attributeSchemas.iterator(); i.hasNext() && (url == null); ) {
AttributeSchema as = (AttributeSchema) i.next();
if (as.getName().equals(name)) {
url = as.getPropertiesViewBeanURL();
}
}
} catch (SMSException e) {
debug.warning("EntitiesModelImpl.getDefaultValues", e);
} catch (SSOException e) {
debug.warning("EntitiesModelImpl.getDefaultValues", e);
}
return url;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class EntitiesModelImpl method hasAttributeSchema.
private boolean hasAttributeSchema(String serviceName, SchemaType type) {
boolean hasAttributes = false;
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, getUserSSOToken());
ServiceSchema schema = mgr.getSchema(type);
if (schema != null) {
Set attributeSchemas = schema.getAttributeSchemas();
if ((attributeSchemas != null) && !attributeSchemas.isEmpty()) {
hasAttributes = hasI18nKeys(attributeSchemas);
}
}
} catch (SMSException e) {
debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
} catch (SSOException e) {
debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
}
return hasAttributes;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class EntitiesModelImpl method discardServicesWithoutAttributeSchema.
private void discardServicesWithoutAttributeSchema(Set serviceNames, AMIdentity amid) {
for (Iterator iter = serviceNames.iterator(); iter.hasNext(); ) {
String serviceName = (String) iter.next();
String url = getServicePropertiesViewBeanURL(serviceName);
if (url == null) {
ServiceSchema serviceSchema = AMAdminUtils.getSchemaSchema(serviceName, amid.getType());
Set attributes = serviceSchema.getAttributeSchemas();
if ((attributes == null) || attributes.isEmpty()) {
iter.remove();
} else if (!hasI18nKeys(attributes)) {
iter.remove();
}
}
}
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AMSDKRepo method getDefaultAgentContainerName.
private String getDefaultAgentContainerName() {
String gcName = "Agent";
try {
ServiceSchemaManager ssm = new ServiceSchemaManager(ADMIN_SERVICE, adminToken);
if (ssm != null) {
ServiceSchema ss = ssm.getGlobalSchema();
if (ss != null) {
Map attrs = ss.getAttributeDefaults();
Set vals = (Set) attrs.get(AC_ATTR);
if (vals != null && !vals.isEmpty())
gcName = (String) vals.iterator().next();
}
}
} catch (SMSException smse) {
debug.error("AMSDKRepo.getDefaultAC: SMSException: ", smse);
} catch (SSOException ssoe) {
debug.error("AMSDKRepo.getDefaultAC: SSOException", ssoe);
}
return gcName;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AMServiceUtils method getServiceAttributeNames.
/**
* Get attribute names for the specified Service and Schema Type
*
* @param token
* SSOToken a valid SSOToken
* @param serviceName
* the service name
* @param type
* the SchemaType
* @return the Set of attribute names for that specified Service and Schema
* Type
*/
protected static Set getServiceAttributeNames(SSOToken token, String serviceName, SchemaType type) throws SMSException, SSOException {
ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, token);
ServiceSchema ss = null;
try {
ss = ssm.getSchema(type);
} catch (SMSException sme) {
if (debug.warningEnabled()) {
debug.warning("AMServiceUtils.getServiceAttributeNames():" + " No schema defined for " + type);
}
}
if ((ss == null) || (type == SchemaType.POLICY)) {
return Collections.EMPTY_SET;
}
return ss.getAttributeSchemaNames();
}
Aggregations