in progress

This commit is contained in:
Francesco Mangiacrapa 2021-06-14 11:27:53 +02:00
parent 53df376b96
commit f99b5b9fb3
9 changed files with 125 additions and 174 deletions

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
@ -18,7 +18,7 @@ public interface CkanContentModeratorService extends RemoteService {
public void setStatus(String itemId, ItemStatus theStatus); public void setStatus(String itemId, ItemStatus theStatus);
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus); public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus);
public void approveItem(String itemId); public void approveItem(String itemId);

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
@ -13,7 +13,7 @@ public interface CkanContentModeratorServiceAsync {
void approveItem(String itemId, AsyncCallback<Void> callback); void approveItem(String itemId, AsyncCallback<Void> callback);
void getListItemsForStatus(ItemStatus theStatus, AsyncCallback<List<CkanDataset>> callback); void getListItemsForStatus(ItemStatus theStatus, AsyncCallback<List<CatalogueDataset>> callback);
void permanentlyDelete(String itemId, AsyncCallback<Void> callback); void permanentlyDelete(String itemId, AsyncCallback<Void> callback);

View File

@ -4,7 +4,7 @@ import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.CustomizedView; import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.CustomizedView;
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.DataTableClientBundle; import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.DataTableClientBundle;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
@ -45,10 +45,10 @@ public class CkanContentModeratorWidget implements EntryPoint {
RootPanel.get().add(cvTable); RootPanel.get().add(cvTable);
// table.getView().refresh(); // table.getView().refresh();
greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() { greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CatalogueDataset>>() {
@Override @Override
public void onSuccess(List<CkanDataset> result) { public void onSuccess(List<CatalogueDataset> result) {
cvTable.setData(result); cvTable.setData(result);
} }

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client.material.table;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
@ -21,10 +21,10 @@ public class CustomizedView extends Composite {
} }
private static CustomizedViewUiBinder uiBinder = GWT.create(CustomizedViewUiBinder.class); private static CustomizedViewUiBinder uiBinder = GWT.create(CustomizedViewUiBinder.class);
private List<CkanDataset> users; private List<CatalogueDataset> users;
@UiField @UiField
MaterialDataTable<CkanDataset> table; MaterialDataTable<CatalogueDataset> table;
public CustomizedView() { public CustomizedView() {
@ -81,9 +81,9 @@ public class CustomizedView extends Composite {
// } // }
// }); // });
table.addColumn("Title", new gwt.material.design.client.ui.table.cell.TextColumn<CkanDataset>() { table.addColumn("Title", new gwt.material.design.client.ui.table.cell.TextColumn<CatalogueDataset>() {
@Override @Override
public String getValue(CkanDataset object) { public String getValue(CatalogueDataset object) {
return object.getTitle(); return object.getTitle();
} }
@ -104,9 +104,9 @@ public class CustomizedView extends Composite {
// } // }
// }).width(200); // }).width(200);
table.addColumn("Author", new gwt.material.design.client.ui.table.cell.TextColumn<CkanDataset>() { table.addColumn("Author", new gwt.material.design.client.ui.table.cell.TextColumn<CatalogueDataset>() {
@Override @Override
public String getValue(CkanDataset object) { public String getValue(CatalogueDataset object) {
return object.getAuthor(); return object.getAuthor();
} }
@Override @Override
@ -115,19 +115,19 @@ public class CustomizedView extends Composite {
} }
}); });
table.addRowSelectHandler(new RowSelectHandler<CkanDataset>() { table.addRowSelectHandler(new RowSelectHandler<CatalogueDataset>() {
@Override @Override
public void onRowSelect(RowSelectEvent<CkanDataset> event) { public void onRowSelect(RowSelectEvent<CatalogueDataset> event) {
log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected()); log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected());
} }
}); });
table.addColumnSortHandler(new ColumnSortHandler<CkanDataset>() { table.addColumnSortHandler(new ColumnSortHandler<CatalogueDataset>() {
@Override @Override
public void onColumnSort(gwt.material.design.client.data.events.ColumnSortEvent<CkanDataset> event) { public void onColumnSort(gwt.material.design.client.data.events.ColumnSortEvent<CatalogueDataset> event) {
log("ColumnSortEvent", log("ColumnSortEvent",
"Sorted: " + event.getSortContext().getSortDir() + ", columnIndex: " + event.getColumnIndex()); "Sorted: " + event.getSortContext().getSortDir() + ", columnIndex: " + event.getColumnIndex());
table.getView().refresh(); table.getView().refresh();
@ -183,7 +183,7 @@ public class CustomizedView extends Composite {
} }
public void setData(List<CkanDataset> users) { public void setData(List<CatalogueDataset> users) {
this.users = users; this.users = users;
// Customized Table Scaffolding elements // Customized Table Scaffolding elements
table.getTableTitle().setText("Customers"); table.getTableTitle().setText("Customers");

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.function.Function;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CatalogueBeansConverter {
private static Logger LOG = LoggerFactory.getLogger(CatalogueBeansConverter.class);
/** The to S sync folder descriptor. */
public static Function<CkanDataset, CatalogueDataset> toCatalogueDataset = new Function<CkanDataset, CatalogueDataset>() {
public CatalogueDataset apply(CkanDataset t) {
CatalogueDataset myDataset = new CatalogueDataset();
if (t == null) {
LOG.info("Input " + CkanDataset.class.getSimpleName() + " is null, returning empty "
+ CkanDataset.class.getSimpleName());
return myDataset;
}
myDataset.setAuthor(t.getAuthor());
myDataset.setAuthorEmail(t.getAuthorEmail());
myDataset.setCkanDatasetURL(null);
myDataset.setId(t.getId());
myDataset.setLicenseId(t.getLicenseId());
myDataset.setMaintainer(t.getMaintainer());
myDataset.setMaintainerEmail(t.getMaintainerEmail());
myDataset.setName(t.getName());
myDataset.setNotes(t.getNotes());
myDataset.setOwnerOrg(t.getOwnerOrg());
myDataset.setTitle(t.getTitle());
myDataset.setType(t.getType());
myDataset.setUrl(t.getUrl());
return myDataset;
}
};
}

View File

@ -6,7 +6,7 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.gcat.client.Item; import org.gcube.gcat.client.Item;
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService; import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -18,10 +18,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
* The server side implementation of the RPC service. * The server side implementation of the RPC service.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet implements public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implements
CkanContentModeratorService, ContentModeratorSystem { CkanContentModeratorService, ContentModeratorSystem {
private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceAImpl.class); private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceImpl.class);
@Override @Override
public boolean isContentModeratorEnabled() { public boolean isContentModeratorEnabled() {
@ -36,7 +36,7 @@ public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet imple
} }
@Override @Override
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus) { public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus) {
LOG.info("Called getListItemsForStatus: "+theStatus); LOG.info("Called getListItemsForStatus: "+theStatus);
try { try {

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset; import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
/** /**
@ -36,7 +36,7 @@ public interface ContentModeratorSystem {
* @param theStatus the the status * @param theStatus the the status
* @return the list items for status * @return the list items for status
*/ */
List<CkanDataset> getListItemsForStatus(ItemStatus theStatus); List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus);
/** /**
* Approve item. * Approve item.

View File

@ -4,14 +4,15 @@ import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable; import com.google.gwt.user.client.rpc.IsSerializable;
// TODO: Auto-generated Javadoc
/** /**
* The Class CkanDataset. * The Class CatalogueDataset.
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Jun 1, 2021 * Jun 14, 2021
*/ */
public class CkanDataset implements Serializable, IsSerializable{ public class CatalogueDataset implements Serializable, IsSerializable {
/** /**
* *
@ -26,274 +27,174 @@ public class CkanDataset implements Serializable, IsSerializable{
private String name; private String name;
private String notes; private String notes;
private String ownerOrg; private String ownerOrg;
//private ItemStatus state; private ItemStatus status;
private String title; private String title;
private String type; private String type;
private String url; private String url;
private String version; private String version;
private String ckanDatasetURL; private String ckanDatasetURL;
/** /**
* Instantiates a new ckan dataset base. * Instantiates a new ckan dataset base.
*/ */
public CkanDataset() { public CatalogueDataset() {
} }
/**
* Gets the author.
*
* @return the author
*/
public String getAuthor() { public String getAuthor() {
return author; return author;
} }
/**
* Gets the author email.
*
* @return the author email
*/
public String getAuthorEmail() { public String getAuthorEmail() {
return authorEmail; return authorEmail;
} }
/**
* Gets the id.
*
* @return the id
*/
public String getId() { public String getId() {
return id; return id;
} }
/**
* Gets the license id.
*
* @return the license id
*/
public String getLicenseId() { public String getLicenseId() {
return licenseId; return licenseId;
} }
/**
* Gets the maintainer.
*
* @return the maintainer
*/
public String getMaintainer() { public String getMaintainer() {
return maintainer; return maintainer;
} }
/**
* Gets the maintainer email.
*
* @return the maintainer email
*/
public String getMaintainerEmail() { public String getMaintainerEmail() {
return maintainerEmail; return maintainerEmail;
} }
/**
* Gets the name.
*
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* Gets the notes.
*
* @return the notes
*/
public String getNotes() { public String getNotes() {
return notes; return notes;
} }
/**
* Gets the owner org.
*
* @return the owner org
*/
public String getOwnerOrg() { public String getOwnerOrg() {
return ownerOrg; return ownerOrg;
} }
public ItemStatus getStatus() {
return status;
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() { public String getTitle() {
return title; return title;
} }
/**
* Gets the type.
*
* @return the type
*/
public String getType() { public String getType() {
return type; return type;
} }
/**
* Gets the url.
*
* @return the url
*/
public String getUrl() { public String getUrl() {
return url; return url;
} }
/**
* Gets the version.
*
* @return the version
*/
public String getVersion() { public String getVersion() {
return version; return version;
} }
/**
* Gets the ckan dataset URL.
*
* @return the ckan dataset URL
*/
public String getCkanDatasetURL() { public String getCkanDatasetURL() {
return ckanDatasetURL; return ckanDatasetURL;
} }
/**
* Sets the author.
*
* @param author the new author
*/
public void setAuthor(String author) { public void setAuthor(String author) {
this.author = author; this.author = author;
} }
/**
* Sets the author email.
*
* @param authorEmail the new author email
*/
public void setAuthorEmail(String authorEmail) { public void setAuthorEmail(String authorEmail) {
this.authorEmail = authorEmail; this.authorEmail = authorEmail;
} }
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/**
* Sets the license id.
*
* @param licenseId the new license id
*/
public void setLicenseId(String licenseId) { public void setLicenseId(String licenseId) {
this.licenseId = licenseId; this.licenseId = licenseId;
} }
/**
* Sets the maintainer.
*
* @param maintainer the new maintainer
*/
public void setMaintainer(String maintainer) { public void setMaintainer(String maintainer) {
this.maintainer = maintainer; this.maintainer = maintainer;
} }
/**
* Sets the maintainer email.
*
* @param maintainerEmail the new maintainer email
*/
public void setMaintainerEmail(String maintainerEmail) { public void setMaintainerEmail(String maintainerEmail) {
this.maintainerEmail = maintainerEmail; this.maintainerEmail = maintainerEmail;
} }
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* Sets the notes.
*
* @param notes the new notes
*/
public void setNotes(String notes) { public void setNotes(String notes) {
this.notes = notes; this.notes = notes;
} }
/**
* Sets the owner org.
*
* @param ownerOrg the new owner org
*/
public void setOwnerOrg(String ownerOrg) { public void setOwnerOrg(String ownerOrg) {
this.ownerOrg = ownerOrg; this.ownerOrg = ownerOrg;
} }
public void setStatus(ItemStatus status) {
this.status = status;
}
/**
* Sets the title.
*
* @param title the new title
*/
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
/**
* Sets the url.
*
* @param url the new url
*/
public void setUrl(String url) { public void setUrl(String url) {
this.url = url; this.url = url;
} }
/**
* Sets the version.
*
* @param version the new version
*/
public void setVersion(String version) { public void setVersion(String version) {
this.version = version; this.version = version;
} }
/**
* Sets the ckan dataset URL.
*
* @param ckanDatasetURL the new ckan dataset URL
*/
public void setCkanDatasetURL(String ckanDatasetURL) { public void setCkanDatasetURL(String ckanDatasetURL) {
this.ckanDatasetURL = ckanDatasetURL; this.ckanDatasetURL = ckanDatasetURL;
} }
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CatalogueDataset [author=");
builder.append(author);
builder.append(", authorEmail=");
builder.append(authorEmail);
builder.append(", id=");
builder.append(id);
builder.append(", licenseId=");
builder.append(licenseId);
builder.append(", maintainer=");
builder.append(maintainer);
builder.append(", maintainerEmail=");
builder.append(maintainerEmail);
builder.append(", name=");
builder.append(name);
builder.append(", notes=");
builder.append(notes);
builder.append(", ownerOrg=");
builder.append(ownerOrg);
builder.append(", status=");
builder.append(status);
builder.append(", title=");
builder.append(title);
builder.append(", type=");
builder.append(type);
builder.append(", url=");
builder.append(url);
builder.append(", version=");
builder.append(version);
builder.append(", ckanDatasetURL=");
builder.append(ckanDatasetURL);
builder.append("]");
return builder.toString();
}
} }

8
src/test/resources/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
/devNext.gcubekey
/devVRE.gcubekey
/devsec.gcubekey
/gCubeApps.gcubekey
/gcube.gcubekey
/log4j.properties
/pred4s.gcubekey
/preprod.gcubekey