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(); 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.Map.Entry;
import java.util.Set; 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.CKanPublisherService;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
@ -248,9 +249,8 @@ public class CreateDatasetForm extends Composite {
@UiField @UiField
HTMLPanel wizardCreatorPanel; 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. // Create a remote service proxy to talk to the server-side ckan service.
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class); private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
@ -362,7 +362,7 @@ public class CreateDatasetForm extends Composite {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus; this.eventBus = eventBus;
this.isWorkspaceRequest = isWorkspaceRequest; this.isWorkspaceRequest = isWorkspaceRequest;
iconSpinner.setSpin(true); iconSpinner.setSpin(true);
iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX); iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX);
@ -1207,11 +1207,14 @@ public class CreateDatasetForm extends Composite {
@Override @Override
public void onSuccess(final DatasetBean createdDatasetBean) { public void onSuccess(final DatasetBean createdDatasetBean) {
CKanMetadataPublisher.printJs("createCKanDataset returned");
GWT.log("Created the dataset: " + createdDatasetBean); GWT.log("Created the dataset: " + createdDatasetBean);
if (createdDatasetBean != null) { if (createdDatasetBean != null) {
CKanMetadataPublisher.printJs(createdDatasetBean.toString());
final String datasetUrl = createdDatasetBean.getSource(); final String datasetUrl = createdDatasetBean.getSource();
alertOnCreate(PRODUCT_CREATED_OK, false, AlertType.SUCCESS, false); 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) { private void alertOnCreate(String text, boolean showSpinner, AlertType type, boolean hideAfterAWhile) {
onCreateAlertBlock.clear(); onCreateAlertBlock.clear();
try { try {
onCreateAlertBlock.remove(iconSpinner); onCreateAlertBlock.remove(iconSpinner);
}catch (Exception e) { } catch (Exception e) {
} }
if (showSpinner) { if (showSpinner) {
onCreateAlertBlock.add(iconSpinner); onCreateAlertBlock.add(iconSpinner);
} }
onCreateAlertBlock.setText(text); 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) //#23491 Building the go to the item to "Catalogue Portlet URL" (instead of URI Resolver URL)
String catalogueURL = utils.getPortletUrl(); String catalogueURL = utils.getPortletUrl();
toCreate.setSource(String.format("%s?path=/dataset/%s", catalogueURL,datasetId)); toCreate.setSource(String.format("%s?path=/dataset/%s", catalogueURL,datasetId));
logger.debug("Returning dataset: "+toCreate);
return toCreate; return toCreate;
}else{ }else{
logger.error("Failed to create the dataset"); logger.error("Failed to create the dataset");

View File

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