All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fi.evolver.basics.spring.messaging.model.MessageQuery Maven / Gradle / Ivy

package fi.evolver.basics.spring.messaging.model;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import fi.evolver.basics.spring.messaging.entity.Message.MessageState;
import fi.evolver.basics.spring.util.RangeI;
import fi.evolver.basics.spring.util.RangeT;
import fi.evolver.basics.spring.util.filter.IntFilterValue;
import fi.evolver.basics.spring.util.filter.StringFilterValue;
import io.swagger.v3.oas.annotations.Parameter;

public class MessageQuery {
	@Parameter(description = "State")
	private MessageState s;
	@Parameter(description="Message chain ID")
	private List mci;
	@Parameter(description = "Creation time")
	private RangeT ct = new RangeT();
	@Parameter(description = "Last updated time")
	private RangeT lut = new RangeT();
	@Parameter(description = "Fail count")
	private RangeI fc = new RangeI();
	@Parameter(description = "Message group ID")
	private List mgi;
	@Parameter(description = "Priority")
	private List p;
	@Parameter(description = "Metadata")
	private String md;


	public MessageState getS() {
		return s;
	}

	public void setS(MessageState s) {
		this.s = s;
	}


	public List getMci() {
		return mci;
	}

	public void setMci(List mci) {
		this.mci = mci;
	}


	public RangeT getCt() {
		return ct;
	}

	public void setCt(RangeT ct) {
		this.ct = ct;
	}


	public RangeT getLut() {
		return lut;
	}

	public void setLut(RangeT lut) {
		this.lut = lut;
	}


	public RangeI getFc() {
		return fc;
	}

	public void setFc(RangeI fc) {
		this.fc = fc;
	}


	public List getMgi() {
		return mgi;
	}

	public void setMgi(List mgi) {
		this.mgi = mgi;
	}


	public List getP() {
		return p;
	}

	public void setP(List p) {
		this.p = p;
	}


	public String getMd() {
		return md;
	}

	public void setMd(String md) {
		this.md = md;
	}


	public Map getMetadata() {
		if (md == null)
			return Collections.emptyMap();

		Map results = new LinkedHashMap<>();
		for (String filter: md.split(",")) {
			String[] parts = filter.split("=", 2);
			if (parts.length != 2)
				continue;
			results.put(parts[0].trim(), parts[1].trim());
		}

		return results;
	}


	@Override
	public String toString() {
		return "ListParams [" + (s != null ? "state=" + s + ", " : "") +
				(mci != null ? "messageChainId=" + mci + ", " : "") +
				(ct != null ? "creationTime=" + ct + ", " : "") +
				(lut != null ? "lastUpdatedTime=" + lut + ", " : "") +
				(fc != null ? "failCount=" + fc + ", " : "") +
				(mgi != null ? "messageGroupId=" + mgi + ", " : "") +
				(p != null ? "priority=" + p : "") + "]";
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy