PostMethod post = new PostMethod(ontologiesRestUrl);
try {
List<Part> partList = new ArrayList<Part>();
partList.add(filePart);
partList.add(new StringPart("sessionid", sessionId));
// aquaportal version handling:
if ( ontologyId != null ) {
// put the ontologyId as reference for the creation of the new version
partList.add(new StringPart("ontologyId", ontologyId));
}
String userId = _getUserId();
partList.add(new StringPart("userId", userId));
partList.add(new StringPart("urn", uri));
String displayLabel = _getDisplayLabel();
partList.add(new StringPart("displayLabel", displayLabel));
String dateReleased = _getDateReleased();
partList.add(new StringPart("dateReleased", dateReleased));
String contactName = _getContactName();
partList.add(new StringPart("contactName", contactName));
String contactEmail = _getContactEmail();
partList.add(new StringPart("contactEmail", contactEmail));
String versionNumber = _getVersionNumber();
partList.add(new StringPart("versionNumber", versionNumber));
// FIXME: the following are hard-coded for now as they are NOT used by us (ORR)
partList.add(new StringPart("format", "OWL-DL"));
partList.add(new StringPart("isRemote", "0"));
partList.add(new StringPart("statusId", "1"));
partList.add(new StringPart("isReviewed", "1"));
partList.add(new StringPart("codingScheme", "1"));
partList.add(new StringPart("isManual", "1"));
partList.add(new StringPart("isFoundry", "0"));
// TODO: handle "categories" ? For now, putting an arbitrary value
// from the existing values in the default aquaportal database
partList.add(new StringPart("categoryId", "2809"));
// now, perform the POST:
Part[] parts = partList.toArray(new Part[partList.size()]);
post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));