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

com.threatconnect.sdk.client.reader.OwnerReaderAdapter Maven / Gradle / Ivy

Go to download

The ThreatConnect Java SDK. Used to communicate with teh ThreatConnect Threat Intelligence Platform

The newest version!
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.threatconnect.sdk.client.reader;

import com.threatconnect.sdk.client.response.IterableResponse;
import com.threatconnect.sdk.conn.Connection;
import com.threatconnect.sdk.exception.FailedResponseException;
import com.threatconnect.sdk.server.entity.Owner;
import com.threatconnect.sdk.server.entity.OwnerMetric;
import com.threatconnect.sdk.server.response.entity.OwnerListResponse;
import com.threatconnect.sdk.server.response.entity.OwnerMetricListResponse;
import com.threatconnect.sdk.server.response.entity.OwnerResponse;

import java.io.IOException;
import java.util.Map;

/**
 *
 * @author dtineo
 */
public class OwnerReaderAdapter extends AbstractReaderAdapter {

    protected OwnerReaderAdapter(Connection conn) {
        super(conn);
    }

    public String getOwnerAsText() throws IOException {
        return getAsText("v2.owners.list");
    }

    public IterableResponse getOwners() throws IOException, FailedResponseException
    {
        return getItems("v2.owners.list", OwnerListResponse.class, Owner.class);
    }

    public Owner getOwnerMine() throws IOException, FailedResponseException {
        OwnerResponse data = getItem("v2.owners.mine", OwnerResponse.class);

        return (Owner) data.getData().getData();
    }

    public IterableResponse getOwnerMetrics() throws IOException, FailedResponseException
    {
        return getItems("v2.owners.metrics", OwnerMetricListResponse.class, OwnerMetric.class);
    }

    public IterableResponse getOwnerMetrics(Integer id) throws IOException, FailedResponseException
    {
        Map map = createParamMap("id", id);

        return getItems("v2.owners.byId.metrics", OwnerMetricListResponse.class, OwnerMetric.class, null, map);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy