Skip to content

Commit

Permalink
ARKIV-321 arkivdel vs recno:arkivdel. Værsågod. Bare hyggelig. (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsodd authored Dec 3, 2024
1 parent 11a6876 commit 5b783df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import no.p360.model.CaseService.GetCasesArgs;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -61,6 +62,13 @@ private Map.Entry<String, String> fromODataToP360CaseArgs(ODataParser.Comparison
String oDataOperator = context.comparisonOperator().getText();
String oDataValue = context.value().getText().replaceAll("'", "");

if ("arkivdel".equalsIgnoreCase(oDataProperty) && StringUtils.isNumeric(oDataValue)) {
log.info("Custon P360 h4ck to prefix our OData filter with 'recno:'");
oDataValue = "recno:".concat(oDataValue);

log.debug("The new modified ODatafitler value: {}", oDataValue);
}

if (!"eq".equals(oDataOperator)) {
throw new IllegalODataFilter(String.format("OData operator %s is not supported. Currently only support for 'eq' operator.", oDataOperator));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ODataFilterUtilsSpec extends Specification {
query | expected | propertyGetter
"mappeid eq '24/00027'" | "24/00027" | { it.getCaseNumber() }
"systemid eq '201927'" | 201927 | { it.getRecno() }
"arkivdel eq '60001'" | "60001" | { it.getSubArchive() }
"arkivdel eq '60001'" | "recno:60001" | { it.getSubArchive() }
"arkivdel eq 'Opplæring'" | "Opplæring" | { it.getSubArchive() }
"klassifikasjon/primar/verdi eq 'C52'" | "C52" | { it.getArchiveCode() }
"klassifikasjon/primar/ordning eq 'ORG' and klassifikasjon/primar/verdi eq '123'" | "123" | { it.getArchiveCode() }
"kontaktid eq '08089312345'" | "08089312345" | { it.getContactReferenceNumber() }
Expand Down

0 comments on commit 5b783df

Please sign in to comment.