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 org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
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.METHOD;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.gcat.client.Item;
import org.json.JSONArray;
@ -18,7 +19,6 @@ import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/**
* The Class DataCatalogueCMSImpl.
*
@ -30,13 +30,6 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
private static final Logger LOG = LoggerFactory.getLogger(DataCatalogueCMSImpl.class);
/**
* Instantiates a new data catalogue CMS impl.
*/
public DataCatalogueCMSImpl() {
}
/**
* Checks if is content moderator enabled.
*
@ -69,7 +62,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
* @return the list items for status
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
* @throws JSONException
* @throws JSONException
*/
@Override
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus, int limit, int offset)
@ -90,8 +83,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
datasetName = jsonArray.getString(i);
LOG.trace("reading dataset: " + datasetName);
String jsonValueDataset = new Item().read(datasetName);
CkanDataset toCkanDataset = MarshUnmarshCkanObject.toCkanDataset(jsonValueDataset,
METHOD.TO_READ);
CkanDataset toCkanDataset = MarshUnmarshCkanObject.toCkanDataset(jsonValueDataset, METHOD.TO_READ);
LOG.trace("converted as dataset: " + toCkanDataset);
listDataset.add(toCkanDataset);
} catch (JSONException | IOException e) {
@ -99,7 +91,6 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
}
}
}
if (listDataset == null) {
LOG.info("no dataset returned with status: " + theStatus);
@ -119,7 +110,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
* @return the source array of items for status
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
* @throws JSONException the JSON exception
* @throws JSONException the JSON exception
*/
protected JSONArray getSourceArrayOfItemsForStatus(ItemStatus theStatus, int limit, int offset)
throws WebApplicationException, MalformedURLException, JSONException {
@ -153,7 +144,7 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
// TODO MUST BE CHANGED FOR THE STATUS
count = new Item().count();
} 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;
}

View File

@ -1,4 +1,4 @@
package org.gcube.datacatalogue.utillibrary.server.cms;
package org.gcube.datacatalogue.utillibrary.shared;
/**
* 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.DataCatalogueImpl;
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.junit.Test;
import org.slf4j.LoggerFactory;