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

com.github.houbbbbb.sso.nt.opt.ServerOpt Maven / Gradle / Ivy

The newest version!
package com.github.houbbbbb.sso.nt.opt;

import com.github.houbbbbb.sso.nt.constants.CacheConstants;
import com.github.houbbbbb.sso.nt.entity.AppDTO;
import com.github.houbbbbb.sso.nt.filter.NameFilter;
import com.github.houbbbbb.sso.nt.filter.NotFilter;
import com.github.houbbbbb.sso.nt.filter.ServiceIdFilter;
import com.github.houbbbbb.sso.nt.filter.TypeFilter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: hbw
 * @date: 2020/7/16
 **/
public class ServerOpt {
    private ServerOpt() {}

    public static List getAppInfo () {
        List appDTOS = new ArrayList<>();
        CacheConstants.LINK_CACHE.forEach((a, b) -> {
            AppDTO appDTO = CacheConstants.INFO_CACHE.get(a);
            if (null != appDTO) {
                appDTOS.add(appDTO);
            }
        });
        return appDTOS;
    }

    public static List getAppByType (String type) {
        return new TypeFilter(type).filter(getAppInfo());
    }

    public static List getAppByName (String name) {
        return new NameFilter(name).filter(getAppInfo());
    }

    public static List getAppByServiceId (String serviceId) {
        return new ServiceIdFilter(serviceId).filter(getAppInfo());
    }

    public static List getAppByTypeNot (String type) {
        return new NotFilter(new TypeFilter(type)).filter(getAppInfo());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy