Commit a61c7977 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '118-key-descriptors' into 'master'

Resolve "Key descriptors"

Closes #118

See merge request !111
parents b7319463 92c9dc1b
......@@ -135,6 +135,10 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
@Column(nullable = false)
private DataType dataType;
/** The key. */
@Column(name = "keyDescriptor")
private boolean key;
/** Not published by default. */
private boolean published = false;
......@@ -205,7 +209,7 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
* @param descriptor the descriptor
*/
public Descriptor(final Descriptor descriptor) {
this(descriptor.getVersionTag(), descriptor.getTitle(), descriptor.description, descriptor.getDataType(), descriptor.isPublished(), descriptor.getIntegerOnly(), descriptor
this(descriptor.getVersionTag(), descriptor.getTitle(), descriptor.description, descriptor.getDataType(), descriptor.isPublished(), descriptor.isKey(), descriptor.getIntegerOnly(), descriptor
.getMinValue(), descriptor.getMaxValue(), descriptor.getColumnName(), descriptor.getUom(), descriptor.getVocabulary(), descriptor.getOwner(), descriptor
.getDescriptorLists());
}
......@@ -218,6 +222,7 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
* @param description the description
* @param dataType the data type
* @param published the published
* @param key the key
* @param integerOnly the integer only
* @param minValue the min value
* @param maxValue the max value
......@@ -227,7 +232,7 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
* @param owner the owner
* @param descriptorLists the descriptor lists
*/
public Descriptor(final String versionTag, final String title, final String description, final DataType dataType, final boolean published, final Boolean integerOnly,
public Descriptor(final String versionTag, final String title, final String description, final DataType dataType, final boolean published, final boolean key, final Boolean integerOnly,
final Double minValue, final Double maxValue, final String columnName, final String uom, final ControlledVocabulary vocabulary, final Partner owner,
final List<DescriptorList> descriptorLists) {
this.versionTag = versionTag;
......@@ -235,6 +240,7 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
this.description = description;
this.dataType = dataType;
this.published = published;
this.key = key;
this.integerOnly = integerOnly;
this.minValue = minValue;
this.maxValue = maxValue;
......@@ -491,7 +497,25 @@ public class Descriptor extends UuidModel implements Publishable, Copyable<Descr
this.vocabulary = vocabulary;
}
/**
/**
* Checks if is key.
*
* @return the key
*/
public boolean isKey() {
return key;
}
/**
* Sets the key.
*
* @param key the key to set
*/
public void setKey(final boolean key) {
this.key = key;
}
/**
* Checks if is published.
*
* @return the published
......
......@@ -60,6 +60,9 @@ public class DescriptorFilter extends AuditedVersionedModelFilter {
/** The uom. */
public Set<String> uom;
/** The key. */
public Boolean key;
/** The published. */
public Boolean published;
......@@ -87,6 +90,9 @@ public class DescriptorFilter extends AuditedVersionedModelFilter {
if ((category != null) && !category.isEmpty()) {
and.and(descriptor.category.in(category));
}
if (key != null) {
and.and(descriptor.key.eq(key));
}
if (published != null) {
and.and(descriptor.published.eq(published));
}
......
......@@ -3085,3 +3085,15 @@ databaseChangeLog:
- dropColumn:
columnName: last_name
tableName: datasetcreator
- changeSet:
id: 1516184942872-1
author: mborodenko
comment: Add key_descriptor column to Descriptor
changes:
- addColumn:
columns:
- column:
name: key_descriptor
type: BIT(1)
tableName: descriptor
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment