use of org.openforis.collect.remoting.service.FileWrapper in project collect by openforis.
the class BaseAttributeUpdateRequestProxy method parseFileAttributeValue.
protected File parseFileAttributeValue(RecordSessionManager sessionManager, CollectRecord record, Integer nodeId, Object value) {
if (value == null) {
sessionManager.prepareDeleteTempRecordFile(record, nodeId);
return null;
} else {
if (value instanceof FileWrapper) {
FileWrapper fileWrapper = (FileWrapper) value;
java.io.File tempFile = new java.io.File(fileWrapper.getFilePath());
sessionManager.prepareDeleteTempRecordFile(record, nodeId);
sessionManager.indexTempRecordFile(tempFile, nodeId);
return new File(tempFile.getAbsolutePath(), tempFile.length());
} else {
throw new IllegalArgumentException("Invalid value type: expected byte[]");
}
}
}
Aggregations