use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method deleteTrustPartners.
/**
* delete trusted partners.
*
* @param values a Set of trusted partners .
* @throws AMConsoleException if name cannot be set.
*/
public void deleteTrustPartners(Set values) throws AMConsoleException {
String schemaName = SAML_TRUSTED_PARTNERS;
String[] params = new String[3];
params[0] = SAML_SERVICE_NAME;
params[1] = "-";
params[2] = schemaName;
try {
AttributeSchema as = (AttributeSchema) attributeSchemas.get(schemaName);
Set orgValues = (Set) as.getDefaultValues();
orgValues.removeAll(values);
as.setDefaultValues(orgValues);
logEvent("SUCCEED_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", schemaName, strError };
logEvent("SSO_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", schemaName, strError };
logEvent("SMS_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method init.
private void init() {
String curSchemaType = "*";
try {
serviceSchemaManager = new ServiceSchemaManager(SAML_SERVICE_NAME, getUserSSOToken());
String i18nFileName = serviceSchemaManager.getI18NFileName();
if ((i18nFileName != null) && (i18nFileName.trim().length() > 0)) {
resBundle = AMResBundleCacher.getBundle(i18nFileName, getUserLocale());
}
String[] params = new String[3];
params[0] = SAML_SERVICE_NAME;
params[2] = "*";
Set schemaTypes = serviceSchemaManager.getSchemaTypes();
for (Iterator iter = schemaTypes.iterator(); iter.hasNext(); ) {
SchemaType type = (SchemaType) iter.next();
ServiceSchema schema = serviceSchemaManager.getSchema(type);
if (schema != null) {
curSchemaType = type.getType();
params[1] = curSchemaType;
logEvent("ATTEMPT_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
Set aschemas = schema.getAttributeSchemas();
for (Iterator i = aschemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
String i18n = as.getI18NKey();
if ((i18n != null) && (i18n.trim().length() > 0)) {
attributeSchemas.put(as.getName(), as);
}
}
logEvent("SUCCEED_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
}
}
} catch (SSOException e) {
String[] paramsEx = { SAML_SERVICE_NAME, "*", curSchemaType, getErrorString(e) };
logEvent("SSO_EXCEPTION_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
debug.error("FSSAMLServiceModelImpl.init", e);
} catch (SMSException e) {
String[] paramsEx = { SAML_SERVICE_NAME, "*", curSchemaType, getErrorString(e) };
logEvent("SMS_EXCEPTION_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
debug.error("FSSAMLServiceModelImpl.init", e);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class RMRealmModelImpl method getDataMap.
/**
* Returns Map of attribute name to empty set of values.
*
* @throws AMConsoleException if map cannot be obtained.
*/
public Map getDataMap() {
Map map = new HashMap();
try {
OrganizationConfigManager orgMgr = new OrganizationConfigManager(getUserSSOToken(), "/");
Set serviceSchemas = orgMgr.getServiceSchemas();
for (Iterator iter = serviceSchemas.iterator(); iter.hasNext(); ) {
ServiceSchema ss = (ServiceSchema) iter.next();
String serviceName = ss.getServiceName();
Set attrSchemas = ss.getAttributeSchemas();
for (Iterator i = attrSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
map.put(serviceName + "_" + as.getName(), Collections.EMPTY_SET);
}
}
} catch (SMSException e) {
debug.error("RMRealmModelImpl.getDataMap", e);
}
return map;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class RMRealmModelImpl method getDefaultValues.
/**
* Returns Map of default attribute values used when creating
* new realms. This only returns default values for single choice
* type attributes. Returning other default values runs the risk
* of violating the attribute uniqueness plugin while creating a
* new realm.
*
* @throws AMConsoleException if map cannot be obtained.
*/
public Map getDefaultValues() {
Map map = new HashMap();
try {
OrganizationConfigManager orgMgr = new OrganizationConfigManager(getUserSSOToken(), "/");
Set serviceSchemas = orgMgr.getServiceSchemas();
for (Iterator iter = serviceSchemas.iterator(); iter.hasNext(); ) {
ServiceSchema ss = (ServiceSchema) iter.next();
String serviceName = ss.getServiceName();
Set attrSchemas = ss.getAttributeSchemas();
for (Iterator i = attrSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
if (as.getType() == AttributeSchema.Type.SINGLE_CHOICE) {
map.put(serviceName + "_" + as.getName(), as.getDefaultValues());
}
}
}
} catch (SMSException e) {
debug.error("RMRealmModelImpl.getDefaultValues", e);
}
return map;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class CreateDataStore method getDefaultAttributeValues.
private Map getDefaultAttributeValues(SSOToken adminSSOToken) throws SMSException, SSOException {
ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, adminSSOToken);
ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
Set attrs = orgSchema.getAttributeSchemas();
Map values = new HashMap(attrs.size() * 2);
for (Iterator iter = attrs.iterator(); iter.hasNext(); ) {
AttributeSchema as = (AttributeSchema) iter.next();
values.put(as.getName(), as.getDefaultValues());
}
return values;
}
Aggregations