bug fixing resouces to publish

This commit is contained in:
Francesco Mangiacrapa 2021-03-19 17:39:48 +01:00
parent 475d74228b
commit b8b94a58e4
4 changed files with 20 additions and 5 deletions

View File

@ -1074,8 +1074,9 @@ public class CreateDatasetForm extends Composite{
receivedBean.setGroupsForceCreation(groupsToForceCreation); receivedBean.setGroupsForceCreation(groupsToForceCreation);
if(resourcesSelectByWEMainPanel != null) if(resourcesSelectByWEMainPanel != null) {
receivedBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish()); receivedBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
}
receivedBean.setCustomFields(customFieldsMap); receivedBean.setCustomFields(customFieldsMap);

View File

@ -279,15 +279,19 @@ public class SelectResourceByWEMainPanel extends Composite {
for (String wsItemId : mapSelectedResources.keySet()) { for (String wsItemId : mapSelectedResources.keySet()) {
SelectedResourceWidget selecWC = mapSelectedResources.get(wsItemId); SelectedResourceWidget selecWC = mapSelectedResources.get(wsItemId);
ResourceElementBean theResource = selecWC.getResourceBean(); ResourceElementBean theResource = selecWC.getResourceBean();
theResource.setToBeAdded(true);
if(!theResource.isFolder()){ // be sure ... if(!theResource.isFolder()){ // be sure ...
children.add(theResource); children.add(theResource);
} }
} }
toReturn.setToPublish(children);
GWT.log("resources to publish are: "+toReturn.getToPublish());
return toReturn; return toReturn;
} }
/** /**
* @return the freezed * @return the freezed

View File

@ -341,13 +341,23 @@ public class WorkspaceUtils {
* @throws Exception the exception * @throws Exception the exception
*/ */
public static List<ResourceBean> toResources(DatasetBean bean, Workspace workspace, String username) throws Exception{ public static List<ResourceBean> toResources(DatasetBean bean, Workspace workspace, String username) throws Exception{
logger.debug("Called to Resources...: ");
logger.debug("Request to copy onto catalogue area....");
List<ResourceBean> resources = new ArrayList<ResourceBean>(); List<ResourceBean> resources = new ArrayList<ResourceBean>();
ResourceElementBean rootResource = bean.getResourceRoot(); ResourceElementBean rootResource = bean.getResourceRoot();
if(rootResource==null) {
logger.info("No resource root, returning empty list of resources");
return resources;
}
// retrieve the children // retrieve the children
List<ResourceElementBean> resourcesToAdd = rootResource.getToPublish(); List<ResourceElementBean> resourcesToAdd = rootResource.getToPublish();
if(resourcesToAdd==null) {
logger.info("No resource to add, returning empty list of resources");
return resources;
}
// copy only the selected ones // copy only the selected ones
for(ResourceElementBean resource : resourcesToAdd){ for(ResourceElementBean resource : resourcesToAdd){

View File

@ -54,7 +54,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
/** The children size. */ /** The children size. */
private Integer childrenSize; private Integer childrenSize;
/** The to publish. */ // /** The to publish. */
private List<ResourceElementBean> toPublish; //Resources that must be published private List<ResourceElementBean> toPublish; //Resources that must be published
/** The next id. */ /** The next id. */