Commit 1e31ce42 authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

Publishing things

parent d0f4c654
...@@ -146,9 +146,9 @@ public class DatasetController { ...@@ -146,9 +146,9 @@ public class DatasetController {
*/ */
@PostMapping(value = "/list/{filterCode}") @PostMapping(value = "/list/{filterCode}")
public FilteredPage<Dataset> datasetListShort(@RequestParam(name = "p", required = false, defaultValue = "0") final int page, public FilteredPage<Dataset> datasetListShort(@RequestParam(name = "p", required = false, defaultValue = "0") final int page,
@RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize, @RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize,
@RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction, @RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction,
@RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException { @RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException {
final DatasetFilter filter = shortFilterService.filterByCode(filterCode, DatasetFilter.class); final DatasetFilter filter = shortFilterService.filterByCode(filterCode, DatasetFilter.class);
return new FilteredPage<>(filterCode, filter, datasetService.listDatasets(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort))); return new FilteredPage<>(filterCode, filter, datasetService.listDatasets(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort)));
...@@ -204,22 +204,22 @@ public class DatasetController { ...@@ -204,22 +204,22 @@ public class DatasetController {
*/ */
@PostMapping(value = "/upsertaccessions/{UUID},{version}") @PostMapping(value = "/upsertaccessions/{UUID},{version}")
public Dataset upsertAccessions(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version, public Dataset upsertAccessions(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version,
@RequestBody final Set<AccessionIdentifier> accessionIdentifiers) throws NotFoundElement { @RequestBody final Set<AccessionIdentifier> accessionIdentifiers) throws NotFoundElement {
final Dataset dataset = datasetService.loadDataset(uuid, version); final Dataset dataset = datasetService.loadDataset(uuid, version);
return datasetService.upsertAccessions(dataset, accessionIdentifiers); return datasetService.upsertAccessions(dataset, accessionIdentifiers);
} }
/** /**
* Loads dataset by uuid and version and tries to publish it. * Loads dataset by uuid and version and sets new publish state
* *
* @param uuid dataset UUID * @param uuid dataset UUID
* @param version record version * @param version record version
* @param published (admin-only) set's the published flag to specified value * @param published sends to the review step or unpublish
* @return published Dataset * @return published Dataset
*/ */
@RequestMapping(value = "/publish", method = RequestMethod.POST) @RequestMapping(value = "/publish", method = RequestMethod.POST)
public Dataset publishDataset(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version, public Dataset publishDataset(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version,
@RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) { @RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) {
final Dataset dataset = datasetService.loadDataset(uuid, version); final Dataset dataset = datasetService.loadDataset(uuid, version);
...@@ -230,6 +230,19 @@ public class DatasetController { ...@@ -230,6 +230,19 @@ public class DatasetController {
} }
} }
/**
* Loads dataset by uuid and version and tries to publish it.
*
* @param uuid dataset UUID
* @param version record version
* @return published Dataset (admin-only)
*/
@RequestMapping(value = "/approve", method = RequestMethod.POST)
public Dataset approveDataset(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version) {
final Dataset dataset = datasetService.loadDataset(uuid, version);
return datasetService.approveDataset(dataset);
}
/** /**
* Adds the descriptors. * Adds the descriptors.
* *
......
...@@ -117,11 +117,11 @@ public class DescriptorController { ...@@ -117,11 +117,11 @@ public class DescriptorController {
*/ */
@PostMapping(value = "/list") @PostMapping(value = "/list")
public FilteredPage<Descriptor> listDescriptors(@RequestParam(name = "p", required = false, defaultValue = "0") final int page, public FilteredPage<Descriptor> listDescriptors(@RequestParam(name = "p", required = false, defaultValue = "0") final int page,
@RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize, @RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize,
@RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction, @RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction,
@RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort,
@RequestParam(name = "f", required = false) String filterCode, @RequestParam(name = "f", required = false) String filterCode,
@RequestBody(required = false) DescriptorFilter filter) throws IOException { @RequestBody(required = false) DescriptorFilter filter) throws IOException {
if (filterCode != null) { if (filterCode != null) {
filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class); filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class);
...@@ -145,9 +145,9 @@ public class DescriptorController { ...@@ -145,9 +145,9 @@ public class DescriptorController {
*/ */
@PostMapping(value = "/list/{filterCode}") @PostMapping(value = "/list/{filterCode}")
public FilteredPage<Descriptor> listDescriptorsByShort(@RequestParam(name = "p", required = false, defaultValue = "0") final int page, public FilteredPage<Descriptor> listDescriptorsByShort(@RequestParam(name = "p", required = false, defaultValue = "0") final int page,
@RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize, @RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize,
@RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction, @RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction,
@RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException { @RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException {
final DescriptorFilter filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class); final DescriptorFilter filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class);
return new FilteredPage<>(filterCode, filter, descriptorService.listDescriptors(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort))); return new FilteredPage<>(filterCode, filter, descriptorService.listDescriptors(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort)));
...@@ -244,16 +244,16 @@ public class DescriptorController { ...@@ -244,16 +244,16 @@ public class DescriptorController {
} }
/** /**
* Loads descriptor by uuid and version and tries to publish it. * Loads descriptor by uuid and version and sets new publish state
* *
* @param uuid descriptor UUID * @param uuid descriptor UUID
* @param version record version * @param version record version
* @param published (admin-only) set's the published flag to specified value * @param published sends to the review step or unpublish
* @return published Descriptor * @return published Descriptor
*/ */
@RequestMapping(value = "/publish", method = RequestMethod.POST) @RequestMapping(value = "/publish", method = RequestMethod.POST)
public Descriptor publishDescriptor(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version, public Descriptor publishDescriptor(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version,
@RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) { @RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) {
final Descriptor descriptor = descriptorService.getDescriptor(uuid, version); final Descriptor descriptor = descriptorService.getDescriptor(uuid, version);
...@@ -264,4 +264,17 @@ public class DescriptorController { ...@@ -264,4 +264,17 @@ public class DescriptorController {
} }
} }
/**
* Loads descriptor by uuid and version and tries to publish it.
*
* @param uuid descriptor UUID
* @param version record version
* @return published Descriptor (admin-only)
*/
@RequestMapping(value = "/approve", method = RequestMethod.POST)
public Descriptor approveDataset(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version) {
final Descriptor descriptor = descriptorService.getDescriptor(uuid, version);
return descriptorService.approveDescriptor(descriptor);
}
} }
...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import org.genesys.blocks.model.JsonViews; import org.genesys.blocks.model.JsonViews;
import org.genesys.catalog.api.FilteredPage; import org.genesys.catalog.api.FilteredPage;
import org.genesys.catalog.model.dataset.Dataset;
import org.genesys.catalog.model.filters.DescriptorListFilter; import org.genesys.catalog.model.filters.DescriptorListFilter;
import org.genesys.catalog.model.traits.Descriptor; import org.genesys.catalog.model.traits.Descriptor;
import org.genesys.catalog.model.traits.DescriptorList; import org.genesys.catalog.model.traits.DescriptorList;
...@@ -117,16 +118,16 @@ public class DescriptorListController { ...@@ -117,16 +118,16 @@ public class DescriptorListController {
} }
/** /**
* Loads descriptor by uuid and version and tries to publish it. * Loads descriptorList by uuid and version and sets new publish state
* *
* @param uuid descriptor UUID * @param uuid descriptorList UUID
* @param version record version * @param version record version
* @param published (admin-only) set's the published flag to specified value * @param published sends to the review step or unpublish
* @return published Descriptor * @return published DescriptorList
*/ */
@RequestMapping(value = "/publish", method = RequestMethod.POST) @RequestMapping(value = "/publish", method = RequestMethod.POST)
public DescriptorList publishDescriptorList(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version, public DescriptorList publishDescriptorList(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version,
@RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) { @RequestParam(name = "published", required = false, defaultValue = "true") final boolean published) {
final DescriptorList descriptorList = descriptorListService.getDescriptorList(uuid, version); final DescriptorList descriptorList = descriptorListService.getDescriptorList(uuid, version);
...@@ -137,6 +138,19 @@ public class DescriptorListController { ...@@ -137,6 +138,19 @@ public class DescriptorListController {
} }
} }
/**
* Loads DescriptorList by uuid and version and tries to publish it.
*
* @param uuid descriptorList UUID
* @param version record version
* @return published DescriptorList (admin-only)
*/
@RequestMapping(value = "/approve", method = RequestMethod.POST)
public DescriptorList approveDescriptorList(@RequestParam(value = "uuid", required = true) final UUID uuid, @RequestParam(value = "version", required = true) final int version) {
final DescriptorList descriptorList = descriptorListService.getDescriptorList(uuid, version);
return descriptorListService.approveDescriptorList(descriptorList);
}
/** /**
* Delete descriptor list. * Delete descriptor list.
* *
...@@ -241,9 +255,9 @@ public class DescriptorListController { ...@@ -241,9 +255,9 @@ public class DescriptorListController {
*/ */
@PostMapping(value = "/list/{filterCode}") @PostMapping(value = "/list/{filterCode}")
public FilteredPage<DescriptorList> listDescriptorListsByCode(@RequestParam(name = "p", required = false, defaultValue = "0") final int page, public FilteredPage<DescriptorList> listDescriptorListsByCode(@RequestParam(name = "p", required = false, defaultValue = "0") final int page,
@RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize, @RequestParam(name = "l", required = false, defaultValue = "50") final int pageSize,
@RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction, @RequestParam(name = "d", required = false, defaultValue = "ASC") final Sort.Direction direction,
@RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException { @RequestParam(name = "s", required = false, defaultValue = "id") final String[] sort, @PathVariable("filterCode") final String filterCode) throws IOException {
final DescriptorListFilter filter = shortFilterService.filterByCode(filterCode, DescriptorListFilter.class); final DescriptorListFilter filter = shortFilterService.filterByCode(filterCode, DescriptorListFilter.class);
return new FilteredPage<>(filterCode, filter, descriptorListService.listDescriptorLists(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort))); return new FilteredPage<>(filterCode, filter, descriptorListService.listDescriptorLists(filter, new PageRequest(page, Integer.min(pageSize, 100), direction, sort)));
......
...@@ -28,6 +28,7 @@ import org.genesys.catalog.model.Partner; ...@@ -28,6 +28,7 @@ import org.genesys.catalog.model.Partner;
import org.genesys.catalog.model.traits.Descriptor; import org.genesys.catalog.model.traits.Descriptor;
import org.genesys.catalog.service.PublishValidationInterface; import org.genesys.catalog.service.PublishValidationInterface;
import org.genesys.filerepository.model.RepositoryFile; import org.genesys.filerepository.model.RepositoryFile;
import org.genesys2.server.model.PublishState;
import org.genesys2.util.MCPDUtil; import org.genesys2.util.MCPDUtil;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
...@@ -176,8 +177,9 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub ...@@ -176,8 +177,9 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub
@Column(nullable = true, length = 200) @Column(nullable = true, length = 200)
private String created; private String created;
/** The published. */ /** The publish state. */
private boolean published = false; @Enumerated(EnumType.ORDINAL)
private PublishState state = PublishState.DRAFT;
/** /**
* Preupdate. * Preupdate.
...@@ -464,22 +466,31 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub ...@@ -464,22 +466,31 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub
this.created = created; this.created = created;
} }
/* /**
* (non-Javadoc) * Gets the state.
* @see org.genesys.blocks.model.Publishable#isPublished() *
* @return the state
*/ */
@Override public PublishState getState() {
public boolean isPublished() { return state;
return this.published;
} }
/** /**
* Sets the published. * Sets the publish state.
* *
* @param published the published to set * @param state the new publish state
*/ */
public void setPublished(final boolean published) { public void setState(final PublishState state) {
this.published = published; this.state = state;
}
/*
* (non-Javadoc)
* @see org.genesys.blocks.model.Publishable#isPublished()
*/
@Override
public boolean isPublished() {
return this.state == PublishState.PUBLISHED;
} }
/** /**
......
...@@ -27,6 +27,7 @@ import org.genesys.blocks.model.filters.UuidModelFilter; ...@@ -27,6 +27,7 @@ import org.genesys.blocks.model.filters.UuidModelFilter;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate; import com.querydsl.core.types.Predicate;
import org.genesys2.server.model.PublishState;
/** /**
* The Class DatasetFilter. * The Class DatasetFilter.
...@@ -56,8 +57,8 @@ public class DatasetFilter extends UuidModelFilter { ...@@ -56,8 +57,8 @@ public class DatasetFilter extends UuidModelFilter {
/** The language. */ /** The language. */
public Set<String> language; public Set<String> language;
/** The published. */ /** The publish state. */
public Boolean published; public Set<PublishState> state;
/** The crop. */ /** The crop. */
public Set<String> crop; public Set<String> crop;
...@@ -71,8 +72,8 @@ public class DatasetFilter extends UuidModelFilter { ...@@ -71,8 +72,8 @@ public class DatasetFilter extends UuidModelFilter {
final BooleanBuilder and = new BooleanBuilder(); final BooleanBuilder and = new BooleanBuilder();
super.buildQuery(dataset._super, and); super.buildQuery(dataset._super, and);
if (published != null) { if (state != null && !state.isEmpty()) {
and.and(dataset.published.eq(published)); and.and(dataset.state.in(state));
} }
if (title != null) { if (title != null) {
and.and(title.buildQuery(dataset.title)); and.and(title.buildQuery(dataset.title));
......
...@@ -32,6 +32,7 @@ import org.genesys.catalog.model.traits.QDescriptorList; ...@@ -32,6 +32,7 @@ import org.genesys.catalog.model.traits.QDescriptorList;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate; import com.querydsl.core.types.Predicate;
import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.JPAExpressions;
import org.genesys2.server.model.PublishState;
/** /**
* The Class DescriptorFilter. * The Class DescriptorFilter.
...@@ -74,8 +75,8 @@ public class DescriptorFilter extends UuidModelFilter { ...@@ -74,8 +75,8 @@ public class DescriptorFilter extends UuidModelFilter {
/** The publisher. */ /** The publisher. */
public Set<String> publisher; public Set<String> publisher;
/** The published. */ /** The publish state. */
public Boolean published; public Set<PublishState> state;
/** The integer only. */ /** The integer only. */
public Boolean integerOnly; public Boolean integerOnly;
...@@ -114,8 +115,8 @@ public class DescriptorFilter extends UuidModelFilter { ...@@ -114,8 +115,8 @@ public class DescriptorFilter extends UuidModelFilter {
if (publisher != null && !publisher.isEmpty()) { if (publisher != null && !publisher.isEmpty()) {
and.and(descriptorPath.publisher.in(publisher)); and.and(descriptorPath.publisher.in(publisher));
} }
if (published != null) { if (state != null && !state.isEmpty()) {
and.and(descriptorPath.published.eq(published)); and.and(descriptorPath.state.in(state));
} }
if (integerOnly != null) { if (integerOnly != null) {
and.and(descriptorPath.integerOnly.eq(integerOnly)); and.and(descriptorPath.integerOnly.eq(integerOnly));
......
...@@ -26,6 +26,7 @@ import org.genesys.blocks.model.filters.UuidModelFilter; ...@@ -26,6 +26,7 @@ import org.genesys.blocks.model.filters.UuidModelFilter;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate; import com.querydsl.core.types.Predicate;
import org.genesys2.server.model.PublishState;
/** /**
* The Class DescriptorListFilter. * The Class DescriptorListFilter.
...@@ -53,8 +54,8 @@ public class DescriptorListFilter extends UuidModelFilter { ...@@ -53,8 +54,8 @@ public class DescriptorListFilter extends UuidModelFilter {
/** The crop. */ /** The crop. */
public Set<String> crop; public Set<String> crop;
/** The published. */ /** The publish state. */
public Boolean published; public Set<PublishState> state;
/** The publisher. */ /** The publisher. */
public Set<String> publisher; public Set<String> publisher;
...@@ -71,8 +72,8 @@ public class DescriptorListFilter extends UuidModelFilter { ...@@ -71,8 +72,8 @@ public class DescriptorListFilter extends UuidModelFilter {
if (crop != null && !crop.isEmpty()) { if (crop != null && !crop.isEmpty()) {
and.and(descriptorList.crop.in(crop)); and.and(descriptorList.crop.in(crop));
} }
if (published != null) { if (state != null && !state.isEmpty()) {
and.and(descriptorList.published.eq(published)); and.and(descriptorList.state.in(state));
} }
if (publisher != null && !publisher.isEmpty()) { if (publisher != null && !publisher.isEmpty()) {
and.and(descriptorList.publisher.in(publisher)); and.and(descriptorList.publisher.in(publisher));
......
...@@ -23,6 +23,7 @@ import org.genesys.catalog.model.Partner; ...@@ -23,6 +23,7 @@ import org.genesys.catalog.model.Partner;
import org.genesys.catalog.model.dataset.Dataset; import org.genesys.catalog.model.dataset.Dataset;
import org.genesys.catalog.model.vocab.ControlledVocabulary; import org.genesys.catalog.model.vocab.ControlledVocabulary;
import org.genesys.catalog.model.vocab.VocabularyTerm; import org.genesys.catalog.model.vocab.VocabularyTerm;
import org.genesys2.server.model.PublishState;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
...@@ -130,7 +131,8 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable, ...@@ -130,7 +131,8 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private String publisher; private String publisher;
/** Not published by default. */ /** Not published by default. */
private boolean published = false; @Enumerated(EnumType.ORDINAL)
private PublishState state = PublishState.DRAFT;
/** Allow only integers, no decimal numbers. */ /** Allow only integers, no decimal numbers. */
private Boolean integerOnly; private Boolean integerOnly;
...@@ -235,7 +237,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable, ...@@ -235,7 +237,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
* @param descriptor the descriptor * @param descriptor the descriptor
*/ */
public Descriptor(final Descriptor descriptor) { public Descriptor(final Descriptor descriptor) {
this(descriptor.getVersionTag(), descriptor.getTitle(), descriptor.description, descriptor.getDataType(), descriptor.isPublished(), descriptor.isKey(), descriptor this(descriptor.getVersionTag(), descriptor.getTitle(), descriptor.description, descriptor.getDataType(), descriptor.getState(), descriptor.isKey(), descriptor
.getIntegerOnly(), descriptor.getMinValue(), descriptor.getMaxValue(), descriptor.getColumnName(), descriptor.getUom(), descriptor.getVocabulary(), descriptor .getIntegerOnly(), descriptor.getMinValue(), descriptor.getMaxValue(), descriptor.getColumnName(), descriptor.getUom(), descriptor.getVocabulary(), descriptor
.getOwner(), descriptor.getDescriptorLists()); .getOwner(), descriptor.getDescriptorLists());
} }
...@@ -247,7 +249,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable, ...@@ -247,7 +249,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
* @param title the title * @param title the title
* @param description the description * @param description the description
* @param dataType the data type * @param dataType the data type
* @param published the published * @param state the publish state
* @param key the key * @param key the key
* @param integerOnly the integer only * @param integerOnly the integer only
* @param minValue the min value * @param minValue the min value
...@@ -258,14 +260,14 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable, ...@@ -258,14 +260,14 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
* @param owner the owner * @param owner the owner
* @param descriptorLists the descriptor lists * @param descriptorLists the descriptor lists
*/ */
public Descriptor(final String versionTag, final String title, final String description, final DataType dataType, final boolean published, final boolean key, public Descriptor(final String versionTag, final String title, final String description, final DataType dataType, final PublishState state, final boolean key,
final Boolean integerOnly, final Double minValue, final Double maxValue, final String columnName, final String uom, final ControlledVocabulary vocabulary, 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) { final Partner owner, final List<DescriptorList> descriptorLists) {
this.versionTag = versionTag; this.versionTag = versionTag;
this.title = title; this.title = title;
this.description = description; this.description = description;
this.dataType = dataType; this.dataType = dataType;
this.published = published; this.state = state;
this.key = key; this.key = key;
this.integerOnly = integerOnly; this.integerOnly = integerOnly;
this.minValue = minValue; this.minValue = minValue;
...@@ -566,16 +568,25 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable, ...@@ -566,16 +568,25 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
*/ */
@Override @Override
public boolean isPublished() { public boolean isPublished() {
return published; return this.state == PublishState.PUBLISHED;
} }
/** /**
* Sets the published.