fr.cnes.sitools.resources.order
Class AbstractOrderResource

java.lang.Object
  extended by ExtendedWadlServerResource
      extended by fr.cnes.sitools.common.resource.AbstractSitoolsResource
          extended by fr.cnes.sitools.common.SitoolsResource
              extended by fr.cnes.sitools.common.resource.SitoolsParameterizedResource
                  extended by fr.cnes.sitools.resources.order.AbstractOrderResource
All Implemented Interfaces:
IResource, IOrderResource
Direct Known Subclasses:
AbstractCartOrderResource, AbstractDatasetOrderResource

public abstract class AbstractOrderResource
extends SitoolsParameterizedResource
implements IOrderResource

Abstract Resource to handle Orders

Developer must implement

public abstract ListReferencesAPI listFilesToOrder(DatabaseRequest dbRequest) throws SitoolsException;

and

public abstract Representation processOrder(ListReferencesAPI listReferences) throws SitoolsException;

Author:
m.gond

Field Summary
 
Fields inherited from class fr.cnes.sitools.common.SitoolsResource
DEFAULT_MEDIATYPE
 
Constructor Summary
AbstractOrderResource()
           
 
Method Summary
 void checkUser()
          Check that the user is allowed to do the order Throw a ResourceException to stop the order execution Can be overridden to change default behaviour
 void doInit()
          Initiate the resource To initialize shared instance of objects between resources, get the component Context from the Settings and put the object in the Context ((SitoolsSettings)getContext().getAttributes().get(ContextAttributes.SETTINGS)).getComponent() .getContext().getAttributes().put(SOME KEY, SOME OBJECT)
 void doInitialiseOrder()
          Actual method to initialize the order.
 void doTerminateOrder()
          Terminate the order.
 org.restlet.representation.Representation executeOrder()
          Execute the order
 java.lang.String getFileName()
          Get the fileName from the request or the model.
abstract  java.lang.String getOrderName()
          Return the name of the order
 void initialiseOrder()
          First step of the order, Initialize it
abstract  ListReferencesAPI listFilesToOrder()
          Abstract method to list all the files to order.
 void notifyAdminEnd()
          Notify the administrator.
 org.restlet.representation.Representation orderGet(org.restlet.representation.Variant variant)
           
 org.restlet.representation.Representation orderPost(org.restlet.representation.Representation represent, org.restlet.representation.Variant variant)
           
abstract  org.restlet.representation.Representation processOrder(ListReferencesAPI listReferences)
          Process the list of files to order
 void terminateOrder()
          Last step of the order, terminate it and notify the administrator
 
Methods inherited from class fr.cnes.sitools.common.resource.SitoolsParameterizedResource
addStandardResponseInfo, getId, getModel, getOverrideParameterValue, getOverrideParameterValueObject, getOverrideParams, getParameterValue, getParent, setId, setModel, setParent, sitoolsDescribe
 
Methods inherited from class fr.cnes.sitools.common.SitoolsResource
addStandardGetRequestInfo, addStandardInternalServerErrorInfo, addStandardNotificationInfo, addStandardObjectResponseInfo, addStandardPostOrPutRequestInfo, addStandardResourceCollectionFilterInfo, addStandardSimpleResponseInfo, configure, getNotificationObject, getRepresentation, getRepresentation, getSettings, getSitoolsApplication, getSitoolsSetting, trace, trace
 
Methods inherited from class fr.cnes.sitools.common.resource.AbstractSitoolsResource
getMediaType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.cnes.sitools.common.model.IResource
getDescription, getName
 

Constructor Detail

AbstractOrderResource

public AbstractOrderResource()
Method Detail

doInit

public void doInit()
Description copied from class: SitoolsParameterizedResource
Initiate the resource To initialize shared instance of objects between resources, get the component Context from the Settings and put the object in the Context ((SitoolsSettings)getContext().getAttributes().get(ContextAttributes.SETTINGS)).getComponent() .getContext().getAttributes().put(SOME KEY, SOME OBJECT)

Overrides:
doInit in class SitoolsParameterizedResource

orderPost

public final org.restlet.representation.Representation orderPost(org.restlet.representation.Representation represent,
                                                                 org.restlet.representation.Variant variant)
Specified by:
orderPost in interface IOrderResource

orderGet

public final org.restlet.representation.Representation orderGet(org.restlet.representation.Variant variant)
Specified by:
orderGet in interface IOrderResource

initialiseOrder

public void initialiseOrder()
                     throws java.lang.Exception
First step of the order, Initialize it

Throws:
java.lang.Exception - if there is any error

executeOrder

public org.restlet.representation.Representation executeOrder()
                                                       throws SitoolsException
Execute the order

Returns:
a Representation result of the order or null if the result is stored on the server
Throws:
SitoolsException - if there is any error

terminateOrder

public void terminateOrder()
                    throws SitoolsException
Last step of the order, terminate it and notify the administrator

Throws:
SitoolsException - if there is any error

doInitialiseOrder

public void doInitialiseOrder()
                       throws SitoolsException
Actual method to initialize the order. This method can be overridden to change the order initialisation

Throws:
SitoolsException - if there is an error while creating the order

listFilesToOrder

public abstract ListReferencesAPI listFilesToOrder()
                                            throws SitoolsException
Abstract method to list all the files to order.

Returns:
a ListReferencesAPI containing the list of Reference to order
Throws:
SitoolsException - if there is any error

processOrder

public abstract org.restlet.representation.Representation processOrder(ListReferencesAPI listReferences)
                                                                throws SitoolsException
Process the list of files to order

Parameters:
listReferences - the ListReferencesAPI containing the list of Reference to order
Returns:
a Representation or null if the response is stored on the server
Throws:
SitoolsException - if there is any error

getOrderName

public abstract java.lang.String getOrderName()
Return the name of the order

Returns:
the name of the order

doTerminateOrder

public void doTerminateOrder()
                      throws SitoolsException
Terminate the order. This method can be overridden in order to change the last step of the order

Throws:
SitoolsException - is there is any error

notifyAdminEnd

public void notifyAdminEnd()
                    throws SitoolsException
Notify the administrator. Can be overridden to change default behaviour

Throws:
SitoolsException - if here is any error

checkUser

public void checkUser()
Check that the user is allowed to do the order Throw a ResourceException to stop the order execution Can be overridden to change default behaviour


getFileName

public java.lang.String getFileName()
Get the fileName from the request or the model.

Returns:
the fileName from the request or the model.


Copyright © 2010-2013 CNES. All Rights Reserved.