Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

feat: add version attribute to model #16

Merged
merged 2 commits into from May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -3,53 +3,65 @@
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;

import java.util.Collection;
import java.util.HashSet;

/**
* Base class for the entire communication model, e.g. senders and receivers.
*
* The model is built by various services implementing the {@link com.hlag.tools.commvis.analyzer.service.IScannerService}
* interface.
*/
@Getter
@AllArgsConstructor
@RequiredArgsConstructor
@ToString
public class CommunicationModel {
/**
* Identifier for the current project, e.g. gitlab project id
*/
@SerializedName(value="project_id")

private String projectId;
private final String projectId;

/**
* A name for the project. Just for information.
*/

@SerializedName(value="project_name")
private String projectName;
private final String projectName;

@SerializedName(value="model_version")
private final String modelVersion;

/**
* All HTTP receiver endpoints.
*/
@SerializedName(value="http_consumers")
private Collection<ISenderReceiverCommunication> httpConsumers;
private Collection<ISenderReceiverCommunication> httpConsumers = new HashSet<>();

/**
* All HTTP producers.
*/
@SerializedName(value="http_producers")
private Collection<ISenderReceiverCommunication> httpProducers;
private Collection<ISenderReceiverCommunication> httpProducers = new HashSet<>();

/**
* All JMS receivers.
*/

@SerializedName(value="jms_consumers")
private Collection<ISenderReceiverCommunication> jmsConsumers;
private Collection<ISenderReceiverCommunication> jmsConsumers = new HashSet<>();

public void addHttpConsumer(ISenderReceiverCommunication consumer) {
httpConsumers.add(consumer);
}

public void addHttpProducer(ISenderReceiverCommunication producer) {
httpProducers.add(producer);
}

public void addJmsConsumer(ISenderReceiverCommunication consumer) {
jmsConsumers.add(consumer);
}

public void visit(AbstractCommunicationModelVisitor visitor) {
visitor.visit(this);
Expand Down