Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLdirectory query lowercasing #1970

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import sirius.kernel.commons.Files;
import sirius.kernel.commons.Strings;
import sirius.kernel.commons.Tuple;
import sirius.kernel.commons.Value;
import sirius.kernel.di.std.Part;
import sirius.kernel.health.Exceptions;
import sirius.kernel.nls.NLS;
Expand Down Expand Up @@ -661,7 +662,7 @@ protected void listChildDirectories(SQLDirectory parent,
.eq(SQLDirectory.COMMITTED, true)
.eq(SQLDirectory.DELETED, false)
.where(OMA.FILTERS.like(SQLDirectory.NORMALIZED_DIRECTORY_NAME)
.startsWith(prefixFilter)
.startsWith(Value.of(prefixFilter).toLowerCase())
bkositza marked this conversation as resolved.
Show resolved Hide resolved
.ignoreEmpty()
.build())
.limit(maxResults)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import sirius.db.mixing.annotations.BeforeSave;
import sirius.db.mixing.annotations.Index;
import sirius.db.mixing.annotations.Length;
import sirius.db.mixing.annotations.LowerCase;
import sirius.db.mixing.annotations.NullAllowed;
import sirius.db.mixing.annotations.Transient;
import sirius.db.mixing.types.BaseEntityRef;
Expand Down Expand Up @@ -76,6 +77,7 @@ public class SQLDirectory extends SQLEntity implements Directory, OptimisticCrea
*/
public static final Mapping NORMALIZED_DIRECTORY_NAME = Mapping.named("normalizedDirectoryName");
@Length(255)
@LowerCase
@NullAllowed
private String normalizedDirectoryName;

Expand Down Expand Up @@ -131,7 +133,7 @@ protected void beforeSave() {
if (Strings.isFilled(directoryName)) {
this.directoryName = storageUtils.sanitizePath(directoryName);
if (Strings.isFilled(directoryName)) {
this.normalizedDirectoryName = directoryName.toLowerCase();
this.normalizedDirectoryName = directoryName;
} else {
this.directoryName = null;
this.normalizedDirectoryName = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sirius.db.mixing.Mapping;
import sirius.db.mixing.annotations.BeforeSave;
import sirius.db.mixing.annotations.Index;
import sirius.db.mixing.annotations.LowerCase;
import sirius.db.mixing.annotations.NullAllowed;
import sirius.db.mixing.annotations.Transient;
import sirius.db.mixing.types.BaseEntityRef;
Expand Down Expand Up @@ -78,6 +79,7 @@ public class MongoDirectory extends MongoEntity implements Directory, Optimistic
*/
public static final Mapping NORMALIZED_DIRECTORY_NAME = Mapping.named("normalizedDirectoryName");
@NullAllowed
@LowerCase
private String normalizedDirectoryName;

/**
Expand Down Expand Up @@ -131,7 +133,7 @@ protected void beforeSave() {
if (Strings.isFilled(directoryName)) {
this.directoryName = storageUtils.sanitizePath(directoryName);
if (Strings.isFilled(directoryName)) {
this.normalizedDirectoryName = directoryName.toLowerCase();
this.normalizedDirectoryName = directoryName;
} else {
this.directoryName = null;
this.normalizedDirectoryName = null;
Expand Down
Loading