update for fix in #9076

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@150579 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-06-27 15:57:07 +00:00
parent 37041ebf38
commit 17285fe73e
3 changed files with 53 additions and 19 deletions

View File

@ -1,29 +1,52 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-3-0" date="2017-05-05">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-3-1"
date="2017-06-26">
<Change>External Url files are properly managed as resources</Change>
</Changeset>
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-3-0"
date="2017-05-05">
<Change>Metadata model v.3 supported</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-3" date="2017-04-05">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-3"
date="2017-04-05">
<Change>Some bug fixes</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-2" date="2017-02-27">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-2"
date="2017-02-27">
<Change>Some minor terms changed</Change>
<Change>added support for ticket #7207</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-1" date="2017-02-02">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-1"
date="2017-02-02">
<Change>Minor fixes to speed up role retrievals</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-0" date="2016-12-11">
<Change>A post is automatically created by the Product Catalogue user every time someone publishes</Change>
<Change>The user now can select all files in the hierarchy and publish them</Change>
<Change>The user can now associate the product to the available groups</Change>
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-2-0"
date="2016-12-11">
<Change>A post is automatically created by the Product Catalogue user
every time someone publishes</Change>
<Change>The user now can select all files in the hierarchy and publish
them</Change>
<Change>The user can now associate the product to the available groups
</Change>
<Change>Removed ASL session dependency</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-1-0" date="2016-10-11">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-1-0"
date="2016-10-11">
<Change>Creation of a group is now supported</Change>
<Change>Association of a dataset to a group is now supported</Change>
<Change>Products are copied to .catalogue area when publishing is performed from workspace</Change>
<Change>Products are copied to .catalogue area when publishing is
performed from workspace</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-0-0" date="2016-06-01">
<Changeset
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-0-0"
date="2016-06-01">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.1-SNAPSHOT</version>
<name>gCube Ckan metadata publisher widget</name>
<description>

View File

@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.gcube.common.homelibary.model.items.type.FolderItemType;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace;
@ -15,6 +16,7 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.catalogue.WorkspaceCatalogue;
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalUrl;
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods;
import org.gcube.datacatalogue.ckanutillibrary.shared.ResourceBean;
@ -253,14 +255,23 @@ public class WorkspaceUtils {
// name and description could have been edited
copiedFile.setDescription(resource.getDescription());
// check if it is an external url
String externalUrl = null;
try{
boolean isExternalUrl = ((FolderItem)copiedFile).getFolderItemType().equals(FolderItemType.EXTERNAL_URL);
externalUrl = isExternalUrl ? ((ExternalUrl)copiedFile).getUrl() : null;
}catch(Exception e){
logger.warn("Unable to check if it is an external url file ", e);
}
resources.add(new ResourceBean(
copiedFile.getPublicLink(true),
resource.getEditableName(),
copiedFile.getDescription(),
copiedFile.getId(),
userName,
null, // dataset id, to be set
((FolderItem)copiedFile).getMimeType()));
externalUrl != null ? externalUrl : copiedFile.getPublicLink(true),
resource.getEditableName(),
copiedFile.getDescription(),
copiedFile.getId(),
userName,
null, // dataset id, to be set
((FolderItem)copiedFile).getMimeType()));
// postpone rename operation
copiedFile.rename(resource.getEditableName());