
com.threatconnect.sdk.client.writer.associate.AbstractGroupAssociateWriterAdapter Maven / Gradle / Ivy
Show all versions of java-sdk Show documentation
/*
* 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.writer.associate;
import com.threatconnect.sdk.client.UrlTypeable;
import com.threatconnect.sdk.client.response.WriteListResponse;
import com.threatconnect.sdk.client.writer.AbstractBaseWriterAdapter;
import com.threatconnect.sdk.conn.Connection;
import com.threatconnect.sdk.exception.FailedResponseException;
import com.threatconnect.sdk.server.response.entity.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
*
* @author dtineo
*/
public abstract class AbstractGroupAssociateWriterAdapter extends AbstractBaseWriterAdapter
implements GroupAssociateWritable, UrlTypeable
{
public AbstractGroupAssociateWriterAdapter(Connection conn, Class singleType) {
super(conn, singleType);
}
@Override
public WriteListResponse associateGroupAdversaries(P uniqueId, List adversaryIds) throws IOException {
return associateGroupAdversaries(uniqueId, adversaryIds, null);
}
@Override
public WriteListResponse associateGroupAdversaries(P uniqueId, List adversaryIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = createListWithParam(getUrlBasePrefix() + ".byId.groups.adversaries.byGroupId", AdversaryResponse.class, ownerName, map, "groupId", adversaryIds);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupAdversary(P uniqueId, Integer adversaryId) throws IOException, FailedResponseException {
return associateGroupAdversary(uniqueId, adversaryId, null);
}
@Override
public ApiEntitySingleResponse associateGroupAdversary(P uniqueId, Integer adversaryId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", adversaryId);
AdversaryResponse data = createItem(getUrlBasePrefix() + ".byId.groups.adversaries.byGroupId", AdversaryResponse.class, ownerName, map, null);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupDocument(P uniqueId, Integer documentId)
throws IOException, FailedResponseException
{
return associateGroupDocument(uniqueId, documentId, null);
}
@Override
public ApiEntitySingleResponse associateGroupDocument(P uniqueId, Integer documentId, String ownerName)
throws IOException, FailedResponseException
{
Map map = createParamMap("id", uniqueId, "groupId", documentId);
DocumentResponse data = createItem(getUrlBasePrefix() + ".byId.groups.documents.byGroupId", DocumentResponse.class, ownerName, map, null);
return data;
}
@Override
public WriteListResponse associateGroupEmails(P uniqueId, List emailIds) throws IOException {
return associateGroupEmails(uniqueId, emailIds, null);
}
@Override
public WriteListResponse associateGroupEmails(P uniqueId, List emailIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = createListWithParam(getUrlBasePrefix() + ".byId.groups.emails.byGroupId", EmailResponse.class, ownerName, map, "groupId", emailIds);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupEmail(P uniqueId, Integer emailId) throws IOException, FailedResponseException {
return associateGroupEmail(uniqueId, emailId, null);
}
@Override
public ApiEntitySingleResponse associateGroupEmail(P uniqueId, Integer emailId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", emailId);
EmailResponse data = createItem(getUrlBasePrefix() + ".byId.groups.emails.byGroupId", EmailResponse.class, ownerName, map, null);
return data;
}
@Override
public WriteListResponse associateGroupIncidents(P uniqueId, List incidentIds) throws IOException {
return associateGroupIncidents(uniqueId, incidentIds, null);
}
@Override
public WriteListResponse associateGroupIncidents(P uniqueId, List incidentIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = createListWithParam(getUrlBasePrefix() + ".byId.groups.incidents.byGroupId", IncidentResponse.class, ownerName, map, "groupId", incidentIds);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupIncident(P uniqueId, Integer incidentId) throws IOException, FailedResponseException {
return associateGroupIncident(uniqueId, incidentId, null);
}
@Override
public ApiEntitySingleResponse associateGroupIncident(P uniqueId, Integer incidentId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", incidentId);
IncidentResponse data = createItem(getUrlBasePrefix() + ".byId.groups.incidents.byGroupId", IncidentResponse.class, ownerName, map, null);
return data;
}
@Override
public WriteListResponse associateGroupSignatures(P uniqueId, List signatureIds) throws IOException {
return associateGroupSignatures(uniqueId, signatureIds, null);
}
@Override
public WriteListResponse associateGroupSignatures(P uniqueId, List signatureIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = createListWithParam(getUrlBasePrefix() + ".byId.groups.signatures.byGroupId", SignatureResponse.class, ownerName, map, "groupId", signatureIds);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupSignature(P uniqueId, Integer signatureId) throws IOException, FailedResponseException {
return associateGroupSignature(uniqueId, signatureId, null);
}
@Override
public ApiEntitySingleResponse associateGroupSignature(P uniqueId, Integer signatureId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", signatureId);
SignatureResponse data = createItem(getUrlBasePrefix() + ".byId.groups.signatures.byGroupId", SignatureResponse.class, ownerName, map, null);
return data;
}
@Override
public WriteListResponse associateGroupThreats(P uniqueId, List threatIds) throws IOException {
return associateGroupThreats(uniqueId, threatIds, null);
}
@Override
public WriteListResponse associateGroupThreats(P uniqueId, List threatIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = createListWithParam(getUrlBasePrefix() + ".byId.groups.threats.byGroupId", ThreatResponse.class, ownerName, map, "groupId", threatIds);
return data;
}
@Override
public ApiEntitySingleResponse associateGroupThreat(P uniqueId, Integer threatId) throws IOException, FailedResponseException {
return associateGroupThreat(uniqueId, threatId, null);
}
@Override
public ApiEntitySingleResponse associateGroupThreat(P uniqueId, Integer threatId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", threatId);
ThreatResponse data = createItem(getUrlBasePrefix() + ".byId.groups.threats.byGroupId", ThreatResponse.class, ownerName, map, null);
return data;
}
@Override
public WriteListResponse dissociateGroupAdversaries(P uniqueId, List adversaryIds) throws IOException {
return dissociateGroupAdversaries(uniqueId, adversaryIds, null);
}
@Override
public WriteListResponse dissociateGroupAdversaries(P uniqueId, List adversaryIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = deleteList(getUrlBasePrefix() + ".byId.groups.adversaries.byGroupId", AdversaryResponse.class, ownerName, map, "groupId", adversaryIds);
return data;
}
@Override
public ApiEntitySingleResponse dissociateGroupAdversary(P uniqueId, Integer adversaryId) throws IOException, FailedResponseException {
return dissociateGroupAdversary(uniqueId, adversaryId, null);
}
@Override
public ApiEntitySingleResponse dissociateGroupAdversary(P uniqueId, Integer adversaryId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", adversaryId);
AdversaryResponse data = deleteItem(getUrlBasePrefix() + ".byId.groups.adversaries.byGroupId", AdversaryResponse.class, ownerName, map);
return data;
}
@Override
public WriteListResponse dissociateGroupEmails(P uniqueId, List emailIds) throws IOException {
return dissociateGroupEmails(uniqueId, emailIds, null);
}
@Override
public WriteListResponse dissociateGroupEmails(P uniqueId, List emailIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = deleteList(getUrlBasePrefix() + ".byId.groups.emails.byGroupId", EmailResponse.class, ownerName, map, "groupId", emailIds);
return data;
}
@Override
public ApiEntitySingleResponse dissociateGroupEmail(P uniqueId, Integer emailId) throws IOException, FailedResponseException {
return dissociateGroupEmail(uniqueId, emailId, null);
}
@Override
public ApiEntitySingleResponse dissociateGroupEmail(P uniqueId, Integer emailId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", emailId);
EmailResponse data = deleteItem(getUrlBasePrefix() + ".byId.groups.emails.byGroupId", EmailResponse.class, ownerName, map);
return data;
}
@Override
public WriteListResponse dissociateGroupIncidents(P uniqueId, List incidentIds) throws IOException {
return dissociateGroupIncidents(uniqueId, incidentIds, null);
}
@Override
public WriteListResponse dissociateGroupIncidents(P uniqueId, List incidentIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = deleteList(getUrlBasePrefix() + ".byId.groups.incidents.byGroupId", IncidentResponse.class, ownerName, map, "groupId", incidentIds);
return data;
}
@Override
public ApiEntitySingleResponse dissociateGroupIncident(P uniqueId, Integer incidentId) throws IOException, FailedResponseException {
return dissociateGroupIncident(uniqueId, incidentId, null);
}
@Override
public ApiEntitySingleResponse dissociateGroupIncident(P uniqueId, Integer incidentId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", incidentId);
IncidentResponse data = deleteItem(getUrlBasePrefix() + ".byId.groups.incidents.byGroupId", IncidentResponse.class, ownerName, map);
return data;
}
@Override
public WriteListResponse dissociateGroupSignatures(P uniqueId, List signatureIds) throws IOException {
return dissociateGroupSignatures(uniqueId, signatureIds, null);
}
@Override
public WriteListResponse dissociateGroupSignatures(P uniqueId, List signatureIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = deleteList(getUrlBasePrefix() + ".byId.groups.signatures.byGroupId", SignatureResponse.class, ownerName, map, "groupId", signatureIds);
return data;
}
@Override
public ApiEntitySingleResponse dissociateGroupSignature(P uniqueId, Integer signatureId) throws IOException, FailedResponseException {
return dissociateGroupSignature(uniqueId, signatureId, null);
}
@Override
public ApiEntitySingleResponse dissociateGroupSignature(P uniqueId, Integer signatureId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", signatureId);
SignatureResponse data = deleteItem(getUrlBasePrefix() + ".byId.groups.signatures.byGroupId", SignatureResponse.class, ownerName, map);
return data;
}
@Override
public WriteListResponse dissociateGroupThreats(P uniqueId, List threatIds) throws IOException {
return dissociateGroupThreats(uniqueId, threatIds, null);
}
@Override
public WriteListResponse dissociateGroupThreats(P uniqueId, List threatIds, String ownerName) throws IOException {
Map map = createParamMap("id", uniqueId);
WriteListResponse data = deleteList(getUrlBasePrefix() + ".byId.groups.threats.byGroupId", ThreatResponse.class, ownerName, map, "groupId", threatIds);
return data;
}
@Override
public ApiEntitySingleResponse dissociateGroupThreat(P uniqueId, Integer threatId) throws IOException, FailedResponseException {
return dissociateGroupThreat(uniqueId, threatId, null);
}
@Override
public ApiEntitySingleResponse dissociateGroupThreat(P uniqueId, Integer threatId, String ownerName) throws IOException, FailedResponseException {
Map map = createParamMap("id", uniqueId, "groupId", threatId);
ThreatResponse data = deleteItem(getUrlBasePrefix() + ".byId.groups.threats.byGroupId", ThreatResponse.class, ownerName, map);
return data;
}
}