Search in sources :

Example 1 with ResponseType

use of io.fixprotocol._2020.orchestra.repository.ResponseType in project fix-orchestra by FIXTradingCommunity.

the class DocGenerator method generateResponses.

private void generateResponses(final List<ResponseType> responseList, final STWriter writer) {
    for (final ResponseType response : responseList) {
        final List<Object> responses = response.getMessageRefOrAssignOrTrigger();
        for (final Object responseRef : responses) {
            if (responseRef instanceof MessageRefType) {
                final MessageRefType messageRef = (MessageRefType) responseRef;
                final ST st = stGroup.getInstanceOf("messageResponse");
                st.add("message", messageRef.getName());
                st.add("scenario", messageRef.getScenario());
                st.add("when", response.getWhen());
                st.write(writer, templateErrorListener);
            }
        }
    }
}
Also used : ST(org.stringtemplate.v4.ST) MessageRefType(io.fixprotocol._2020.orchestra.repository.MessageRefType) ResponseType(io.fixprotocol._2020.orchestra.repository.ResponseType)

Example 2 with ResponseType

use of io.fixprotocol._2020.orchestra.repository.ResponseType in project fix-orchestra by FIXTradingCommunity.

the class ImgGenerator method generateResponses.

private void generateResponses(List<ResponseType> responseList, STWriter writer, STErrorListener errorListener) {
    for (int i = 0; i < responseList.size(); i++) {
        final ResponseType response = responseList.get(i);
        final List<Object> responses = response.getMessageRefOrAssignOrTrigger();
        for (int j = 0; j < responses.size(); j++) {
            final Object responseRef = responses.get(j);
            if (responseRef instanceof MessageRefType) {
                final MessageRefType messageRef = (MessageRefType) responseRef;
                final ST st = stGroup.getInstanceOf("messageResponse");
                st.add("messageName", messageRef.getName());
                st.add("scenarioName", messageRef.getScenario());
                st.add("async", response.getSync() == Synchronization.ASYNCHRONOUS);
                st.add("name", response.getName());
                st.add("isFirstAlt", i == 0 && responseList.size() > 1 && j == 0);
                st.add("isAlt", (i != 0) && responseList.size() > 1 && j == 0);
                st.write(writer, errorListener);
            }
        }
    }
}
Also used : ST(org.stringtemplate.v4.ST) MessageRefType(io.fixprotocol._2020.orchestra.repository.MessageRefType) ResponseType(io.fixprotocol._2020.orchestra.repository.ResponseType)

Example 3 with ResponseType

use of io.fixprotocol._2020.orchestra.repository.ResponseType in project fix-orchestra by FIXTradingCommunity.

the class DocGenerator method generateMessageDetail.

private void generateMessageDetail(final Path messagesDocPath, final Path messagesImgPath, final MessageType message) throws Exception {
    final ST stMessageStart = stGroup.getInstanceOf("messageStart");
    final ST stMessagePart2 = stGroup.getInstanceOf("messagePart2");
    final ST stMessageEnd = stGroup.getInstanceOf("messageEnd");
    stMessageStart.add("message", message);
    stMessagePart2.add("message", message);
    stMessageEnd.add("message", message);
    List<ResponseType> responses = null;
    final Responses responses2 = message.getResponses();
    if (responses2 != null) {
        responses = responses2.getResponse();
    }
    final List<Object> members = message.getStructure().getComponentRefOrGroupRefOrFieldRef();
    final Path path = messagesDocPath.resolve(String.format("%s-%s.html", message.getName(), message.getScenario()));
    try (final STWriterWrapper writer = getWriter(path)) {
        stMessageStart.write(writer, templateErrorListener);
        if (responses != null) {
            generateResponses(responses, writer);
        }
        stMessagePart2.write(writer, templateErrorListener);
        generateMembers(members, writer);
        stMessageEnd.write(writer, templateErrorListener);
    }
    if (responses != null) {
        final FlowType flow = getFlow(message.getFlow());
        imgGenerator.generateUMLSequence(messagesImgPath, pathManager, message, flow, responses, templateErrorListener);
    }
}
Also used : Path(java.nio.file.Path) ST(org.stringtemplate.v4.ST) FlowType(io.fixprotocol._2020.orchestra.repository.FlowType) ResponseType(io.fixprotocol._2020.orchestra.repository.ResponseType) Responses(io.fixprotocol._2020.orchestra.repository.MessageType.Responses)

Aggregations

ResponseType (io.fixprotocol._2020.orchestra.repository.ResponseType)3 ST (org.stringtemplate.v4.ST)3 MessageRefType (io.fixprotocol._2020.orchestra.repository.MessageRefType)2 FlowType (io.fixprotocol._2020.orchestra.repository.FlowType)1 Responses (io.fixprotocol._2020.orchestra.repository.MessageType.Responses)1 Path (java.nio.file.Path)1