Question: public Message createMessage ( Message message, Optional account ) { LOGGER.debug ( Creating message: { } , message ) ; / / Ensure
public Message createMessageMessage message, Optional account
LOGGER.debugCreating message: message;
Ensure that the account exists
if account.isPresent
LOGGER.errorAccount must exist when posting a new message";
throw new IllegalArgumentExceptionAccount must exist when posting a new message";
Validate the message
validateMessagemessage;
Check account permission
checkAccountPermissionaccountget message.getPostedby;
Insert the message into the database
Message createdMessage messageDAO.insertmessage;
LOGGER.infoCreated message: createdMessage;
return createdMessage;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
