
com.threatconnect.sdk.client.writer.DocumentWriterAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
The ThreatConnect Java SDK. Used to communicate with teh ThreatConnect Threat Intelligence Platform
The newest version!
package com.threatconnect.sdk.client.writer;
import com.threatconnect.sdk.conn.Connection;
import com.threatconnect.sdk.exception.FailedResponseException;
import com.threatconnect.sdk.server.entity.Document;
import com.threatconnect.sdk.server.response.entity.ApiEntitySingleResponse;
import com.threatconnect.sdk.server.response.entity.DocumentResponse;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by cblades on 4/20/2015.
*/
public class DocumentWriterAdapter extends AbstractGroupWriterAdapter
{
protected DocumentWriterAdapter(Connection conn)
{
super(conn, DocumentResponse.class);
}
@Override
public String getUrlType()
{
return "documents";
}
public ApiEntitySingleResponse uploadFile(int uniqueId, File file) throws IOException, FailedResponseException
{
return uploadFile(uniqueId, file, null);
}
public ApiEntitySingleResponse uploadFile(int uniqueId, File file, String ownerName) throws IOException, FailedResponseException
{
Map paramMap = new HashMap<>();
paramMap.put("id", uniqueId);
return uploadFile("v2.documents.upload", DocumentResponse.class, ownerName, file, paramMap);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy