Class DomibusConnectorClientRestAPIImpl
- java.lang.Object
-
- eu.domibus.connector.client.controller.rest.impl.DomibusConnectorClientRestAPIImpl
-
- All Implemented Interfaces:
DomibusConnectorClientRestAPI
@RestController @RequestMapping("/restservice") public class DomibusConnectorClientRestAPIImpl extends Object implements DomibusConnectorClientRestAPI
-
-
Field Summary
-
Fields inherited from interface eu.domibus.connector.client.rest.DomibusConnectorClientRestAPI
RESTSERVICE_PATH
-
-
Constructor Summary
Constructors Constructor Description DomibusConnectorClientRestAPIImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
deleteMessageById(Long id)
Deletes a message.Boolean
deleteMessageFile(DomibusConnectorClientMessageFile messageFile)
Deletes a file from a message.DomibusConnectorClientMessageList
getAllMessages()
Method to receive all messages stored in the database of the domibusConnectorClient-Application.DomibusConnectorClientMessage
getMessageByBackendMessageId(String backendMessageId)
Method to receive a certain message stored in the domibusConnectorClient-Application database.DomibusConnectorClientMessage
getMessageByEbmsMessageId(String ebmsMessageId)
Method to receive a certain message stored in the domibusConnectorClient-Application database.DomibusConnectorClientMessage
getMessageById(Long id)
Method to receive a certain message stored in the domibusConnectorClient-Application database.DomibusConnectorClientMessageList
getMessagesByConversationId(String conversationId)
Method to receive all messages from the conversation with the given id.DomibusConnectorClientMessageList
getMessagesByPeriod(Date from, Date to)
Method to receive all messages within the given period.byte[]
loadFileContentFromStorage(String storageLocation, String fileName)
With this method a certain file from the configured storage can be loaded as bytes.DomibusConnectorClientMessage
saveMessage(DomibusConnectorClientMessage message)
With this method a message can either be created (if not done yet), or updated.Boolean
submitStoredClientMessage(DomibusConnectorClientMessage message)
Method to submit an already stored and prepared message to the connector.Boolean
uploadMessageFile(DomibusConnectorClientMessageFile messageFile)
Method to add a new file to the message.
-
-
-
Method Detail
-
getAllMessages
public DomibusConnectorClientMessageList getAllMessages()
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive all messages stored in the database of the domibusConnectorClient-Application.- Specified by:
getAllMessages
in interfaceDomibusConnectorClientRestAPI
- Returns:
- An object holding a List of message objects.
-
getMessageById
public DomibusConnectorClientMessage getMessageById(Long id) throws MessageNotFoundException
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive a certain message stored in the domibusConnectorClient-Application database.- Specified by:
getMessageById
in interfaceDomibusConnectorClientRestAPI
- Parameters:
id
- - the database id (technical key) of the message. Usually not used to display message data.- Returns:
- The message object if id is present.
- Throws:
MessageNotFoundException
- if the message with the given id is not present.
-
getMessageByBackendMessageId
public DomibusConnectorClientMessage getMessageByBackendMessageId(String backendMessageId) throws MessageNotFoundException
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive a certain message stored in the domibusConnectorClient-Application database.- Specified by:
getMessageByBackendMessageId
in interfaceDomibusConnectorClientRestAPI
- Parameters:
backendMessageId
- - the backend message id of the message.- Returns:
- The message object if the backend message id is present.
- Throws:
MessageNotFoundException
- if the message with the given the backend message id is not present.
-
getMessageByEbmsMessageId
public DomibusConnectorClientMessage getMessageByEbmsMessageId(String ebmsMessageId) throws MessageNotFoundException
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive a certain message stored in the domibusConnectorClient-Application database.- Specified by:
getMessageByEbmsMessageId
in interfaceDomibusConnectorClientRestAPI
- Parameters:
ebmsMessageId
- - the ebmsMessageId of the message.- Returns:
- The message object if the ebmsMessageId is present.
- Throws:
MessageNotFoundException
- if the message with the given ebmsMessageId is not present.
-
getMessagesByConversationId
public DomibusConnectorClientMessageList getMessagesByConversationId(String conversationId) throws MessageNotFoundException
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive all messages from the conversation with the given id.- Specified by:
getMessagesByConversationId
in interfaceDomibusConnectorClientRestAPI
- Parameters:
conversationId
- - the conversationId of the conversation- Returns:
- An object holding a List of message objects.
- Throws:
MessageNotFoundException
- if no message with the given conversationId is present.
-
getMessagesByPeriod
public DomibusConnectorClientMessageList getMessagesByPeriod(Date from, Date to) throws MessageNotFoundException
Description copied from interface:DomibusConnectorClientRestAPI
Method to receive all messages within the given period.- Specified by:
getMessagesByPeriod
in interfaceDomibusConnectorClientRestAPI
- Parameters:
from
- - start date of the periodto
- - end date of the period- Returns:
- An object holding a List of message objects.
- Throws:
MessageNotFoundException
- if no message in the given period is present.
-
loadFileContentFromStorage
public byte[] loadFileContentFromStorage(String storageLocation, String fileName) throws ParameterException
Description copied from interface:DomibusConnectorClientRestAPI
With this method a certain file from the configured storage can be loaded as bytes.- Specified by:
loadFileContentFromStorage
in interfaceDomibusConnectorClientRestAPI
- Parameters:
storageLocation
- - The full path to the storage location where the file is stored.fileName
- - The name of the file as it is stored within the storage.- Returns:
- the bytes of the file if present.
- Throws:
ParameterException
- if the file cannot be found.
-
saveMessage
public DomibusConnectorClientMessage saveMessage(DomibusConnectorClientMessage message) throws ParameterException, StorageException
Description copied from interface:DomibusConnectorClientRestAPI
With this method a message can either be created (if not done yet), or updated. This is for the data contained within the message object. It does not save message attachments such as files.- Specified by:
saveMessage
in interfaceDomibusConnectorClientRestAPI
- Parameters:
message
- - The message object with the new data contained.- Returns:
- The message object after the update happened. If the message is new it is enriched by the database id.
- Throws:
ParameterException
- if the message object was not filled properly.StorageException
- if the message could not be stored in the storage.
-
deleteMessageById
public Boolean deleteMessageById(Long id) throws ParameterException, StorageException
Description copied from interface:DomibusConnectorClientRestAPI
Deletes a message. The message is deleted from the database of the domibusConnectorClient-Application. Also in the storage the message is deleted.- Specified by:
deleteMessageById
in interfaceDomibusConnectorClientRestAPI
- Parameters:
id
- - The database id (technical key) of the message to be deleted.- Returns:
- A Boolean representing if the operation was successful.
- Throws:
ParameterException
- if the given id is not present.StorageException
- if the stored storage location cannot be found or the stored message cannot be deleted.
-
submitStoredClientMessage
public Boolean submitStoredClientMessage(DomibusConnectorClientMessage message) throws ParameterException, StorageException, MessageSubmissionException
Description copied from interface:DomibusConnectorClientRestAPI
Method to submit an already stored and prepared message to the connector. To be successful the message needs to be prepared entirely. This method relies on the storage. So, the message to be submitted, is loaded entirely from the storage.- Specified by:
submitStoredClientMessage
in interfaceDomibusConnectorClientRestAPI
- Parameters:
message
- - The message object of the message to be submitted to the domibusConnector.- Returns:
- A Boolean representing if the operation was successful.
- Throws:
ParameterException
- if the message cannot be found.StorageException
- if the stored storage location cannot be found or the stored message cannot be loaded from storage.MessageSubmissionException
- if an error occurred submitting the message.
-
uploadMessageFile
public Boolean uploadMessageFile(DomibusConnectorClientMessageFile messageFile) throws ParameterException, StorageException
Description copied from interface:DomibusConnectorClientRestAPI
Method to add a new file to the message. The message needs to be saved already in the database.- Specified by:
uploadMessageFile
in interfaceDomibusConnectorClientRestAPI
- Parameters:
messageFile
- - The object holding all necessary information and the bytes of the file to be stored.- Returns:
- A Boolean representing if the operation was successful.
- Throws:
ParameterException
- if the messageFile parameter was not sufficiently filled.StorageException
- if there was an exception at storage level.
-
deleteMessageFile
public Boolean deleteMessageFile(DomibusConnectorClientMessageFile messageFile) throws ParameterException, StorageException
Description copied from interface:DomibusConnectorClientRestAPI
Deletes a file from a message. The file is deleted from the storage of the message.- Specified by:
deleteMessageFile
in interfaceDomibusConnectorClientRestAPI
- Parameters:
messageFile
- - The object holding all necessary information of the file to be deleted.- Returns:
- A Boolean representing if the operation was successful.
- Throws:
ParameterException
- if the given file is not present.StorageException
- if the stored storage location cannot be found or the stored file cannot be deleted.
-
-