if(parameter == null){
throw new TracException(MessageUtils.getMessage("core.parameter.not.found", "TicketAttachment", this.getClass().getName()));
}
WikiAttachment wikiAttachment = (WikiAttachment)parameter;
// check for mandatory fields
String pageName = wikiAttachment.getPageName();
if(pageName == null || pageName.trim().equals("")){
throw new TracException(MessageUtils.getMessage("core.parameter.not.found", "wikiAttachment.pageName", this.getClass().getName()));
}
String fileName = wikiAttachment.getFileName();
if(fileName == null || fileName.trim().equals("")){
throw new TracException(MessageUtils.getMessage("core.parameter.not.found", "wikiAttachment.fileName", this.getClass().getName()));
}
String description = wikiAttachment.getDescription();
if(description == null) description = "";
String fullFileName = wikiAttachment.getFullFileName();
if(fullFileName == null || fullFileName.trim().equals("")){
throw new TracException(MessageUtils.getMessage("core.parameter.not.found", "wikiAttachment.fullFileName", this.getClass().getName()));
}
byte[] binaryData = Utils.getBinaryData(fullFileName, tracProperties);
MultiParameter multiParameter = new MultiParameter();
multiParameter.addParameter(pageName);
multiParameter.addParameter(fileName);
multiParameter.addParameter(description);
multiParameter.addParameter(binaryData);
multiParameter.addParameter(wikiAttachment.isReplaceAttachment());
return multiParameter;
}