moved ItemStatus into shared package

This commit is contained in:
Francesco Mangiacrapa 2021-06-14 15:37:58 +02:00
parent 052c27c8c7
commit 93126c0843
4 changed files with 8 additions and 16 deletions

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.json.JSONException; import org.json.JSONException;

View File

@ -11,6 +11,7 @@ import javax.ws.rs.WebApplicationException;
import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject; import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject;
import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject.METHOD; import org.gcube.datacatalogue.utillibrary.ckan.MarshUnmarshCkanObject.METHOD;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.gcat.client.Item; import org.gcube.gcat.client.Item;
import org.json.JSONArray; import org.json.JSONArray;
@ -18,7 +19,6 @@ import org.json.JSONException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/** /**
* The Class DataCatalogueCMSImpl. * The Class DataCatalogueCMSImpl.
* *
@ -30,13 +30,6 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
private static final Logger LOG = LoggerFactory.getLogger(DataCatalogueCMSImpl.class); private static final Logger LOG = LoggerFactory.getLogger(DataCatalogueCMSImpl.class);
/**
* Instantiates a new data catalogue CMS impl.
*/
public DataCatalogueCMSImpl() {
}
/** /**
* Checks if is content moderator enabled. * Checks if is content moderator enabled.
* *
@ -90,8 +83,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
datasetName = jsonArray.getString(i); datasetName = jsonArray.getString(i);
LOG.trace("reading dataset: " + datasetName); LOG.trace("reading dataset: " + datasetName);
String jsonValueDataset = new Item().read(datasetName); String jsonValueDataset = new Item().read(datasetName);
CkanDataset toCkanDataset = MarshUnmarshCkanObject.toCkanDataset(jsonValueDataset, CkanDataset toCkanDataset = MarshUnmarshCkanObject.toCkanDataset(jsonValueDataset, METHOD.TO_READ);
METHOD.TO_READ);
LOG.trace("converted as dataset: " + toCkanDataset); LOG.trace("converted as dataset: " + toCkanDataset);
listDataset.add(toCkanDataset); listDataset.add(toCkanDataset);
} catch (JSONException | IOException e) { } catch (JSONException | IOException e) {
@ -100,7 +92,6 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
} }
} }
if (listDataset == null) { if (listDataset == null) {
LOG.info("no dataset returned with status: " + theStatus); LOG.info("no dataset returned with status: " + theStatus);
return listDataset; return listDataset;
@ -153,7 +144,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
// TODO MUST BE CHANGED FOR THE STATUS // TODO MUST BE CHANGED FOR THE STATUS
count = new Item().count(); count = new Item().count();
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error on couting list items for status "+theStatus, e); LOG.error("Error on couting list items for status " + theStatus, e);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
package org.gcube.datacatalogue.utillibrary.server.cms; package org.gcube.datacatalogue.utillibrary.shared;
/** /**
* The Enum ItemStatus. * The Enum ItemStatus.

View File

@ -7,7 +7,7 @@ import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory; import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory;
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueImpl; import org.gcube.datacatalogue.utillibrary.server.DataCatalogueImpl;
import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem; import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem;
import org.gcube.datacatalogue.utillibrary.server.cms.ItemStatus; import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset; import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;