publish-product methods publish private products
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133166 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a0a0dd48b5
commit
da21b374aa
|
@ -202,7 +202,7 @@ public class GrsfPublisherFisheryService {
|
||||||
List<ResourceBean> resources = HelperMethods.getResourcesFromBean(record, username);
|
List<ResourceBean> resources = HelperMethods.getResourcesFromBean(record, username);
|
||||||
|
|
||||||
// if confirmed, set to visible TODO anyway if it is confirmed we should another method
|
// if confirmed, set to visible TODO anyway if it is confirmed we should another method
|
||||||
boolean setPublic = record.getStatus() == org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status.Confirmed;
|
boolean setPublic = false;
|
||||||
|
|
||||||
// check the license id
|
// check the license id
|
||||||
String license = null;
|
String license = null;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.AssociationToGroupThread;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.AssociationToGroupThread;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
|
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
|
||||||
|
import org.gcube.datacatalogue.ckanutillibrary.models.ResourceBean;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.models.RolesCkanGroupOrOrg;
|
import org.gcube.datacatalogue.ckanutillibrary.models.RolesCkanGroupOrOrg;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
|
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -88,18 +89,18 @@ public class GrsfPublisherStockService {
|
||||||
ResponseCreationBean responseBean = new ResponseCreationBean();
|
ResponseCreationBean responseBean = new ResponseCreationBean();
|
||||||
Status status = Status.INTERNAL_SERVER_ERROR;
|
Status status = Status.INTERNAL_SERVER_ERROR;
|
||||||
String id = "";
|
String id = "";
|
||||||
|
|
||||||
// validate the bean
|
// validate the bean
|
||||||
logger.debug("Start validating bean...");
|
logger.debug("Start validating bean...");
|
||||||
Response responseAfterValidation = HelperMethods.validateBeanAndResources(record);
|
Response responseAfterValidation = HelperMethods.validateBeanAndResources(record);
|
||||||
|
|
||||||
if(responseAfterValidation == null)
|
if(responseAfterValidation == null)
|
||||||
logger.debug("Bean validation successful");
|
logger.debug("Bean validation successful");
|
||||||
else{
|
else{
|
||||||
|
|
||||||
logger.warn("Bean validation failed");
|
logger.warn("Bean validation failed");
|
||||||
return responseAfterValidation;
|
return responseAfterValidation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
@ -189,23 +190,10 @@ public class GrsfPublisherStockService {
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
// evaluate the resources TODO
|
// evaluate the resources
|
||||||
// List<Resource> resourcesRecord = record.getResources();
|
List<ResourceBean> resources = HelperMethods.getResourcesFromBean(record, username);
|
||||||
// List<ResourceBean> resources = null;
|
|
||||||
// if(resourcesRecord != null && !resourcesRecord.isEmpty()){
|
|
||||||
// resources = new ArrayList<ResourceBean>();
|
|
||||||
// for (Resource res : resourcesRecord) {
|
|
||||||
// logger.debug("Trying to add resource " + res);
|
|
||||||
// if(res.getName() != null && res.getUrl() != null)
|
|
||||||
// resources.add(new ResourceBean(res.getUrl(), res.getName(), res.getDescription(), null, username, null, null));
|
|
||||||
// else
|
|
||||||
// logger.warn("Unable to add resource because url or name is null");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
boolean setPublic = false;
|
||||||
// if confirmed, set to visible TODO anyway if it is confirmed we should another method
|
|
||||||
boolean setPublic = record.getStatus() == org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status.Confirmed;
|
|
||||||
|
|
||||||
// check the license id
|
// check the license id
|
||||||
String license = null;
|
String license = null;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DatabaseSource;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DatabaseSource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Resource;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Resource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source;
|
||||||
|
@ -409,7 +408,7 @@ public abstract class HelperMethods {
|
||||||
* @param record
|
* @param record
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static List<ResourceBean> getResourcesFromBean(FisheryRecord record, String username) {
|
public static List<ResourceBean> getResourcesFromBean(Common record, String username) {
|
||||||
List<ResourceBean> toReturn = new ArrayList<ResourceBean>();
|
List<ResourceBean> toReturn = new ArrayList<ResourceBean>();
|
||||||
|
|
||||||
List<DatabaseSource> databaseSources = record.getDatabaseSources();
|
List<DatabaseSource> databaseSources = record.getDatabaseSources();
|
||||||
|
|
Loading…
Reference in New Issue