Search in sources :

Example 51 with LinkedHashSet

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ServiceConfigQueryFilterVisitor(org.forgerock.openam.sm.ServiceConfigQueryFilterVisitor) ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) ScriptConfiguration(org.forgerock.openam.scripting.service.ScriptConfiguration) SSOException(com.iplanet.sso.SSOException)

Example 52 with LinkedHashSet

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) ScriptConfiguration(org.forgerock.openam.scripting.service.ScriptConfiguration) SSOException(com.iplanet.sso.SSOException)

Example 53 with LinkedHashSet

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) CaseInsensitiveHashSet(com.sun.identity.common.CaseInsensitiveHashSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) CollectionUtils.asSet(org.forgerock.openam.utils.CollectionUtils.asSet) Filter(org.forgerock.opendj.ldap.Filter) ByteString(org.forgerock.opendj.ldap.ByteString) Map(java.util.Map) HashMap(java.util.HashMap) CaseInsensitiveHashMap(com.sun.identity.common.CaseInsensitiveHashMap)

Example 54 with LinkedHashSet

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;
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) NetworkPolicy(android.net.NetworkPolicy) EasyMock.anyLong(org.easymock.EasyMock.anyLong)

Example 55 with LinkedHashSet

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCMapListModel(com.sun.identity.console.ui.model.CCMapListModel) CCMapList(com.sun.identity.console.ui.view.CCMapList)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)3111 ArrayList (java.util.ArrayList)632 Set (java.util.Set)410 HashSet (java.util.HashSet)334 HashMap (java.util.HashMap)312 Map (java.util.Map)284 List (java.util.List)269 File (java.io.File)266 LinkedHashMap (java.util.LinkedHashMap)257 IOException (java.io.IOException)240 Test (org.junit.Test)239 LinkedList (java.util.LinkedList)139 Collection (java.util.Collection)103 URL (java.net.URL)83 ProcessResult (org.asqatasun.entity.audit.ProcessResult)76 Iterator (java.util.Iterator)73 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)73 TreeMap (java.util.TreeMap)70 TreeSet (java.util.TreeSet)70 Collectors (java.util.stream.Collectors)69