@ Path ( "/{taskName}" ) @ POST public Response performTask ( @ PathParam ( "taskName" ) String taskName , @ QueryParam ( "storeID" ) String storeID ) { String msg = "performing task(" + taskName + ", " + storeID + ")" ; String taskParameters = null ; try { taskParameters = getTaskParameters ( ) ; } catch ( Exception e ) { return responseBad ( msg , e , INTERNAL_SERVER_ERROR ) ; } try { TaskProvider taskProvider = taskProviderFactory . getTaskProvider ( storeID ) ; String responseText = taskProvider . performTask ( taskName , taskParameters ) ; return responseOk ( msg , responseText ) ; } catch ( UnsupportedTaskException e ) { return responseBad ( msg , e , BAD_REQUEST ) ; } catch ( UnauthorizedException e ) { return responseBad ( msg , e , FORBIDDEN ) ; } catch ( StorageStateException e ) { return responseBad ( msg , e , CONFLICT ) ; } catch ( ServerConflictException e ) { return responseBad ( msg , e , Response . Status . CONFLICT ) ; } catch ( Exception e ) { return responseBad ( msg , e , INTERNAL_SERVER_ERROR ) ; } }
Performs a task