org.wso2.carbon.registry.core.jdbc.handlers
Class EditProcessor

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.handlers.EditProcessor
Direct Known Subclasses:
TextEditProcessor

public abstract class EditProcessor
extends Object

Base class for edit processors of custom UIs. Handlers that generate edit or new resource UIs should have an associated EditProcessor implementation. Custom UIs generated by UIEnabledHandlers may have various input controls to get user input for filling up the resource content. EditProcessor implementations should extract these inputs from the request and build the resource content. Once the resource content is built, it should store the resource in the registry.


Constructor Summary
EditProcessor()
           
 
Method Summary
protected  Registry getRegistry(javax.servlet.http.HttpServletRequest request)
          Obtains an instance of the Registry that the user can work with.
abstract  boolean processEditContent(String path, String editViewKey, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementations of this method should extract input parameters from edit view and update the resource content.
abstract  boolean processNewContent(String parentPath, String newViewKey, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementations of this method should extract input parameters from new view and create a new resource with that content.
protected  void redirect(String url, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Redirects the incoming request to the given URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditProcessor

public EditProcessor()
Method Detail

processEditContent

public abstract boolean processEditContent(String path,
                                           String editViewKey,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws RegistryException
Implementations of this method should extract input parameters from edit view and update the resource content.

Parameters:
path - Path of the edited resource.
editViewKey - UI key of the edit UI.
request - HttpServletRequest received from the the CustomUIServlet
response - HttpServletResponse to be sent the the CustomUIServlet
Returns:
true if response is sent within the EditProcessor implementation.
Throws:
RegistryException - if an error occurs while processing content.

processNewContent

public abstract boolean processNewContent(String parentPath,
                                          String newViewKey,
                                          javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws RegistryException
Implementations of this method should extract input parameters from new view and create a new resource with that content.

Parameters:
parentPath - Path of the parent collection of new resource.
newViewKey - UI key of the new UI.
request - HttpServletRequest received from the the CustomUIServlet
response - HttpServletResponse to be sent the the CustomUIServlet
Returns:
true if response is sent within the EditProcessor implementation.
Throws:
RegistryException - if an error occurs while processing content.

getRegistry

protected Registry getRegistry(javax.servlet.http.HttpServletRequest request)
                        throws RegistryException
Obtains an instance of the Registry that the user can work with. If no user is logged in, the Registry would be anonymous.

Parameters:
request - the HTTP Servlet Request.
Returns:
the Registry instance.
Throws:
RegistryException - if an error occurs.

redirect

protected void redirect(String url,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
Redirects the incoming request to the given URL.

Parameters:
url - the target URL.
request - the HTTP Servlet Request.
response - the HTTP Servlet Response.


Copyright © 2014 WSO2 Inc. All Rights Reserved.