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 64deb1276a19d577600b2a47d1393e330d53024b..8fd7547e33a9b3786872c3091d320028b30acac0 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 2ac9568cfeb37ba7cef52131cb1d7d4ad5c8c53b..820609c6bdd0973a6391bd4b22ecfaf1fcaf1091 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 0391b52d6cb9a0963ebf6d5fa5d36d513ef44bb0..2de47b8050d1b209cede6525439d07d298887170 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 _, -, .)";