Added logs

This commit is contained in:
Francesco Mangiacrapa 2022-10-27 12:38:49 +02:00
parent 1b2966d532
commit a199ff4ec6
4 changed files with 81 additions and 49 deletions

View File

@ -283,4 +283,22 @@ public class CKanMetadataPublisher implements EntryPoint {
m.show();
}
/**
* Prints the.
*
* @param msg the msg
*/
public static native void printJs(String msg)/*-{
console.log("js console: " + msg);
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void printJsObj(Object object)/*-{
console.log("js obj: " + JSON.stringify(object, null, 4));
}-*/;
}

View File

@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
@ -248,9 +249,8 @@ public class CreateDatasetForm extends Composite {
@UiField
HTMLPanel wizardCreatorPanel;
private Icon iconSpinner = new Icon(IconType.SPINNER);
private Icon iconSpinner = new Icon(IconType.SPINNER);
// Create a remote service proxy to talk to the server-side ckan service.
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
@ -362,7 +362,7 @@ public class CreateDatasetForm extends Composite {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
this.isWorkspaceRequest = isWorkspaceRequest;
iconSpinner.setSpin(true);
iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX);
@ -1207,11 +1207,14 @@ public class CreateDatasetForm extends Composite {
@Override
public void onSuccess(final DatasetBean createdDatasetBean) {
CKanMetadataPublisher.printJs("createCKanDataset returned");
GWT.log("Created the dataset: " + createdDatasetBean);
if (createdDatasetBean != null) {
CKanMetadataPublisher.printJs(createdDatasetBean.toString());
final String datasetUrl = createdDatasetBean.getSource();
alertOnCreate(PRODUCT_CREATED_OK, false, AlertType.SUCCESS, false);
@ -1448,14 +1451,14 @@ public class CreateDatasetForm extends Composite {
private void alertOnCreate(String text, boolean showSpinner, AlertType type, boolean hideAfterAWhile) {
onCreateAlertBlock.clear();
try {
onCreateAlertBlock.remove(iconSpinner);
}catch (Exception e) {
onCreateAlertBlock.remove(iconSpinner);
} catch (Exception e) {
}
if (showSpinner) {
onCreateAlertBlock.add(iconSpinner);
onCreateAlertBlock.add(iconSpinner);
}
onCreateAlertBlock.setText(text);

View File

@ -437,6 +437,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
//#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));
logger.debug("Returning dataset: "+toCreate);
return toCreate;
}else{
logger.error("Failed to create the dataset");

View File

@ -291,47 +291,57 @@ public class DatasetBean implements Serializable, IsSerializable {
@Override
public String toString() {
return "DatasetBean ["
+ (id != null ? "id=" + id + ", " : "")
+ (title != null ? "title=" + title + ", " : "")
+ (description != null ? "description=" + description + ", "
: "")
+ (license != null ? "license=" + license + ", " : "")
+ (source != null ? "source=" + source + ", " : "")
+ (authorName != null ? "authorName=" + authorName + ", " : "")
+ (authorSurname != null ? "authorSurname=" + authorSurname
+ ", " : "")
+ (authorFullName != null ? "authorFullName=" + authorFullName
+ ", " : "")
+ (authorEmail != null ? "authorEmail=" + authorEmail + ", "
: "")
+ (maintainer != null ? "maintainer=" + maintainer + ", " : "")
+ (maintainerEmail != null ? "maintainerEmail="
+ maintainerEmail + ", " : "")
+ (ownerIdentifier != null ? "ownerIdentifier="
+ ownerIdentifier + ", " : "")
+ (chosenType != null ? "chosenType=" + chosenType + ", " : "")
+ (selectedOrganization != null ? "selectedOrganization="
+ selectedOrganization + ", " : "")
+ "version="
+ version
+ ", visible="
+ visible
+ ", "
+ (organizationList != null ? "organizationList="
+ organizationList + ", " : "")
+ (resourceRoot != null ? "resourceRoot=" + resourceRoot + ", "
: "")
+ (metadataList != null ? "metadataList=" + metadataList + ", "
: "")
+ (tags != null ? "tags=" + tags + ", " : "")
+ (tagsVocabulary != null ? "tagsVocabulary=" + tagsVocabulary
+ ", " : "")
+ (customFields != null ? "customFields=" + customFields + ", "
: "")
+ (groups != null ? "groups=" + groups + ", " : "")
+ (groupsForceCreation != null ? "groupsForceCreation="
+ groupsForceCreation : "") + "]";
StringBuilder builder = new StringBuilder();
builder.append("DatasetBean [id=");
builder.append(id);
builder.append(", title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append(", license=");
builder.append(license);
builder.append(", source=");
builder.append(source);
builder.append(", authorName=");
builder.append(authorName);
builder.append(", authorSurname=");
builder.append(authorSurname);
builder.append(", authorFullName=");
builder.append(authorFullName);
builder.append(", authorEmail=");
builder.append(authorEmail);
builder.append(", maintainer=");
builder.append(maintainer);
builder.append(", maintainerEmail=");
builder.append(maintainerEmail);
builder.append(", ownerIdentifier=");
builder.append(ownerIdentifier);
builder.append(", chosenType=");
builder.append(chosenType);
builder.append(", selectedOrganization=");
builder.append(selectedOrganization);
builder.append(", version=");
builder.append(version);
builder.append(", visible=");
builder.append(visible);
builder.append(", organizationList=");
builder.append(organizationList);
builder.append(", metadataList=");
builder.append(metadataList);
builder.append(", tags=");
builder.append(tags);
builder.append(", tagsVocabulary=");
builder.append(tagsVocabulary);
builder.append(", customFields=");
builder.append(customFields);
builder.append(", groups=");
builder.append(groups);
builder.append(", groupsForceCreation=");
builder.append(groupsForceCreation);
builder.append("]");
return builder.toString();
}
}