private QueryResult<File> create(Study study, File file, boolean parents, String content, QueryOptions options, String sessionId)
throws CatalogException {
QueryResult<File> queryResult = register(study, file, parents, options, sessionId);
if (file.getType() == File.Type.FILE && StringUtils.isNotEmpty(content)) {
CatalogIOManager ioManager = catalogIOManagerFactory.getDefault();
ioManager.createDirectory(Paths.get(file.getUri()).getParent().toUri(), true);
InputStream inputStream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
ioManager.createFile(file.getUri(), inputStream);
ObjectMap params = new ObjectMap()
.append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.READY)
.append(FileDBAdaptor.QueryParams.SIZE.key(), ioManager.getFileSize(file.getUri()));
queryResult = fileDBAdaptor.update(file.getUid(), params, QueryOptions.empty());
}
return queryResult;
}