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

com.threatconnect.sdk.client.reader.VictimReaderAdapter 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.UrlTypeable;
import com.threatconnect.sdk.client.reader.associate.*;
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.*;
import com.threatconnect.sdk.server.response.entity.VictimListResponse;
import com.threatconnect.sdk.server.response.entity.VictimResponse;

import java.io.IOException;

/**
 *
 * @author dtineo
 */
public class VictimReaderAdapter
    extends AbstractBaseReaderAdapter
    implements UrlTypeable, GroupAssociateReadable, IndicatorAssociateReadable
             , VictimAssetAssociateReadable
{

    // composite pattern
    private AbstractGroupAssociateReaderAdapter groupAssocReader;
    private AbstractIndicatorAssociateReaderAdapter indAssocReader;
    private AbstractVictimAssetAssociateReaderAdapter victimAssetAssocReader;


    protected VictimReaderAdapter(Connection conn) {
        super(conn, VictimResponse.class, Victim.class, VictimListResponse.class);

        initComposite();
    }

    private void initComposite() {

        groupAssocReader = new AbstractGroupAssociateReaderAdapter(
                            VictimReaderAdapter.this.getConn()
                          , VictimReaderAdapter.this.singleType
                          , VictimReaderAdapter.this.singleItemType
                          , VictimReaderAdapter.this.listType) {
            @Override
            protected String getUrlBasePrefix() {
                return VictimReaderAdapter.this.getUrlBasePrefix();
            }

            @Override
            public String getUrlType() {
                return VictimReaderAdapter.this.getUrlType();
            }
        };

        indAssocReader = new AbstractIndicatorAssociateReaderAdapter(
                            VictimReaderAdapter.this.getConn()
                          , VictimReaderAdapter.this.singleType
                          , VictimReaderAdapter.this.singleItemType
                          , VictimReaderAdapter.this.listType
            ) {
            @Override
            protected String getUrlBasePrefix() {
                return VictimReaderAdapter.this.getUrlBasePrefix();
            }
            @Override
            public String getUrlType() {
                return VictimReaderAdapter.this.getUrlType();
            }
        };

        victimAssetAssocReader = new AbstractVictimAssetAssociateReaderAdapter(
                            VictimReaderAdapter.this.getConn()
                          , VictimReaderAdapter.this.singleType
                          , VictimReaderAdapter.this.singleItemType
                          , VictimReaderAdapter.this.listType) {
            @Override
            protected String getUrlBasePrefix() {
                return VictimReaderAdapter.this.getUrlBasePrefix();
            }
            @Override
            public String getUrlType() {
                return VictimReaderAdapter.this.getUrlType();
            }
        };

    }

    @Override
    public String getUrlType() {
        return "victims";
    }

    @Override
    protected String getUrlBasePrefix() {
        return "v2.victims";
    }

    @Override
    public IterableResponse getAssociatedGroups(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroups(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroups(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroups(uniqueId,ownerName);
    }

    @Override
    public IterableResponse getAssociatedGroupAdversaries(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupAdversaries(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroupAdversaries(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupAdversaries(uniqueId,ownerName);
    }

    @Override
    public Adversary getAssociatedGroupAdversary(Integer uniqueId, Integer adversaryId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupAdversary(uniqueId,adversaryId);
    }

    @Override
    public Adversary getAssociatedGroupAdversary(Integer uniqueId, Integer adversaryId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupAdversary(uniqueId,adversaryId,ownerName);
    }

    @Override
    public IterableResponse getAssociatedGroupEmails(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupEmails(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroupEmails(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupEmails(uniqueId,ownerName);
    }

    @Override
    public Email getAssociatedGroupEmail(Integer uniqueId, Integer emailId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupEmail(uniqueId,emailId);
    }

    @Override
    public Email getAssociatedGroupEmail(Integer uniqueId, Integer emailId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupEmail(uniqueId, emailId, ownerName);
    }

    @Override
    public IterableResponse getAssociatedGroupIncidents(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupIncidents(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroupIncidents(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupIncidents(uniqueId, ownerName);
    }

    @Override
    public Incident getAssociatedGroupIncident(Integer uniqueId, Integer incidentId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupIncident(uniqueId, incidentId);
    }

    @Override
    public Incident getAssociatedGroupIncident(Integer uniqueId, Integer incidentId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupIncident(uniqueId, incidentId, ownerName);
    }

    @Override
    public IterableResponse getAssociatedGroupSignatures(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupSignatures(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroupSignatures(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupSignatures(uniqueId, ownerName);
    }

    @Override
    public Signature getAssociatedGroupSignature(Integer uniqueId, Integer signatureId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupSignature(uniqueId, signatureId);
    }

    @Override
    public Signature getAssociatedGroupSignature(Integer uniqueId, Integer signatureId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupSignature(uniqueId, signatureId, ownerName);
    }

    @Override
    public IterableResponse getAssociatedGroupThreats(Integer uniqueId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupThreats(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedGroupThreats(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupThreats(uniqueId, ownerName);
    }

    @Override
    public Threat getAssociatedGroupThreat(Integer uniqueId, Integer threatId) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupThreat(uniqueId, threatId);
    }

    @Override
    public Threat getAssociatedGroupThreat(Integer uniqueId, Integer threatId, String ownerName) throws IOException, FailedResponseException {
        return groupAssocReader.getAssociatedGroupThreat(uniqueId, threatId, ownerName);
    }

    @Override
    public IterableResponse getAssociatedIndicators(Integer uniqueId) throws IOException, FailedResponseException {
        return indAssocReader.getAssociatedIndicators(uniqueId);
    }

    @Override
    public IterableResponse getAssociatedIndicators(Integer uniqueId, String ownerName) throws IOException, FailedResponseException {
        return indAssocReader.getAssociatedIndicators(uniqueId, ownerName);
    }

    @Override
    public IterableResponse
getAssociatedIndicatorAddresses(Integer uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddresses(uniqueId); } @Override public IterableResponse
getAssociatedIndicatorAddresses(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddresses(uniqueId, ownerName); } @Override public Address getAssociatedIndicatorAddress(Integer uniqueId, String ipAddress) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddress(uniqueId, ipAddress); } @Override public Address getAssociatedIndicatorAddress(Integer uniqueId, String ipAddress, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddress(uniqueId, ipAddress, ownerName); } @Override public IterableResponse getAssociatedIndicatorEmailAddresses(Integer uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddresses(uniqueId); } @Override public IterableResponse getAssociatedIndicatorEmailAddresses(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddresses(uniqueId, ownerName); } @Override public EmailAddress getAssociatedIndicatorEmailAddress(Integer uniqueId, String emailAddress) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddress(uniqueId, emailAddress); } @Override public EmailAddress getAssociatedIndicatorEmailAddress(Integer uniqueId, String emailAddress, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddress(uniqueId, emailAddress, ownerName); } @Override public IterableResponse getAssociatedIndicatorFiles(Integer uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFiles(uniqueId); } @Override public IterableResponse getAssociatedIndicatorFiles(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFiles(uniqueId, ownerName); } @Override public File getAssociatedIndicatorFile(Integer uniqueId, String fileHash) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFile(uniqueId, fileHash); } @Override public File getAssociatedIndicatorFile(Integer uniqueId, String fileHash, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFile(uniqueId, fileHash, ownerName); } @Override public IterableResponse getAssociatedIndicatorHosts(Integer uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHosts(uniqueId); } @Override public IterableResponse getAssociatedIndicatorHosts(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHosts(uniqueId, ownerName); } @Override public Host getAssociatedIndicatorHost(Integer uniqueId, String hostName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHost(uniqueId, hostName); } @Override public Host getAssociatedIndicatorHost(Integer uniqueId, String hostName, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHost(uniqueId, hostName, ownerName); } @Override public IterableResponse getAssociatedIndicatorUrls(Integer uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrls(uniqueId); } @Override public IterableResponse getAssociatedIndicatorUrls(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrls(uniqueId, ownerName); } @Override public Url getAssociatedIndicatorUrl(Integer uniqueId, String urlText) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrl(uniqueId, urlText); } @Override public Url getAssociatedIndicatorUrl(Integer uniqueId, String urlText, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrl(uniqueId, urlText, ownerName); } @Override public IterableResponse getAssociatedVictimAssets(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssets(uniqueId, ownerName); } @Override public IterableResponse getAssociatedVictimAssetEmailAddresses(Integer uniqueId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetEmailAddresses(uniqueId); } @Override public IterableResponse getAssociatedVictimAssetEmailAddresses(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetEmailAddresses(uniqueId, ownerName); } @Override public VictimEmailAddress getAssociatedVictimAssetEmailAddress(Integer uniqueId, Integer assetId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetEmailAddress(uniqueId, assetId); } @Override public VictimEmailAddress getAssociatedVictimAssetEmailAddress(Integer uniqueId, Integer assetId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetEmailAddress(uniqueId, assetId, ownerName); } @Override public IterableResponse getAssociatedVictimAssetNetworkAccounts(Integer uniqueId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetNetworkAccounts(uniqueId); } @Override public IterableResponse getAssociatedVictimAssetNetworkAccounts(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetNetworkAccounts(uniqueId, ownerName); } @Override public VictimNetworkAccount getAssociatedVictimAssetNetworkAccount(Integer uniqueId, Integer assetId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetNetworkAccount(uniqueId, assetId); } @Override public VictimNetworkAccount getAssociatedVictimAssetNetworkAccount(Integer uniqueId, Integer assetId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetNetworkAccount(uniqueId, assetId, ownerName); } @Override public IterableResponse getAssociatedVictimAssetPhoneNumbers(Integer uniqueId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetPhoneNumbers(uniqueId); } @Override public IterableResponse getAssociatedVictimAssetPhoneNumbers(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetPhoneNumbers(uniqueId, ownerName); } @Override public VictimPhone getAssociatedVictimAssetPhoneNumber(Integer uniqueId, Integer assetId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetPhoneNumber(uniqueId, assetId); } @Override public VictimPhone getAssociatedVictimAssetPhoneNumber(Integer uniqueId, Integer assetId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetPhoneNumber(uniqueId, assetId, ownerName); } @Override public IterableResponse getAssociatedVictimAssetSocialNetworks(Integer uniqueId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetSocialNetworks(uniqueId); } @Override public IterableResponse getAssociatedVictimAssetSocialNetworks(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetSocialNetworks(uniqueId, ownerName); } @Override public VictimSocialNetwork getAssociatedVictimAssetSocialNetwork(Integer uniqueId, Integer assetId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetSocialNetwork(uniqueId, assetId); } @Override public VictimSocialNetwork getAssociatedVictimAssetSocialNetwork(Integer uniqueId, Integer assetId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetSocialNetwork(uniqueId, assetId, ownerName); } @Override public IterableResponse getAssociatedVictimAssetWebsites(Integer uniqueId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetWebsites(uniqueId); } @Override public IterableResponse getAssociatedVictimAssetWebsites(Integer uniqueId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetWebsites(uniqueId, ownerName); } @Override public VictimWebSite getAssociatedVictimAssetWebsite(Integer uniqueId, Integer assetId) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetWebsite(uniqueId, assetId); } @Override public VictimWebSite getAssociatedVictimAssetWebsite(Integer uniqueId, Integer assetId, String ownerName) throws IOException, FailedResponseException { return victimAssetAssocReader.getAssociatedVictimAssetWebsite(uniqueId, assetId, ownerName); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy