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

org.seekay.contract.model.domain.Contract Maven / Gradle / Ivy

The newest version!
package org.seekay.contract.model.domain;

import lombok.Data;

import java.util.*;

@Data
public class Contract implements Comparable {

  private Map info;

  private List> parameters;

  private LinkedList setup;

  private ContractRequest request;

  private ContractResponse response;

  public Set readTags() {
    List arrayListTags = (ArrayList) readInfo().get("tags");
    if (arrayListTags == null) {
      arrayListTags = new ArrayList();
      info.put("tags", arrayListTags);
    }
    return new HashSet(arrayListTags);
  }

  public void addTags(String[] newTags) {
    Set tags = readTags();
    for (String newTag : newTags) {
      if (!newTag.trim().isEmpty()) {
        tags.add(newTag.toLowerCase());
      }
    }
    info.put("tags", new ArrayList(tags));
  }

  public Map readInfo() {
    if(info == null) {
      info = new HashMap();
    }
    return info;
  }

  public int compareTo(Contract otherContract) {
    return this.request.getPath().compareTo(otherContract.request.getPath());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy