From 3f994b3482eb879f8beb21bff2949490ab9a4db0 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Mon, 10 May 2010 13:16:54 +0000 Subject: [PATCH] [LMS-1495] extended QueryPE SVN: 15875 --- .../generic/shared/dto/ColumnNames.java | 2 ++ .../openbis/generic/shared/dto/QueryPE.java | 20 +++++++++++++++++-- .../shared/dto/ValidationMessages.java | 3 +++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java index 64deb1276a1..8fd7547e33a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ColumnNames.java @@ -68,6 +68,8 @@ public final class ColumnNames public final static String DATABASE_INSTANCE_COLUMN = "dbin_id"; + public static final String QUERY_DATABASE_KEY_COLUMN = "db_key"; + public static final String DESCRIPTION_COLUMN = "description"; public static final String DOWNLOAD_URL_COLUMN = "download_url"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/QueryPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/QueryPE.java index 2ac9568cfeb..820609c6bdd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/QueryPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/QueryPE.java @@ -28,8 +28,8 @@ import org.hibernate.validator.NotNull; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; /** - * Persistent entity of a SQL query for a custom database. - * + * Persistent entity of a SQL query for a custom database. + * * @author Franz-Josef Elmer */ @Entity @@ -38,6 +38,8 @@ public class QueryPE extends AbstractExpressionPE<QueryPE> { private static final long serialVersionUID = ServiceVersionHolder.VERSION; + private String queryDatabaseKey; + private String name; @Column(name = ColumnNames.NAME_COLUMN) @@ -53,6 +55,19 @@ public class QueryPE extends AbstractExpressionPE<QueryPE> this.name = name; } + @Column(name = ColumnNames.QUERY_DATABASE_KEY_COLUMN) + @NotNull(message = ValidationMessages.QUERY_DATABASE_KEY_NOT_NULL_MESSAGE) + @Length(min = 1, max = Code.CODE_LENGTH_MAX, message = ValidationMessages.CODE_LENGTH_MESSAGE) + public String getQueryDatabaseKey() + { + return queryDatabaseKey; + } + + public void setQueryDatabaseKey(String queryDatabaseKey) + { + this.queryDatabaseKey = queryDatabaseKey; + } + @Override public final boolean equals(final Object obj) { @@ -68,6 +83,7 @@ public class QueryPE extends AbstractExpressionPE<QueryPE> final EqualsBuilder builder = new EqualsBuilder(); builder.append(getName(), that.getName()); builder.append(getDatabaseInstance(), that.getDatabaseInstance()); + builder.append(getQueryDatabaseKey(), that.getQueryDatabaseKey()); return builder.isEquals(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ValidationMessages.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ValidationMessages.java index 0391b52d6cb..2de47b8050d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ValidationMessages.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ValidationMessages.java @@ -74,6 +74,9 @@ public final class ValidationMessages public static final String NAME_NOT_NULL_MESSAGE = "Name" + CAN_NOT_BE_NULL; + public static final String QUERY_DATABASE_KEY_NOT_NULL_MESSAGE = + "Query Database Key" + CAN_NOT_BE_NULL; + public static final String CODE_PATTERN_MESSAGE = "Given code '%s' contains illegal characters (allowed: A-Z, a-z, 0-9 and _, -, .)"; -- GitLab