private void processBasicInfo(Context context, HttpServletRequest request,
HttpServletResponse response) throws SQLException,
ServletException, IOException, AuthorizeException
{
// Wrap multipart request to get the submission info
FileUploadRequest wrapper = new FileUploadRequest(request);
Collection collection = Collection.find(context, UIUtil
.getIntParameter(wrapper, "collection_id"));
if (collection == null)
{
log.warn(LogManager.getHeader(context, "integrity_error", UIUtil
.getRequestLogInfo(wrapper)));
JSPManager.showIntegrityError(request, response);
return;
}
// Get metadata
collection.setMetadata("name", wrapper.getParameter("name"));
collection.setMetadata("short_description", wrapper
.getParameter("short_description"));
collection.setMetadata("introductory_text", wrapper
.getParameter("introductory_text"));
collection.setMetadata("copyright_text", wrapper
.getParameter("copyright_text"));
collection.setMetadata("side_bar_text", wrapper
.getParameter("side_bar_text"));
collection.setMetadata("provenance_description", wrapper
.getParameter("provenance_description"));
// Need to be more careful about license -- make sure it's null if
// nothing was entered
String license = wrapper.getParameter("license");
if ((license != null) || "".equals(license))
{
collection.setLicense(license);
}
File temp = wrapper.getFile("file");
if (temp != null)
{
// Read the temp file as logo
InputStream is = new BufferedInputStream(new FileInputStream(temp));
Bitstream logoBS = collection.setLogo(is);
// Strip all but the last filename. It would be nice
// to know which OS the file came from.
String noPath = wrapper.getFilesystemName("file");
while (noPath.indexOf('/') > -1)
{
noPath = noPath.substring(noPath.indexOf('/') + 1);
}
while (noPath.indexOf('\\') > -1)
{
noPath = noPath.substring(noPath.indexOf('\\') + 1);
}
logoBS.setName(noPath);
logoBS.setSource(wrapper.getFilesystemName("file"));
// Identify the format
BitstreamFormat bf = FormatIdentifier.guessFormat(context, logoBS);
logoBS.setFormat(bf);
AuthorizeManager.addPolicy(context, logoBS, Constants.WRITE, context