@SuppressWarnings("unchecked")
protected Attachment uploadRequirementSpecificationAttachment(
Integer reqSpecId, String title, String description,
String fileName, String fileType, String content)
throws TestLinkAPIException {
Attachment attachment = null;
Integer id = 0;
attachment = new Attachment(id, reqSpecId,
TestLinkTables.REQUIREMENT_SPECIFICATIONS.toString(), title,
description, fileName, null, fileType, content);
try {
Map<String, Object> executionData = Util
.getRequirementSpecificationAttachmentMap(attachment);
Object response = this.executeXmlRpcCall(
TestLinkMethods.UPLOAD_REQUIREMENT_SPECIFICATION_ATTACHMENT
.toString(), executionData);
Map<String, Object> responseMap = (Map<String, Object>) response;
id = Util.getInteger(responseMap,
TestLinkResponseParams.ID.toString());
attachment.setId(id);
} catch (XmlRpcException xmlrpcex) {
throw new TestLinkAPIException(
"Error uploading attachment for requirement specification: "
+ xmlrpcex.getMessage(), xmlrpcex);
}