ccc.client.core
Class RemotingAction

java.lang.Object
  extended by ccc.client.core.RemotingAction
All Implemented Interfaces:
Action
Direct Known Subclasses:
ApplyWorkingCopyAction, CancelActionAction, ClearWorkingCopyAction, ComputeTemplateAction, CreateActionAction, CreateAliasAction, CreateFolderAction, CreateGroupAction, CreatePageAction, CreateTemplateAction, CreateTextFileAction, CreateUserAction, CreateWorkingCopyFromHistoricalVersionAction, DeleteResourceAction, EditTextFileAction, GetAbsolutePathAction, GetChildrenAction, GetCurrentUserAction, GetImagesPagedAction, GetPropertyAction, GetResourcesPagedAction, GetRootsAction, GetServicesAction, GetTemplatesAction, GetUserAction, IncludeInMainMenuAction, IsLoggedInAction, ListComments, ListCompletedActionsAction, ListGroups, ListPendingActionsAction, ListUsersAction, LockAction, LoginAction, LogoutAction, MoveResourceAction, OpenEditCacheAction, OpenEditTextFileAction, OpenEditUserDialogAction, OpenTemplateRevisionAction, OpenUpdateAliasAction, OpenUpdateMetadataAction, OpenUpdateResourceAclAction, OpenUpdateTemplateAction, PageDeltaAction, PublishAction, RemoveFromMainMenuAction, RenameAction, ResourceNameExistsAction, TemplateNameExistsAction, UniqueUsernameAction, UnlockAction, UnpublishAction, UpdateAliasAction, UpdateCacheDurationAction, UpdateCommentAction, UpdateCurrentUserAction, UpdateFolderAction, UpdateGroupAction, UpdateMetadataAction, UpdatePageAction, UpdateResourceAclAction, UpdateResourceTemplateAction, UpdateTemplateAction, UpdateUserAction, UpdateUserPasswordAction, UpdateWorkingCopyAction, ValidateFieldAction, ViewHistoryAction

public abstract class RemotingAction
extends java.lang.Object
implements Action

An action that makes a server-side call.

Author:
Civic Computing Ltd.

Field Summary
 
Fields inherited from interface ccc.client.core.Action
UI_CONSTANTS, USER_ACTIONS
 
Constructor Summary
RemotingAction()
          Constructor.
RemotingAction(java.lang.String actionName)
          Constructor.
RemotingAction(java.lang.String actionName, HttpMethod method)
          Constructor.
 
Method Summary
protected  boolean beforeExecute()
          Handler method called immediately before an action is executed.
protected  java.lang.String encode(java.lang.String string)
          URL encode a string.
 void execute()
          Perform the action.
protected  void fireEvent(Event<CommandType> event)
          Submit an event to the event bus.
 java.lang.String getActionName()
          Accessor.
protected  java.lang.String getBody()
          Provide a body for this method.
 TextParser getParser()
          Accessor.
protected  java.lang.String getPath()
          Determine the server path for this action.
protected  Request getRequest()
          Get the HTTP request for this action.
protected  void onFailure(java.lang.Throwable throwable)
          Handle failure.
protected  void onNoContent(Response response)
          Handle a '204 NO CONTENT' response from the remote server.
protected  void onOK(Response response)
          Handle a '200 OK' response from the remote server.
protected  ResourceSummary parseResourceSummary(Response response)
          Parse the response as a resource summary.
 RemotingAction setExecutor(RequestExecutor executor)
          Mutator.
 RemotingAction setParser(TextParser parser)
          Mutator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotingAction

public RemotingAction()
Constructor.


RemotingAction

public RemotingAction(java.lang.String actionName)
Constructor.

Parameters:
actionName - The name of this action.

RemotingAction

public RemotingAction(java.lang.String actionName,
                      HttpMethod method)
Constructor.

Parameters:
actionName - The name of this action.
method - The HTTP method to use.
Method Detail

execute

public void execute()
Perform the action.

Specified by:
execute in interface Action

setExecutor

public RemotingAction setExecutor(RequestExecutor executor)
Mutator.

Parameters:
executor - The executor to set.
Returns:
A reference to 'this'.

getParser

public TextParser getParser()
Accessor.

Returns:
Returns the parser.

setParser

public RemotingAction setParser(TextParser parser)
Mutator.

Parameters:
parser - The parser to set.
Returns:
A reference to 'this'.

getRequest

protected Request getRequest()
Get the HTTP request for this action.

Returns:
The request for this remote action.

beforeExecute

protected boolean beforeExecute()
Handler method called immediately before an action is executed.

You can override this method to present confirmation dialogs, etc. to users, when an action is invoked. If this method returns true the action will continue; if false is returned the action will not be executed.

Returns:
True if the action should continue false otherwise.

onFailure

protected void onFailure(java.lang.Throwable throwable)
Handle failure.

Parameters:
throwable - The throwable.

getBody

protected java.lang.String getBody()
Provide a body for this method.

Only called for POST requests.

Returns:
The request body, as a string.

getActionName

public final java.lang.String getActionName()
Accessor.

Returns:
Returns the actionName.

getPath

protected java.lang.String getPath()
Determine the server path for this action.

Returns:
The server path for the resource.

onNoContent

protected void onNoContent(Response response)
Handle a '204 NO CONTENT' response from the remote server.

Parameters:
response - The server response.

onOK

protected void onOK(Response response)
Handle a '200 OK' response from the remote server.

Parameters:
response - The server response.

encode

protected java.lang.String encode(java.lang.String string)
URL encode a string.

Parameters:
string - The string to encode.
Returns:
The encoded string.

parseResourceSummary

protected ResourceSummary parseResourceSummary(Response response)
Parse the response as a resource summary.

Parameters:
response - The response to parse.
Returns:
The resource summary.

fireEvent

protected void fireEvent(Event<CommandType> event)
Submit an event to the event bus.

Parameters:
event - The event to submit.


Copyright © 2010. All Rights Reserved.