/** * Create a new Asset in the DAM. * * * @param assetManager AssetManager used to created the Asset * @param absTargetPath the absolute path for the Asset that should be created * @param fileInputStream the binary representation of the Asset * @param mimeType the MIME Type of the asset * @return the newly created asset * @throws CsvAssetImportException */ private Asset createAsset(AssetManager assetManager, String absTargetPath, InputStream fileInputStream, String mimeType) throws CsvAssetImportException { try { Asset asset = assetManager.createAsset(absTargetPath, fileInputStream, mimeType, true); log.info("Created new asset [ {} ]", absTargetPath); return asset; } catch (Exception e) { throw new CsvAssetImportException("Could not create Asset at [ " + absTargetPath + " ]", e); } }
versioned = asset != null; assetManager.createRevision(asset, "initial version of asset", asset.getName()); r.commit(); r.refresh(); Asset asset = assetManager.createAsset(assetPath, source.getStream(), type, false);