}
break;
// create a status update
default:
final CreateStatusUpdateResponse createStatusUpdateResponse = new CreateStatusUpdateResponse();
final CreateStatusUpdateRequest createStatusUpdateRequest = CreateStatusUpdateRequest
.checkRequest(formItemList, createRequest,
createStatusUpdateResponse);
createResponse = createStatusUpdateResponse;
if (createStatusUpdateRequest != null) {
try {
this.writeFiles(createStatusUpdateRequest
.getStatusUpdateTemplate(), formItemList);
// create a new status update of the type specified
final StatusUpdate statusUpdate = StatusUpdateManager
.instantiateStatusUpdate(
createStatusUpdateRequest
.getStatusUpdateTemplate()
.getName(), formItemList);
statusUpdate.setId(createStatusUpdateRequest
.getStatusUpdateId());
createStatusUpdateRequest
.setStatusUpdate(statusUpdate);
// create status update
final CreateStatusUpdate createStatusUpdateCommand = new CreateStatusUpdate(
this, createStatusUpdateResponse,
createStatusUpdateRequest);
this.commandQueue.add(createStatusUpdateCommand);
commandStacked = true;
} catch (final StatusUpdateInstantiationFailedException e) {
// remove the files
FormFile fileItem;
File file;
for (String fileIdentifier : formItemList
.getFileIdentifiers()) {
fileItem = formItemList.getFile(fileIdentifier);
file = fileItem.getFile();
if (file != null) {
file.delete();
}
}
createStatusUpdateResponse
.statusUpdateInstantiationFailed(e
.getMessage());
} catch (final Exception e) {
responder.error(500,
"errors encountered while writing files");