lost some enhancements, reverted up to this point
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@158240 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c312c1dbbb
commit
84cc92c4fa
|
@ -0,0 +1,35 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide management panel
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class HideManagementPanelEvent extends GwtEvent<HideManagementPanelEventHandler> {
|
||||||
|
public static Type<HideManagementPanelEventHandler> TYPE = new Type<HideManagementPanelEventHandler>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new hide event.
|
||||||
|
*/
|
||||||
|
public HideManagementPanelEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<HideManagementPanelEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(HideManagementPanelEventHandler handler) {
|
||||||
|
handler.onEvent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide management panel event handler
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public interface HideManagementPanelEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param onEvent
|
||||||
|
*/
|
||||||
|
void onEvent(HideManagementPanelEvent hideEvent);
|
||||||
|
|
||||||
|
}
|
|
@ -121,16 +121,16 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
else{
|
else{
|
||||||
|
|
||||||
// check it is a grsf record
|
// check it is a grsf record
|
||||||
String systemType = record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE);
|
String systemType = record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY);
|
||||||
if(systemType == null || systemType.isEmpty() || !systemType.equals(Constants.GRSF))
|
if(systemType == null || systemType.isEmpty() || systemType.equals(Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE))
|
||||||
throw new NoGRSFRecordException("This is not a GRSF Item");
|
throw new NoGRSFRecordException("This is not a GRSF Item");
|
||||||
|
|
||||||
Map<String, String> extrasAsHashMap = record.getExtrasAsHashMap();
|
Map<String, String> extrasAsHashMap = record.getExtrasAsHashMap();
|
||||||
|
|
||||||
// fetch map for namespaces
|
// fetch map for namespaces
|
||||||
Map<String, String> fieldsNamespacesMap = Utils.getFieldToFieldNameSpaceMapping(getThreadLocalRequest().getSession(),
|
Map<String, String> fieldsNamespacesMap = Utils.getFieldToFieldNameSpaceMapping(getThreadLocalRequest().getSession(),
|
||||||
extrasAsHashMap.get(Constants.GRSF_DOMAIN).equals(Constants.STOCK) ? Utils.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_STOCK
|
extrasAsHashMap.get(Constants.DOMAIN_CUSTOM_KEY).equals(Constants.STOCK_NAME_CUSTOM_KEY) ? Constants.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_STOCK
|
||||||
: Utils.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_FISHERY);
|
: Constants.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_FISHERY);
|
||||||
|
|
||||||
Map<String, String> extrasWithoutNamespaces = Utils.replaceFieldsKey(extrasAsHashMap, fieldsNamespacesMap);
|
Map<String, String> extrasWithoutNamespaces = Utils.replaceFieldsKey(extrasAsHashMap, fieldsNamespacesMap);
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
// manage the custom fields
|
// manage the custom fields
|
||||||
List<CkanPair> extras = dataset.getExtras();
|
List<CkanPair> extras = dataset.getExtras();
|
||||||
for (CkanPair ckanPair : extras) {
|
for (CkanPair ckanPair : extras) {
|
||||||
if(ckanPair.getKey().equals(Constants.STATUS_CUSTOM_FIELD_KEY) && ckanPair.getValue().equals(bean.getCurrentStatus().toString()))
|
if(ckanPair.getKey().equals(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY) && ckanPair.getValue().equals(bean.getCurrentStatus().toString()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
|
@ -324,12 +324,12 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
// add the new one and the annotation message
|
// add the new one and the annotation message
|
||||||
JSONObject newStatus = new JSONObject();
|
JSONObject newStatus = new JSONObject();
|
||||||
newStatus.put("key", Constants.STATUS_CUSTOM_FIELD_KEY);
|
newStatus.put("key", Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
||||||
newStatus.put("value", bean.getNewStatus().toString());
|
newStatus.put("value", bean.getNewStatus().toString());
|
||||||
customFieldsAsJson.add(newStatus);
|
customFieldsAsJson.add(newStatus);
|
||||||
|
|
||||||
JSONObject newAnnotation = new JSONObject();
|
JSONObject newAnnotation = new JSONObject();
|
||||||
newAnnotation.put("key", Constants.ANNOTATION_KEY);
|
newAnnotation.put("key", Constants.ANNOTATION_CUSTOM_KEY);
|
||||||
newAnnotation.put("value", "date: " + DATE_FORMAT.format(new Date())
|
newAnnotation.put("value", "date: " + DATE_FORMAT.format(new Date())
|
||||||
+ ", admin: " + new LiferayUserManager().getUserByUsername(username).getFullname()
|
+ ", admin: " + new LiferayUserManager().getUserByUsername(username).getFullname()
|
||||||
+ ", message: " + (bean.getAnnotation() != null ? bean.getAnnotation().replaceAll("\"", "") : "none")
|
+ ", message: " + (bean.getAnnotation() != null ? bean.getAnnotation().replaceAll("\"", "") : "none")
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A similar grsf record
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class SimilarGRSFRecord implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6501670015333073045L;
|
||||||
|
private String description;
|
||||||
|
private String semanticIdentifier;
|
||||||
|
private String shortName;
|
||||||
|
private String url; // within the catalogue
|
||||||
|
|
||||||
|
public SimilarGRSFRecord() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description
|
||||||
|
* @param semanticIdentifier
|
||||||
|
* @param shortName
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
public SimilarGRSFRecord(String description, String semanticIdentifier,
|
||||||
|
String shortName, String url) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.semanticIdentifier = semanticIdentifier;
|
||||||
|
this.shortName = shortName;
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
public String getIdentifier() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setIdentifier(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
public String getSemanticIdentifier() {
|
||||||
|
return semanticIdentifier;
|
||||||
|
}
|
||||||
|
public void setSemanticIdentifier(String semanticIdentifier) {
|
||||||
|
this.semanticIdentifier = semanticIdentifier;
|
||||||
|
}
|
||||||
|
public String getShortName() {
|
||||||
|
return shortName;
|
||||||
|
}
|
||||||
|
public void setShortName(String shortName) {
|
||||||
|
this.shortName = shortName;
|
||||||
|
}
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SimilarGRSFRecord [description=" + description
|
||||||
|
+ ", semanticIdentifier=" + semanticIdentifier + ", shortName="
|
||||||
|
+ shortName + ", url=" + url + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A source record for this grsf record: source type (i.e. fishsource, ram, firms), name and identifier
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class SourceRecord implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5144710283443577518L;
|
||||||
|
private String name;
|
||||||
|
private String url; // within the catalogue
|
||||||
|
|
||||||
|
public SourceRecord() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
public SourceRecord(String name, String url) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SourceRecord [name=" + name + ", url=" + url + "]";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue