use of org.olat.core.gui.components.form.flexible.impl.MultipartFileInfos in project OpenOLAT by OpenOLAT.
the class AbstractQtiWorksController method extractFileResponseData.
protected Map<Identifier, ResponseInput> extractFileResponseData() {
Map<Identifier, ResponseInput> fileResponseMap = new HashMap<>();
Set<String> parameterNames = new HashSet<>(mainForm.getRequestMultipartFilesSet());
parameterNames.addAll(mainForm.getRequestParameterSet());
for (String name : parameterNames) {
if (name.startsWith("qtiworks_uploadpresented_")) {
String responseIdentifierString = name.substring("qtiworks_uploadpresented_".length());
Identifier responseIdentifier;
try {
responseIdentifier = getResponseIdentifierFromUniqueId(responseIdentifierString);
// responseIdentifier = Identifier.parseString(responseIdentifierString);
} catch (final QtiParseException e) {
throw new RuntimeException("Bad response identifier encoded in parameter " + name, e);
}
String multipartName = "qtiworks_uploadresponse_" + responseIdentifierString;
MultipartFileInfos multipartFile = mainForm.getRequestMultipartFileInfos(multipartName);
if (multipartFile == null) {
throw new RuntimeException("Expected to find multipart file with name " + multipartName);
}
fileResponseMap.put(responseIdentifier, new FileInput(multipartFile));
}
}
return fileResponseMap;
}
use of org.olat.core.gui.components.form.flexible.impl.MultipartFileInfos in project openolat by klemens.
the class AbstractQtiWorksController method extractFileResponseData.
protected Map<Identifier, ResponseInput> extractFileResponseData() {
Map<Identifier, ResponseInput> fileResponseMap = new HashMap<>();
Set<String> parameterNames = new HashSet<>(mainForm.getRequestMultipartFilesSet());
parameterNames.addAll(mainForm.getRequestParameterSet());
for (String name : parameterNames) {
if (name.startsWith("qtiworks_uploadpresented_")) {
String responseIdentifierString = name.substring("qtiworks_uploadpresented_".length());
Identifier responseIdentifier;
try {
responseIdentifier = getResponseIdentifierFromUniqueId(responseIdentifierString);
// responseIdentifier = Identifier.parseString(responseIdentifierString);
} catch (final QtiParseException e) {
throw new RuntimeException("Bad response identifier encoded in parameter " + name, e);
}
String multipartName = "qtiworks_uploadresponse_" + responseIdentifierString;
MultipartFileInfos multipartFile = mainForm.getRequestMultipartFileInfos(multipartName);
if (multipartFile == null) {
throw new RuntimeException("Expected to find multipart file with name " + multipartName);
}
fileResponseMap.put(responseIdentifier, new FileInput(multipartFile));
}
}
return fileResponseMap;
}
use of org.olat.core.gui.components.form.flexible.impl.MultipartFileInfos in project OpenOLAT by OpenOLAT.
the class AssessmentObjectFormItem method extractFileResponseData.
protected Map<Identifier, MultipartFileInfos> extractFileResponseData() {
Map<Identifier, MultipartFileInfos> fileResponseMap = new HashMap<Identifier, MultipartFileInfos>();
Set<String> parameterNames = new HashSet<>(getRootForm().getRequestMultipartFilesSet());
parameterNames.addAll(getRootForm().getRequestParameterSet());
for (String name : parameterNames) {
if (name.startsWith("qtiworks_uploadpresented_")) {
String responseIdentifierString = name.substring("qtiworks_uploadpresented_".length());
Identifier responseIdentifier;
try {
responseIdentifier = Identifier.parseString(responseIdentifierString);
} catch (final QtiParseException e) {
throw new RuntimeException("Bad response identifier encoded in parameter " + name, e);
}
String multipartName = "qtiworks_uploadresponse_" + responseIdentifierString;
MultipartFileInfos multipartFile = getRootForm().getRequestMultipartFileInfos(multipartName);
if (multipartFile == null) {
throw new RuntimeException("Expected to find multipart file with name " + multipartName);
}
fileResponseMap.put(responseIdentifier, multipartFile);
}
}
return fileResponseMap;
}
use of org.olat.core.gui.components.form.flexible.impl.MultipartFileInfos in project openolat by klemens.
the class AssessmentObjectFormItem method extractFileResponseData.
protected Map<Identifier, MultipartFileInfos> extractFileResponseData() {
Map<Identifier, MultipartFileInfos> fileResponseMap = new HashMap<Identifier, MultipartFileInfos>();
Set<String> parameterNames = new HashSet<>(getRootForm().getRequestMultipartFilesSet());
parameterNames.addAll(getRootForm().getRequestParameterSet());
for (String name : parameterNames) {
if (name.startsWith("qtiworks_uploadpresented_")) {
String responseIdentifierString = name.substring("qtiworks_uploadpresented_".length());
Identifier responseIdentifier;
try {
responseIdentifier = Identifier.parseString(responseIdentifierString);
} catch (final QtiParseException e) {
throw new RuntimeException("Bad response identifier encoded in parameter " + name, e);
}
String multipartName = "qtiworks_uploadresponse_" + responseIdentifierString;
MultipartFileInfos multipartFile = getRootForm().getRequestMultipartFileInfos(multipartName);
if (multipartFile == null) {
throw new RuntimeException("Expected to find multipart file with name " + multipartName);
}
fileResponseMap.put(responseIdentifier, multipartFile);
}
}
return fileResponseMap;
}
Aggregations