Skip to content

Commit

Permalink
[CSVDIR-19] #resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Jan 25, 2019
1 parent ee191f3 commit 07be540
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 49 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<!--
Copyright (C) 2011 ConnId ([email protected])
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
ConnIdCSVDirBundle
==============

Expand Down
61 changes: 31 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>net.tirasa.connid</groupId>
<artifactId>connid</artifactId>
<version>1.4.1.0</version>
<version>1.4.5.1</version>
</parent>

<groupId>net.tirasa.connid.bundles</groupId>
Expand Down Expand Up @@ -76,7 +76,7 @@
</mailingLists>

<properties>
<connid.version>1.4.1.0</connid.version>
<connid.version>1.4.5.1</connid.version>

<hsqldb.version>2.3.5</hsqldb.version>
<test.source.path>${project.build.directory}/test-source-path</test.source.path>
Expand All @@ -88,7 +88,7 @@
<dependency>
<groupId>net.tirasa.connid.commons</groupId>
<artifactId>commons-db</artifactId>
<version>1.4.1.0</version>
<version>1.4.1.1</version>
</dependency>

<dependency>
Expand All @@ -114,56 +114,58 @@

<build>
<plugins>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<inherited>true</inherited>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.11</version>
<inherited>false</inherited>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.13</version>
<configuration>
<header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
<properties>
<owner>ConnId</owner>
<email>[email protected]</email>
</properties>
<excludes>
<exclude>**/LICENSE*</exclude>
<exclude>**/NOTICE*</exclude>
<exclude>**/*.pfx</exclude>
<exclude>**/*.dll</exclude>
<exclude>**/*.so</exclude>
<exclude>**/*.jnilib</exclude>
<exclude>nbactions.xml</exclude>
<exclude>nb-configuration.xml</exclude>
<exclude>**/nbactions.xml</exclude>
<exclude>**/nb-configuration.xml</exclude>
<exclude>**/META-INF/cxf/**</exclude>
<exclude>**/META-INF/services/**</exclude>
<exclude>**/*.css</exclude>
<exclude>**/*.js</exclude>
<exclude>**/META-INF/MANIFEST.MF</exclude>
<exclude>**/*.csv</exclude>
<exclude>**/archetype-resources/**</exclude>
<exclude>**/AdminLTE*/**</exclude>
<exclude>**/goal.txt</exclude>
<exclude>**/rat.txt</exclude>
<exclude>**/build-copy-javadoc-files.xml</exclude>
<exclude>**/maven-eclipse.xml</exclude>
<exclude>**/*.iml</exclude>
<exclude>**/*.log</exclude>
<exclude>.externalToolBuilders/**</exclude>
<exclude>**/.externalToolBuilders/**</exclude>
<exclude>.git/**</exclude>
<exclude>.idea/**</exclude>
<exclude>**/*.csv*</exclude>
<exclude>**/.settings/**</exclude>
<exclude>**/.*</exclude>
<exclude>**/deb/control/conffiles</exclude>
<exclude>**/deb/control/control</exclude>
<exclude>**/*.lst</exclude>
<exclude>**/*.json</exclude>
<exclude>**/banner.txt</exclude>
<exclude>**/target/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>rat-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -181,7 +183,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-artifact-legal-files</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.identityconnectors.framework.common.objects.filter.ContainsFilter;
import org.identityconnectors.framework.common.objects.filter.EndsWithFilter;
import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
import org.identityconnectors.framework.common.objects.filter.EqualsIgnoreCaseFilter;
import org.identityconnectors.framework.common.objects.filter.GreaterThanFilter;
import org.identityconnectors.framework.common.objects.filter.GreaterThanOrEqualFilter;
import org.identityconnectors.framework.common.objects.filter.LessThanFilter;
Expand Down Expand Up @@ -106,7 +107,46 @@ protected FilterWhereBuilder createEqualsExpression(final EqualsFilter filter, f
// Normalize NULLs
ret.addNull(param.getName());
} else {
ret.addBind(param, "=");
ret.addBind(param, "=", false);
}
}

ret.getWhere().append(")");

return ret;
}

@Override
protected FilterWhereBuilder createEqualsIgnoreCaseExpression(
final EqualsIgnoreCaseFilter filter, final boolean not) {

final Attribute attribute = filter.getAttribute();
if (!validateSearchAttribute(attribute)) {
return null;
}

final SQLParam[] params = getSQLParam(attribute, oclass, options);
if (params == null) {
return null;
}

final FilterWhereBuilder ret = createBuilder();
ret.getWhere().append("(");
if (not) {
ret.getWhere().append("NOT ");
}

for (int i = 0; i < params.length; i++) {
final SQLParam param = params[i];
if (i > 0) {
ret.getWhere().append(" AND ");
}

if (param.getValue() == null) {
// Normalize NULLs
ret.addNull(param.getName());
} else {
ret.addBind(param, "=", true);
}
}

Expand Down Expand Up @@ -156,8 +196,8 @@ protected FilterWhereBuilder createContainsExpression(final ContainsFilter filte
}
ret.addBind(
new SQLParam(param.getName(),
value,
param.getSqlType()), "LIKE");
value,
param.getSqlType()), "LIKE", false);
}
}
ret.getWhere().append(")");
Expand Down Expand Up @@ -202,8 +242,8 @@ protected FilterWhereBuilder createEndsWithExpression(final EndsWithFilter filte
}
ret.addBind(
new SQLParam(param.getName(),
value,
param.getSqlType()), "LIKE");
value,
param.getSqlType()), "LIKE", false);
}
}
ret.getWhere().append(")");
Expand All @@ -213,7 +253,6 @@ protected FilterWhereBuilder createEndsWithExpression(final EndsWithFilter filte

@Override
protected FilterWhereBuilder createStartsWithExpression(final StartsWithFilter filter, final boolean not) {

final Attribute attribute = filter.getAttribute();
if (!validateSearchAttribute(attribute)) {
return null;
Expand Down Expand Up @@ -249,8 +288,8 @@ protected FilterWhereBuilder createStartsWithExpression(final StartsWithFilter f
}
ret.addBind(
new SQLParam(param.getName(),
value,
param.getSqlType()), "LIKE");
value,
param.getSqlType()), "LIKE", false);
}
}

Expand All @@ -261,7 +300,6 @@ protected FilterWhereBuilder createStartsWithExpression(final StartsWithFilter f

@Override
protected FilterWhereBuilder createGreaterThanExpression(final GreaterThanFilter filter, final boolean not) {

final Attribute attribute = filter.getAttribute();
if (!validateSearchAttribute(attribute)) {
return null;
Expand All @@ -288,7 +326,7 @@ protected FilterWhereBuilder createGreaterThanExpression(final GreaterThanFilter
// ignore null values
if (value != null) {
final String op = not ? "<=" : ">";
ret.addBind(param, op);
ret.addBind(param, op, false);
}
}
ret.getWhere().append(")");
Expand Down Expand Up @@ -326,7 +364,7 @@ protected FilterWhereBuilder createGreaterThanOrEqualExpression(
// ignore null values
if (value != null) {
final String op = not ? "<" : ">=";
ret.addBind(param, op);
ret.addBind(param, op, false);
}
}

Expand Down Expand Up @@ -363,7 +401,7 @@ protected FilterWhereBuilder createLessThanExpression(final LessThanFilter filte
// ignore null values
if (value != null) {
final String op = not ? ">=" : "<";
ret.addBind(param, op);
ret.addBind(param, op, false);
}
}

Expand Down Expand Up @@ -402,7 +440,7 @@ protected FilterWhereBuilder createLessThanOrEqualExpression(
// ignore null values
if (value != null) {
final String op = not ? ">" : "<=";
ret.addBind(param, op);
ret.addBind(param, op, false);
}
}

Expand All @@ -426,7 +464,7 @@ protected SQLParam[] getSQLParam(
final String[] values =
AttributeUtil.getSingleValue(attribute) != null
? AttributeUtil.getSingleValue(attribute).toString().split(
((CSVDirConfiguration) connector.getConfiguration()).getKeyseparator())
((CSVDirConfiguration) connector.getConfiguration()).getKeyseparator())
: null;

final SQLParam[] params;
Expand All @@ -438,15 +476,15 @@ protected SQLParam[] getSQLParam(
params[i] = new SQLParam(
columnNames[i],
values != null && values.length == columnNames.length
? values[i] : null,
? values[i] : null,
columnType);
}
} else {
params = new SQLParam[] {new SQLParam(
params = new SQLParam[] { new SQLParam(
columnNames[0],
values != null && values.length == columnNames.length
? values[0] : null,
columnType)};
columnType) };
}

return params;
Expand All @@ -462,8 +500,8 @@ protected String[] getColumnName(final String attributeName) {
if (!StringUtil.isBlank(((CSVDirConfiguration) connector.getConfiguration()).getPasswordColumnName())
&& OperationalAttributes.PASSWORD_NAME.equalsIgnoreCase(attributeName)) {

return new String[] {((CSVDirConfiguration) connector.getConfiguration()).getPasswordColumnName()};
return new String[] { ((CSVDirConfiguration) connector.getConfiguration()).getPasswordColumnName() };
}
return new String[] {attributeName};
return new String[] { attributeName };
}
}

0 comments on commit 07be540

Please sign in to comment.