Example usage for org.apache.commons.collections.map CaseInsensitiveMap CaseInsensitiveMap

List of usage examples for org.apache.commons.collections.map CaseInsensitiveMap CaseInsensitiveMap

Introduction

In this page you can find the example usage for org.apache.commons.collections.map CaseInsensitiveMap CaseInsensitiveMap.

Prototype

public CaseInsensitiveMap(Map map) 

Source Link

Document

Constructor copying elements from another map.

Usage

From source file:com.mirth.connect.connectors.http.HttpRequestMessage.java

public void setHeaders(Map<String, List<String>> headers) {
    this.headers = headers;
    caseInsensitiveHeaders = new CaseInsensitiveMap(headers);
}

From source file:io.lightlink.oracle.OracleStructType.java

@Override
public Object convertToJdbc(Connection connection, RunnerContext runnerContext, String name, Object value)
        throws IOException, SQLException {
    OracleConnection con = unwrap(connection);

    if (!(value instanceof Map)) { // create a Map from bean
        Map map = new CaseInsensitiveMap(new BeanMap(value));
        map.remove("class");
        value = map;/*from w ww  .j  a v  a 2s  .  c o  m*/
    }

    return createStruct(con, (Map) value, getCustomSQLTypeName());

}

From source file:net.certifi.audittablegen.TableConfig.java

public void setColumns(Map<String, Map<String, String>> columns) {
    this.columns = new CaseInsensitiveMap(columns);
}

From source file:net.certifi.audittablegen.TableConfig.java

public CaseInsensitiveMap getExcludedColumns() {
    return new CaseInsensitiveMap(excludedColumns);
}

From source file:io.lightlink.oracle.OracleStructArrayType.java

@Override
public Object convertToJdbc(Connection connection, RunnerContext runnerContext, String name, Object value)
        throws IOException, SQLException {
    OracleConnection con = unwrap(connection);

    ArrayDescriptor arrayStructDesc = safeCreateArrayDescriptor(getCustomSQLTypeName(), con);

    if (value == null) {
        return null;
    } else if (value instanceof List || value.getClass().isArray()) {
        if (value.getClass().isArray()) {
            value = Arrays.asList((Object[]) value);
        }//  ww  w .j a v  a2 s.  co m

        List records = (List) value;

        STRUCT[] structArray = new STRUCT[records.size()];

        for (int i = 0; i < structArray.length; i++) {
            Object record = records.get(i);

            if (!(record instanceof Map)) { // create a Map from bean
                Map map = new CaseInsensitiveMap(new BeanMap(record));
                map.remove("class");
                record = map;
            }

            structArray[i] = createStruct(con, (Map) record, arrayStructDesc.getBaseName());
        }

        return new ARRAY(arrayStructDesc, con, structArray);

    } else {

        throw new IllegalArgumentException("Type " + getCustomSQLTypeName() + " of converter="
                + this.getClass().getName() + " accepts array/list of objects.");
    }
}

From source file:net.certifi.audittablegen.TableConfig.java

public CaseInsensitiveMap getIncludedColumns() {
    return new CaseInsensitiveMap(includedColumns);
}

From source file:com.thinkbiganalytics.feedmgr.nifi.NifiControllerServiceProperties.java

public Map<String, String> mergeNifiAndEnvProperties(Map<String, String> nifiProperties, String serviceName) {
    if (nifiProperties != null) {
        CaseInsensitiveMap propertyMap = new CaseInsensitiveMap(nifiProperties);
        String servicePrefix = NifiEnvironmentProperties
                .getEnvironmentControllerServicePropertyPrefix(serviceName);
        Map<String, Object> map = environmentProperties.getPropertiesStartingWith(servicePrefix);
        if (map != null && !map.isEmpty()) {
            for (Map.Entry<String, Object> entry : map.entrySet()) {
                String key = NifiEnvironmentProperties
                        .environmentPropertyToControllerServiceProperty(entry.getKey());
                if (propertyMap.containsKey(key) && entry.getValue() != null) {
                    propertyMap.put(key, entry.getValue());
                }/*from  w  ww  .  j  ava  2 s  .co m*/
            }
        }
        return propertyMap;
    }
    return null;
}

From source file:com.thinkbiganalytics.nifi.feedmgr.ConfigurationPropertyReplacer.java

/**
 * This will replace the Map of Properties in the DTO but not persist back to Nifi.  You need to call the rest client to persist the change
 *
 * @param controllerServiceDTO        the controller service
 * @param properties                  the properties to set
 * @param propertyDescriptorTransform transformer
 * @return {@code true} if the properties were updated, {@code false} if not
 *//*  w  w w.j  a va2 s. c o m*/
public static boolean replaceControllerServiceProperties(ControllerServiceDTO controllerServiceDTO,
        Map<String, String> properties, NiFiPropertyDescriptorTransform propertyDescriptorTransform) {
    Set<String> changedProperties = new HashSet<>();
    if (controllerServiceDTO != null) {
        //check both Nifis Internal Key name as well as the Displayname to match the properties
        CaseInsensitiveMap propertyMap = new CaseInsensitiveMap(properties);
        Map<String, String> controllerServiceProperties = controllerServiceDTO.getProperties();

        controllerServiceProperties.entrySet().stream()
                .filter(entry -> (propertyMap.containsKey(entry.getKey())
                        || (controllerServiceDTO.getDescriptors().get(entry.getKey()) != null
                                && propertyMap.containsKey(controllerServiceDTO.getDescriptors()
                                        .get(entry.getKey()).getDisplayName().toLowerCase()))))
                .forEach(entry -> {
                    boolean isSensitive = propertyDescriptorTransform
                            .isSensitive(controllerServiceDTO.getDescriptors().get(entry.getKey()));
                    String value = (String) propertyMap.get(entry.getKey());
                    if (StringUtils.isBlank(value)) {
                        value = (String) propertyMap.get(controllerServiceDTO.getDescriptors()
                                .get(entry.getKey()).getDisplayName().toLowerCase());
                    }
                    if (!isSensitive || (isSensitive && StringUtils.isNotBlank(value))) {
                        entry.setValue(value);
                        changedProperties.add(entry.getKey());
                    }

                });
    }
    return !changedProperties.isEmpty();
}

From source file:io.lightlink.oracle.AbstractOracleType.java

protected STRUCT createStruct(Connection con, Object value, String type) throws SQLException {

    if (value == null)
        return null;

    Map mapValue;//w  w w  .j  ava2  s  . c o  m
    if (value instanceof Map) {
        mapValue = (Map) value;
        mapValue = new CaseInsensitiveMap(mapValue);
    } else { // create a Map from bean
        Map map = new CaseInsensitiveMap(new BeanMap(value));
        map.remove("class");
        mapValue = map;
    }

    STRUCT struct;
    StructDescriptor structType = safeCreateStructureDescriptor(type, con);
    ResultSetMetaData stuctMeteData = structType.getMetaData();

    List<Object> orderedValues = new ArrayList<Object>();

    if (stuctMeteData.getColumnCount() == 1 && mapValue.size() == 1) {
        orderedValues.add(mapValue.values().iterator().next());
    } else {
        for (int col = 1; col <= stuctMeteData.getColumnCount(); col++) {
            Object v = mapValue.get(stuctMeteData.getColumnName(col));
            if (v == null) {
                v = mapValue.get(stuctMeteData.getColumnName(col).replaceAll("_", ""));
            }

            String typeName = stuctMeteData.getColumnTypeName(col);
            int columnType = stuctMeteData.getColumnType(col);
            if (columnType == OracleTypes.ARRAY) {
                v = createArray(con, v, typeName);
            } else if (columnType == OracleTypes.JAVA_STRUCT || columnType == OracleTypes.JAVA_OBJECT
                    || columnType == OracleTypes.STRUCT) {
                v = createStruct(con, v, typeName);
            }

            orderedValues.add(v);
        }
    }

    Object[] values = orderedValues.toArray();

    for (int j = 0; j < values.length; j++) {

        Object v = values[j];
        if (v instanceof Long && stuctMeteData.getColumnTypeName(j + 1).equalsIgnoreCase("TIMESTAMP")) {
            values[j] = new Timestamp((Long) v);
        } else if (v instanceof Long && stuctMeteData.getColumnTypeName(j + 1).equalsIgnoreCase("DATE")) {
            values[j] = new Date((Long) v);
        }

    }

    struct = new STRUCT(structType, con, values);

    return struct;
}

From source file:easycare.cuke.steps.support.UserCreateSupport.java

private void populateRolesLocationsAndOrganisation(Map<String, String> userRow, UserBuilder userBuilder) {
    Map<String, String> caseInsensitiveUserRow = new CaseInsensitiveMap(userRow);
    String rolesName = StepUtils.getMapAttributeWithDefault(caseInsensitiveUserRow,
            RoleEnum.ROLE_CLINICIAN.name(), "role", "user role");
    String organisationName = StepUtils.getMapAttributeWithDefault(caseInsensitiveUserRow,
            OrganisationBuilder.DEFAULT_ORG_NAME, "organisation", "organization");
    Organisation org = organisationBuilderService.createOrFindHMEOrganisation(organisationName);

    if (StringUtils.isNotBlank(rolesName)) {
        String[] rolesNameArray = rolesName.split(",");
        for (String name : rolesNameArray) {
            if (StringUtils.isNotBlank(name)) {
                Role role = roleBuilderService.findOrBuildRole(name.trim());
                userBuilder.withRoles(role);
                if (noOrgNameSuppliedForPhysicianUser(role.getName(), organisationName)) {
                    org = organisationBuilderService
                            .createOrFindSleepLab(OrganisationBuilder.DEFAULT_PHYSICIAN_ORG_NAME);
                }/*w ww .j  a v a  2 s.  c om*/
            }
        }
    }

    String locationsName = StepUtils.getMapAttribute(caseInsensitiveUserRow, "location", "locations");
    if (locationsName != null) {
        String[] locationsNamesArray = locationsName.split(",");
        for (String name : locationsNamesArray) {
            if (StringUtils.isNotBlank(name)) {
                Location location = locationBuilderService.findOrBuildLocation(org, name.trim());
                userBuilder.withLocations(location);
            }
        }
    }
    org = organisationBuilderService.initialize(organisationName);

    userBuilder.withOrganisation(org);
}