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

io.alauda.model.ServiceList Maven / Gradle / Ivy

package io.alauda.model;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;
import java.util.*;


@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ServiceList implements Serializable {

    private int count;
    private int next;
    private int previous;
    private int page_size;
    private int num_pages;
    private List results;

    // get the first the uuid of the first servce object
    public String retrieveFirstServiceID(){
        if (this.count == 0 || this.results == null || this.results.size() == 0){
            return "";
        }

        return this.results.get(0).getResource().getUuid();
    }

    public ServiceDetails findByName(String clusterName, String namespace, String name){
        for(ServiceDetails serviceDetail : results){
            if (serviceDetail.getCluster().getName().equals(clusterName)  ||
                    serviceDetail.getNamespace().getName().equals(namespace) ||
                    serviceDetail.getResource().getName().equals(name)){
                return serviceDetail;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "ServiceList{" +
                "count=" + count +
                ", next=" + next +
                ", previous=" + previous +
                ", page_size=" + page_size +
                ", num_pages=" + num_pages +
                '}';
    }

    // region Setter and Getter
    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getNext() {
        return next;
    }

    public void setNext(int next) {
        this.next = next;
    }

    public int getPrevious() {
        return previous;
    }

    public void setPrevious(int previous) {
        this.previous = previous;
    }

    public int getPage_size() {
        return page_size;
    }

    public void setPage_size(int page_size) {
        this.page_size = page_size;
    }

    public int getNum_pages() {
        return num_pages;
    }

    public void setNum_pages(int num_pages) {
        this.num_pages = num_pages;
    }

    public List getResults() {
        return results;
    }

    public void setResults(List results) {
        this.results = results;
    }
    // endregion
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy