Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EsbMessage editableMessage flag is not used on persist #182

Open
alechenninger opened this issue Jul 8, 2016 · 0 comments
Open

EsbMessage editableMessage flag is not used on persist #182

alechenninger opened this issue Jul 8, 2016 · 0 comments

Comments

@alechenninger
Copy link
Contributor

alechenninger commented Jul 8, 2016

Right now editable message is determined from a header instead of as a field in the entity (db). On the client side, this detail is hidden for reads only, and editableMessage is populated when messages are searched for. But, when persisting a message, the reverse is not true: clients must know to add this as a header.

I would add this logic to ConversionUtility so that going from an EsbMessage adds a header entity for the editableMessage field on the message model. Similarly, when reading, I would also move this logic to ConversionUtility from the entity to the EsbMessage.

Of course, maybe there is a better way. But for example, in EsbMessageAdminServiceImpl:

    EsbMessage[] messageArray = new EsbMessage[1];
    messageArray[0] = ConversionUtility.convertToEsbMessage(messages.get(0));
    messageArray[0].setAllowsResubmit( EmaResubmit.allowsResubmit(messageArray[0]) );
    messageArray[0].setEditableMessage( EmaResubmit.isEditableMessage(messageArray[0]) );
    Map<String,String> matchedConfiguration = matchCriteria(messageArray[0], getNonViewableMessages());
    if(matchedConfiguration!=null) {
        messageArray[0].setPayload(matchedConfiguration.get("replaceMessage"));
    }
    result.setMessages(messageArray);

The extra setter calls are maybe pointing out that convertToEsbMessage is not doing it's job completely. Maybe it would be better if the returned EsbMessage(s) could be fully populated after that call, so this instead looked like:

    EsbMessage[] messageArray = new EsbMessage[1];
    messageArray[0] = ConversionUtility.convertToEsbMessage(messages.get(0), getNonViewableMessages())
    result.setMessages(messageArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant