HttpServletResponse response, Object command, BindException errors)
throws Exception {
Context dspaceContext = UIUtil.obtainContext(request);
ImportDTO object = (ImportDTO) command;
MultipartFile fileDTO = object.getFile();
// read folder from configuration and make dir
String path = ConfigurationManager
.getProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.path");
File dir = new File(path);
dir.mkdir();
try {
if (object.getModeXSD() != null) {
response.setContentType("application/xml;charset=UTF-8");
response.addHeader("Content-Disposition",
"attachment; filename=rp.xsd");
String nameXSD = "xsd-download-webuirequest.xsd";
File filexsd = new File(dir, nameXSD);
filexsd.createNewFile();
ImportExportUtils.newGenerateXSD(response.getWriter(), dir, applicationService
.findAllContainables(RPPropertiesDefinition.class), filexsd, new String[]{"crisobjects","crisobject"}, "rp:", "http://www.cilea.it/researcherpage/schemas", "http://www.cilea.it/researcherpage/schemas", new String[]{"publicID","uuid","businessID","type"}, new boolean[]{false,false,true,true});
response.getWriter().flush();
response.getWriter().close();
return null;
} else {
if (fileDTO != null && !fileDTO.getOriginalFilename().isEmpty()) {
Boolean defaultStatus = ConfigurationManager
.getBooleanProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.rpdefaultstatus");
if (AuthorizeManager.isAdmin(dspaceContext)) {
dspaceContext.turnOffAuthorisationSystem();
}
ImportExportUtils.importResearchersXML(fileDTO.getInputStream(), dir,
applicationService, dspaceContext, defaultStatus);
saveMessage(
request,
getText("action.import.with.success",
request.getLocale()));