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

com.threatconnect.sdk.client.reader.SecurityLabelReaderAdapter 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.AbstractGroupAssociateReaderAdapter;
import com.threatconnect.sdk.client.reader.associate.AbstractIndicatorAssociateReaderAdapter;
import com.threatconnect.sdk.client.reader.associate.GroupAssociateReadable;
import com.threatconnect.sdk.client.reader.associate.IndicatorAssociateReadable;
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.SecurityLabelListResponse;
import com.threatconnect.sdk.server.response.entity.SecurityLabelResponse;

import java.io.IOException;

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

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


    protected SecurityLabelReaderAdapter(Connection conn) {
        super(conn, SecurityLabelResponse.class, SecurityLabel.class, SecurityLabelListResponse.class);

        initComposite();
    }

    private void initComposite() {

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

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

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

    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    @Override
    public IterableResponse
getAssociatedIndicatorAddresses(String uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddresses(uniqueId); } @Override public IterableResponse
getAssociatedIndicatorAddresses(String uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddresses(uniqueId, ownerName); } @Override public Address getAssociatedIndicatorAddress(String uniqueId, String ipAddress) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddress(uniqueId, ipAddress); } @Override public Address getAssociatedIndicatorAddress(String uniqueId, String ipAddress, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorAddress(uniqueId, ipAddress, ownerName); } @Override public IterableResponse getAssociatedIndicatorEmailAddresses(String uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddresses(uniqueId); } @Override public IterableResponse getAssociatedIndicatorEmailAddresses(String uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddresses(uniqueId, ownerName); } @Override public EmailAddress getAssociatedIndicatorEmailAddress(String uniqueId, String emailAddress) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddress(uniqueId, emailAddress); } @Override public EmailAddress getAssociatedIndicatorEmailAddress(String uniqueId, String emailAddress, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorEmailAddress(uniqueId, emailAddress, ownerName); } @Override public IterableResponse getAssociatedIndicatorFiles(String uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFiles(uniqueId); } @Override public IterableResponse getAssociatedIndicatorFiles(String uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFiles(uniqueId, ownerName); } @Override public File getAssociatedIndicatorFile(String uniqueId, String fileHash) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFile(uniqueId, fileHash); } @Override public File getAssociatedIndicatorFile(String uniqueId, String fileHash, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorFile(uniqueId, fileHash, ownerName); } @Override public IterableResponse getAssociatedIndicatorHosts(String uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHosts(uniqueId); } @Override public IterableResponse getAssociatedIndicatorHosts(String uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHosts(uniqueId, ownerName); } @Override public Host getAssociatedIndicatorHost(String uniqueId, String hostName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHost(uniqueId, hostName); } @Override public Host getAssociatedIndicatorHost(String uniqueId, String hostName, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorHost(uniqueId, hostName, ownerName); } @Override public IterableResponse getAssociatedIndicatorUrls(String uniqueId) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrls(uniqueId); } @Override public IterableResponse getAssociatedIndicatorUrls(String uniqueId, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrls(uniqueId, ownerName); } @Override public Url getAssociatedIndicatorUrl(String uniqueId, String urlText) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrl(uniqueId, urlText); } @Override public Url getAssociatedIndicatorUrl(String uniqueId, String urlText, String ownerName) throws IOException, FailedResponseException { return indAssocReader.getAssociatedIndicatorUrl(uniqueId, urlText, ownerName); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy