use of java.util.LinkedHashSet in project OpenAM by OpenRock.
the class ScriptConfigurationDataStore method get.
@Override
public Set<ScriptConfiguration> get(QueryFilter<String> queryFilter) throws ScriptException {
final Set<ScriptConfiguration> scriptConfigurations = new LinkedHashSet<>();
try {
ServiceConfig config = getSubOrgConfig();
Set<String> uuids = config.getSubConfigNames();
for (String uuid : uuids) {
if (queryFilter.accept(new ServiceConfigQueryFilterVisitor(), config.getSubConfig(uuid))) {
scriptConfigurations.add(get(uuid));
}
}
config = getSubGlobalConfig();
uuids = config.getSubConfigNames();
for (String uuid : uuids) {
if (queryFilter.accept(new ServiceConfigQueryFilterVisitor(), config.getSubConfig(uuid))) {
scriptConfigurations.add(get(uuid));
}
}
} catch (SMSException | SSOException e) {
throw createAndLogError(logger, RETRIEVE_ALL_FAILED, e, realm);
} catch (UnsupportedOperationException e) {
throw createAndLogError(logger, ScriptErrorCode.valueOf(e.getMessage()), e);
}
return scriptConfigurations;
}
use of java.util.LinkedHashSet in project OpenAM by OpenRock.
the class ScriptConfigurationDataStore method getAll.
@Override
public Set<ScriptConfiguration> getAll() throws ScriptException {
final Set<ScriptConfiguration> scriptConfigurations = new LinkedHashSet<>();
try {
ServiceConfig config = getSubOrgConfig();
Set<String> uuids = config.getSubConfigNames();
for (String uuid : uuids) {
scriptConfigurations.add(scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead()));
}
config = getSubGlobalConfig();
uuids = config.getSubConfigNames();
for (String uuid : uuids) {
scriptConfigurations.add(scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead()));
}
} catch (SSOException | SMSException e) {
throw createAndLogError(logger, RETRIEVE_ALL_FAILED, e, realm);
}
return scriptConfigurations;
}
use of java.util.LinkedHashSet in project OpenAM by OpenRock.
the class DJLDAPv3Repo method constructFilter.
protected Filter constructFilter(int operation, Map<String, Set<String>> attributes) {
if (attributes == null || attributes.isEmpty()) {
return null;
}
Set<Filter> filters = new LinkedHashSet<Filter>(attributes.size());
for (Map.Entry<String, Set<String>> entry : attributes.entrySet()) {
for (String value : entry.getValue()) {
filters.add(Filter.valueOf(entry.getKey() + "=" + partiallyEscapeAssertionValue(value)));
}
}
Filter filter;
switch(operation) {
case OR_MOD:
filter = Filter.or(filters);
break;
case AND_MOD:
filter = Filter.and(filters);
break;
default:
//falling back to AND
filter = Filter.and(filters);
}
if (DEBUG.messageEnabled()) {
DEBUG.message("constructFilter returned filter: " + filter.toString());
}
return filter;
}
use of java.util.LinkedHashSet in project android_frameworks_base by ResurrectionRemix.
the class NetworkPolicyManagerServiceTest method testNextCycleSane.
public void testNextCycleSane() throws Exception {
final NetworkPolicy policy = new NetworkPolicy(sTemplateWifi, 31, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED, false);
final LinkedHashSet<Long> seen = new LinkedHashSet<Long>();
// walk forwards, ensuring that cycle boundaries don't get stuck
long currentCycle = computeNextCycleBoundary(parseTime("2011-08-01T00:00:00.000Z"), policy);
for (int i = 0; i < 128; i++) {
long nextCycle = computeNextCycleBoundary(currentCycle, policy);
assertEqualsFuzzy(DAY_IN_MILLIS * 30, nextCycle - currentCycle, DAY_IN_MILLIS * 3);
assertUnique(seen, nextCycle);
currentCycle = nextCycle;
}
}
use of java.util.LinkedHashSet in project OpenAM by OpenRock.
the class AMPropertySheet method setValuesToMapList.
private boolean setValuesToMapList(View view, String name, Object values, AMModel amModel, AMPropertySheetModel model) {
boolean set = false;
if (CCMapList.class.isInstance(view)) {
((CCMapList) view).resetStateData();
CCMapListModel m = (CCMapListModel) model.getModel(name);
if (Set.class.isInstance(values)) {
Set v = new LinkedHashSet();
v.addAll((Set) values);
v.remove("[]=");
m.setOptionList(AMViewBeanBase.createOptionList(v, amModel.getUserLocale(), false));
}
set = true;
}
return set;
}
Aggregations