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

com.aeontronix.enhancedmule.tools.role.RoleGroupList Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha4
Show newest version
/*
 * Copyright (c) Aeontronix 2019
 */

package com.aeontronix.enhancedmule.tools.role;

import com.aeontronix.commons.URLBuilder;
import com.aeontronix.enhancedmule.tools.anypoint.Organization;
import com.aeontronix.enhancedmule.tools.util.HttpException;
import com.aeontronix.enhancedmule.tools.util.JsonHelper;
import com.aeontronix.enhancedmule.tools.util.PaginatedList;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class RoleGroupList extends PaginatedList {
    private static final Logger logger = LoggerFactory.getLogger(RoleGroupList.class);

    public RoleGroupList(Organization org) throws HttpException {
        this(org, 50);
    }

    public RoleGroupList(Organization org, int limit) throws HttpException {
        super(org, limit);
        download();
    }

    @Override
    protected @NotNull URLBuilder buildUrl() {
        return new URLBuilder("/accounts/api/organizations/").path(parent.getId()).path("rolegroups")
                .queryParam("include_internal", false);
    }

    @Override
    protected void parseJson(String json, JsonHelper jsonHelper) {
        list = jsonHelper.readJsonList(RoleGroup.class, json, parent, "/data");
    }

    public List getRoleGroups() {
        return list;
    }

    public void setRoleGroups(List roleGroups) {
        list = roleGroups;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy