org.gcube.datacatalogue.grsf_manage_widget.server.manage

## Class GRSFNotificationService

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
      - - com.google.gwt.user.server.rpc.RemoteServiceServlet
        - - org.gcube.datacatalogue.grsf_manage_widget.server.manage.GRSFNotificationService

All Implemented Interfaces:
  com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, GRSFManageWidgetService

    public class GRSFNotificationService
    extends com.google.gwt.user.server.rpc.RemoteServiceServlet
    implements GRSFManageWidgetService

Endpoint for sending update records information to GRSF KB

Author:
  Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
See Also:
  Serialized Form

### Field Summary

Fields
`static String` `GCUBE_REQUEST_URL`
`static String` `GRSF_UPDATER_SERVICE`

### Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

`perThreadRequest, perThreadResponse`

### Constructor Summary

Constructors
Constructor and Description
`GRSFNotificationService()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static String` `discoverEndPoint(String context)` Discover the service endpoint and return its url
`org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue` `getCatalogue(String discoverScope)` Instanciate the ckan util library.
`static String` `getCurrentClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)` Needed to get the url of the client
`static String` `getCurrentContext(javax.servlet.http.HttpServletRequest request, boolean setInThread)` Retrieve the current scope by using the portal manager
`static org.gcube.vomanagement.usermanagement.model.GCubeUser` `getCurrentUser(javax.servlet.http.HttpServletRequest request)` Retrieve the current user by using the portal manager
`ManageProductBean` `getProductBeanById(String productIdentifier)` Get the product bean from the product identifier
`static String` `getScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)` Get the scope in which ckan information needs to be discovered from the url
`String` `notifyProductUpdate(ManageProductBean bean)` Notify product update
`static String` `updateCatalogueRecord(String serviceUrl, ManageProductBean bean, org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue catalogue, String username)` Send an update for this bean

### Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet

`checkPermutationStrongName, doGetSerializationPolicy, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponse`

### Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

`doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent`

### Methods inherited from class javax.servlet.http.HttpServlet

`doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service`

### Methods inherited from class javax.servlet.GenericServlet

`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### GRSF_UPDATER_SERVICE

    public static final String GRSF_UPDATER_SERVICE

See Also:
  Constant Field Values

#### GCUBE_REQUEST_URL

    public static final String GCUBE_REQUEST_URL

See Also:
  Constant Field Values

### Constructor Detail

#### GRSFNotificationService

    public GRSFNotificationService()

### Method Detail

#### getCatalogue

    public org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue getCatalogue(String discoverScope)

Instanciate the ckan util library. Since it needs the scope, we need to check if it is null or not

Parameters:
  `discoverScope` - if you want to the discover the utils library in this specified scope
Returns:

#### notifyProductUpdate

    public String notifyProductUpdate(ManageProductBean bean)

Description copied from interface: `GRSFManageWidgetService`
Notify product update

Specified by:
  `notifyProductUpdate` in interface `GRSFManageWidgetService`

#### getProductBeanById

    public ManageProductBean getProductBeanById(String productIdentifier)
                                         throws Exception

Description copied from interface: `GRSFManageWidgetService`
Get the product bean from the product identifier

Specified by:
  `getProductBeanById` in interface `GRSFManageWidgetService`
Returns:
  ManageProductBean
Throws:
  `Exception`

#### discoverEndPoint

    public static String discoverEndPoint(String context)

Discover the service endpoint and return its url

Parameters:
  `context` -
Returns:
  the url of the service on success, null otherwise

#### updateCatalogueRecord

    public static String updateCatalogueRecord(String serviceUrl,
                                               ManageProductBean bean,
                                               org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue catalogue,
                                               String username)

Send an update for this bean

Parameters:
  `baseUrl` -
  `bean` -
  `username` -
  `catalogue` -
Returns:
  true on success, false otherwise

#### getScopeFromClientUrl

    public static String getScopeFromClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)

Get the scope in which ckan information needs to be discovered from the url

Parameters:
  `httpServletRequest` -
Returns:

#### getCurrentClientUrl

    public static String getCurrentClientUrl(javax.servlet.http.HttpServletRequest httpServletRequest)

Needed to get the url of the client

Parameters:
  `httpServletRequest` - the httpServletRequest object
Returns:
  the instance of the user
See Also:
  `url at client side`

#### getCurrentContext

    public static String getCurrentContext(javax.servlet.http.HttpServletRequest request,
                                           boolean setInThread)

Retrieve the current scope by using the portal manager

Parameters:
  `b` -
Returns:
  a GcubeUser object

#### getCurrentUser

    public static org.gcube.vomanagement.usermanagement.model.GCubeUser getCurrentUser(javax.servlet.http.HttpServletRequest request)

Retrieve the current user by using the portal manager

Returns:
  a GcubeUser object