Search in sources :

Example 1 with FileWrapper

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[]");
        }
    }
}
Also used : FileWrapper(org.openforis.collect.remoting.service.FileWrapper) File(org.openforis.idm.model.File)

Aggregations

FileWrapper (org.openforis.collect.remoting.service.FileWrapper)1 File (org.openforis.idm.model.File)1