Updated the Go to the item link.

feature_23491
Francesco Mangiacrapa 2 years ago
parent a74e352cd2
commit 0099997c98

@ -58,20 +58,19 @@ public class AddResourceToDataset extends Composite{
@UiField ControlGroup urlControlGroup;
@UiField ControlGroup nameControlGroup;
public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetOrg, String owner, final String datasetUrl) {
public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetTitle, String datasetOrg, String owner, final String datasetUrl) {
initWidget(uiBinder.createAndBindUi(this));
// save bus
this.eventBus = eventBus;
// save dataset id (it is needed when we will add resources)
this.datasetId = datasetId;
this.datasetOrg = datasetOrg;
goToDatasetButton.setText(
(datasetUrl.length() > 100 ?
datasetUrl.substring(0, 100) + "..." : datasetUrl)
);
String title = datasetTitle;
String link = "";
link += title.length() > 90 ? title.substring(0, 90) + "..." : title;
goToDatasetButton.setTitle("Go to the item: "+title);
goToDatasetButton.setText(link);
// goToDatasetButton.setHref(datasetUrl);
goToDatasetButton.addClickHandler(new ClickHandler() {

@ -431,57 +431,12 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
toCreate.setId(datasetId);
// retrieve the url
String datasetUrl = utils.getUnencryptedUrlFromDatasetIdOrName(datasetId);
toCreate.setSource(datasetUrl);
// add also this information as custom field
/**
* TODO NEEDED TO BE CHECK
*
* OLD CODE NOT NEEDED. NOW IT IS PERFORMED BY gCAT
Map<String, List<String>> addField = new HashMap<String, List<String>>();
addField.put(ITEM_URL_FIELD, Arrays.asList(datasetUrl));
utils.patchProductCustomFields(datasetId, userApiKey, addField, false);
//String datasetUrl = utils.getUnencryptedUrlFromDatasetIdOrName(datasetId);
//toCreate.setSource(datasetUrl);
*/
//TODO SHOULD BE NOTIFIED by gCAT
// start a thread that will associate this dataset with the group
// if(/*toCreate.getChosenType() != null ||*/ toCreate.getGroups() != null){
//
// AssociationToGroupAndNotifyThread threadAssociationToGroup =
// new AssociationToGroupAndNotifyThread(
// toCreate.getGroups(),
// toCreate.getGroupsForceCreation(),
// null, //toCreate.getChosenType(), TODO
// datasetUrl,
// datasetId,
// toCreate.getTitle(),
// GenericUtils.getCurrentUser(getThreadLocalRequest()).getFullname(),
// userName,
// utils,
// organizationNameOrId,
// getThreadLocalRequest()
// );
// threadAssociationToGroup.start();
//
// }
//
// // launch notification thread
// WritePostCatalogueManagerThread threadWritePost =
// new WritePostCatalogueManagerThread(
// userName,
// scope,
// toCreate.getTitle(),
// datasetUrl,
// false, // send notification to other people
// toCreate.getTags(),
// GenericUtils.getCurrentUser(getThreadLocalRequest()).getFullname(),
// GenericUtils.getCurrentClientUrl(getThreadLocalRequest())
// );
// threadWritePost.start();
//#23491 Building the go to the item to "Catalogue Portlet URL" (instead of URI Resolver URL)
String catalogueURL = utils.getPortletUrl();
toCreate.setSource(String.format("%s?path=/dataset/%s", catalogueURL,datasetId));
return toCreate;
}else{
logger.error("Failed to create the dataset");

Loading…
Cancel
Save