public class ExternalHandlerProcessor
extends java.lang.Object
implements com.labvantage.sapphire.servlet.externalapp.ExternalAppConstants
COMMAND_CHECKCONNECTION, COMMAND_CLEARCONNECTION, COMMAND_GETCONNECTIONID, COMMAND_ISTOKENACTIVE, COMMAND_REQUESTTOKEN, COMMANDRESPONSE_EXCEPTION, CONNECTION_DEVICEID, ERROR_EXTERNALAPP_DISABLED, ERROR_EXTERNALAPP_NOTFOUND, ERROR_INVALID_HANDLER, ERROR_PROCESSAS_INVALID, ERROR_TOKEN_EXPIRED, ERROR_UNRECOGNIZED_TOKEN, EXTERNALAPP_STATUS_ACTIVE, EXTERNALAPP_STATUS_DISABLED, PROCESSAS_ANY, PROCESSAS_DEPARTMENT, PROCESSAS_NEVER, PROCESSAS_ROLE, PROCESSAS_USER
ERROR_CONNECTION_INVALID, ERROR_CONNECTION_REFUSED, ERROR_INVALID_REQUEST_METHOD, ERROR_MALFORMED_REQUEST_BODY, ERROR_MALFORMED_REQUEST_URL, ERROR_RESOURCE_NOT_AVAILABLE, ERROR_RESOURCE_NOT_FOUND, ERROR_UNEXPECTED_SERVER_ERROR, HTTPCODE_BAD_REQUEST, HTTPCODE_CONFLICT, HTTPCODE_CREATED, HTTPCODE_FORBIDDEN, HTTPCODE_METHOD_NOT_ALLOWED, HTTPCODE_NO_CONTENT, HTTPCODE_NOT_FOUND, HTTPCODE_NOT_MODIFIED, HTTPCODE_OK, HTTPCODE_SERVER_ERROR, HTTPCODE_UNAUTHORIZED, HTTPHEADER_LOCATION, HTTPSTATUS_BAD_REQUEST, HTTPSTATUS_CONFLICT, HTTPSTATUS_CREATED, HTTPSTATUS_FORBIDDEN, HTTPSTATUS_METHOD_NOT_ALLOWED, HTTPSTATUS_NO_CONTENT, HTTPSTATUS_NOT_FOUND, HTTPSTATUS_NOT_MODIFIED, HTTPSTATUS_OK, HTTPSTATUS_SERVER_ERROR, HTTPSTATUS_UNAUTHORIZED, MESSAGE, METHOD_DELETE, METHOD_GET, METHOD_POST, METHOD_PUT, NAMESPACE_ACTIONS, NAMESPACE_API, NAMESPACE_CONNECTIONS, NAMESPACE_LABVANTAGE, NAMESPACE_SDC
Constructor and Description |
---|
ExternalHandlerProcessor(java.lang.String token,
java.lang.String sapphireControllerURL) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
checkConnection(java.lang.String connectionid) |
void |
clearConnection(java.lang.String connectionid) |
java.lang.String |
getConnectionId(java.lang.String username,
java.lang.String password,
java.lang.String database) |
java.net.HttpURLConnection |
getHttpURLConnection(java.lang.String processAs)
Internal.
|
org.json.JSONObject |
getJsonObject(java.net.HttpURLConnection conn,
org.json.JSONObject jsonResponse)
Internal.
|
java.lang.String |
getToken() |
boolean |
isTokenActive()
Internal.
|
java.lang.String |
requestToken(java.lang.String authorizationcode,
java.lang.String requestReason)
Internal.
|
java.lang.String |
requestToken(java.lang.String authorizationCode,
java.lang.String requestReason,
java.lang.String externalUserid)
Internal.
|
org.json.JSONObject |
sendCommandToLIMS(java.lang.String command,
org.json.JSONObject jsonRequest)
Use this to send a JSON command to LIMS.
|
PropertyList |
sendCommandToLIMS(java.lang.String command,
PropertyList commandRequest)
Use this to send a PropertyList command to LIMS.
|
org.json.JSONObject |
sendCommandToLIMS(java.lang.String processAs,
java.lang.String command,
org.json.JSONObject jsonRequest)
Use this to send a JSON command to LIMS.
|
PropertyList |
sendCommandToLIMS(java.lang.String processas,
java.lang.String command,
PropertyList commandRequest)
Use this to send a PropertyList command to LIMS.
|
void |
sendDownloadFileCommandToLIMS(java.lang.String command,
org.json.JSONObject commandRequest,
java.nio.file.Path targetFile) |
void |
sendDownloadFileCommandToLIMS(java.lang.String processAs,
java.lang.String command,
org.json.JSONObject jsonRequest,
java.nio.file.Path targetFile) |
org.json.JSONObject |
sendFileCommandToLIMS(java.lang.String command,
java.nio.file.Path file,
org.json.JSONObject jsonRequest)
Use this to send a JSON command to LIMS with an accompanying file.
|
org.json.JSONObject |
sendFileCommandToLIMS(java.lang.String processAs,
java.lang.String command,
java.nio.file.Path file,
org.json.JSONObject jsonRequest)
Use this to send a JSON command to LIMS with an accompanying file.
|
public ExternalHandlerProcessor(java.lang.String token, java.lang.String sapphireControllerURL)
public org.json.JSONObject sendCommandToLIMS(java.lang.String command, org.json.JSONObject jsonRequest) throws SapphireException
command
- the name of the commandjsonRequest
- the properties to send to the commandSapphireException
public org.json.JSONObject sendCommandToLIMS(java.lang.String processAs, java.lang.String command, org.json.JSONObject jsonRequest) throws SapphireException
processAs
- the name of the user to process these commands as. Requires the external app to permit this operationcommand
- the name of the commandjsonRequest
- the properties to send to the commandSapphireException
public org.json.JSONObject sendFileCommandToLIMS(java.lang.String command, java.nio.file.Path file, org.json.JSONObject jsonRequest) throws SapphireException
command
- the name of the commandfile
- the file to accompany the commandjsonRequest
- the properties to send to the commandSapphireException
public org.json.JSONObject sendFileCommandToLIMS(java.lang.String processAs, java.lang.String command, java.nio.file.Path file, org.json.JSONObject jsonRequest) throws SapphireException
processAs
- the name of the user to process these commands as. Requires the external app to permit this operationcommand
- the name of the commandfile
- the file to accompany the commandjsonRequest
- the properties to send to the commandSapphireException
public org.json.JSONObject getJsonObject(java.net.HttpURLConnection conn, org.json.JSONObject jsonResponse) throws java.io.IOException, SapphireException
java.io.IOException
SapphireException
public java.net.HttpURLConnection getHttpURLConnection(java.lang.String processAs) throws java.io.IOException
java.io.IOException
public java.lang.String getToken()
public java.lang.String requestToken(java.lang.String authorizationcode, java.lang.String requestReason) throws SapphireException
SapphireException
public java.lang.String requestToken(java.lang.String authorizationCode, java.lang.String requestReason, java.lang.String externalUserid) throws SapphireException
SapphireException
public boolean isTokenActive() throws SapphireException
SapphireException
public PropertyList sendCommandToLIMS(java.lang.String command, PropertyList commandRequest) throws SapphireException
command
- the name of the commandcommandRequest
- the properties to send to the commandSapphireException
public PropertyList sendCommandToLIMS(java.lang.String processas, java.lang.String command, PropertyList commandRequest) throws SapphireException
processas
- the name of the user to process these commands as. Requires the external app to permit this operationcommand
- the name of the commandcommandRequest
- the properties to send to the commandSapphireException
public java.lang.String getConnectionId(java.lang.String username, java.lang.String password, java.lang.String database) throws com.labvantage.sapphire.servlet.externalapp.ExternalAppException
com.labvantage.sapphire.servlet.externalapp.ExternalAppException
public java.lang.String checkConnection(java.lang.String connectionid) throws com.labvantage.sapphire.servlet.externalapp.ExternalAppException, SapphireException
com.labvantage.sapphire.servlet.externalapp.ExternalAppException
SapphireException
public void clearConnection(java.lang.String connectionid) throws com.labvantage.sapphire.servlet.externalapp.ExternalAppException, SapphireException
com.labvantage.sapphire.servlet.externalapp.ExternalAppException
SapphireException
public void sendDownloadFileCommandToLIMS(java.lang.String command, org.json.JSONObject commandRequest, java.nio.file.Path targetFile) throws SapphireException
SapphireException
public void sendDownloadFileCommandToLIMS(java.lang.String processAs, java.lang.String command, org.json.JSONObject jsonRequest, java.nio.file.Path targetFile) throws SapphireException
SapphireException