Package de.xima.fc.asset.mgmt.impex
Interface IAssetManagementService
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AssetManagementServiceImpl
public interface IAssetManagementService extends Serializable
Service interface for exporting resources, such as resources and templates, in a structured format.- Since:
- 8.6.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description AssetExportDataAnalysisResultanalyzeAssetExportData(InputStream inputStream)Analyzes the specified asset export data, identifying the asset type, formcycle version and label of the export.ResourceExportAnalysisResultanalyzeForResourceExport(InputStream inputStream)Analyzes the specified project for export, identifying all dependencies and checking user permissions.AssetImportAnalysisResultanalyzeForResourceImport(InputStream inputStream, AssetScope targetScope, IUser user)Analyzes the specified resource export data before it is imported into the given target scope, checking whether the target scope already contains a resource with the same UUID and whether the user may overwrite it.TemplateExportAnalysisResultanalyzeForTemplateExport(InputStream inputStream)Analyzes the specified template for export, identifying all dependencies and checking user permissions.AssetImportAnalysisResultanalyzeForTemplateImport(InputStream inputStream, AssetScope targetScope, IUser user)Analyzes the specified template export data before it is imported into the given target scope, checking whether the target scope already contains a template with the same UUID and whether the user may overwrite it.voidexportResource(ResourceExportSpec spec, OutputStream output, IUser user)Exports the specified project according to the provided export specification.voidexportTemplate(TemplateExportSpec spec, OutputStream output, IUser user)Exports the specified template according to the provided export specification.static IAssetManagementServicegetInstance()Retrieves the singleton instance of the IResourceExportService using CDI.ResourceImportResultimportResource(ResourceImportSpec spec, InputStream inputStream, IUser user)Imports a resource from the provided InputStream according to the given import specification.TemplateImportResultimportTemplate(TemplateImportSpec spec, InputStream inputStream, IUser user)Imports a template from the provided InputStream according to the given import specification.AssetExportFileDatareadResourceFileFromExport(InputStream inputStream)Reads the main file of the resource contained in the specified resource export data, e.g. to replace the file of an existing resource with it.
-
-
-
Method Detail
-
getInstance
static IAssetManagementService getInstance()
Retrieves the singleton instance of the IResourceExportService using CDI.- Returns:
- The IResourceExportService instance.
-
analyzeForResourceExport
ResourceExportAnalysisResult analyzeForResourceExport(InputStream inputStream) throws FcAssetException
Analyzes the specified project for export, identifying all dependencies and checking user permissions.- Parameters:
inputStream- The InputStream containing the resource export data to analyze.- Returns:
- An IResourceExportDataAnalysisResult containing the identified dependencies and any errors.
- Throws:
IllegalArgumentException- if the resourceId is null or the user is null.FcAssetException- if the resource does not exist, the user lacks permissions or another error occurs during retrieval.
-
analyzeForTemplateExport
TemplateExportAnalysisResult analyzeForTemplateExport(InputStream inputStream) throws FcAssetException
Analyzes the specified template for export, identifying all dependencies and checking user permissions.- Parameters:
inputStream- The InputStream containing the template export data to analyze.- Returns:
- An ITemplateExportDataAnalysisResult containing the identified dependencies and any errors.
- Throws:
FcAssetException- if the template does not exist, the user lacks permissions or another error occurs during retrieval.
-
analyzeAssetExportData
AssetExportDataAnalysisResult analyzeAssetExportData(InputStream inputStream) throws FcAssetException
Analyzes the specified asset export data, identifying the asset type, formcycle version and label of the export.- Parameters:
inputStream- The InputStream containing the asset export data to analyze.- Returns:
- An IAssetExportDataAnalysisResult containing the asset type, formcycle version and label of the export.
- Throws:
FcAssetException- if the export data is invalid or an error occurs during analysis.
-
readResourceFileFromExport
AssetExportFileData readResourceFileFromExport(InputStream inputStream) throws FcAssetException
Reads the main file of the resource contained in the specified resource export data, e.g. to replace the file of an existing resource with it. Only the export data is read; neither the database is accessed nor are any permissions checked.- Parameters:
inputStream- The InputStream containing the resource export data to read.- Returns:
- The file name, MIME type and content of the main file of the exported resource.
- Throws:
IllegalArgumentException- if the input stream is null.FcAssetException- if the export data is invalid, is not a resource export or does not contain a main file.- Since:
- 8.6.0
-
analyzeForResourceImport
AssetImportAnalysisResult analyzeForResourceImport(InputStream inputStream, AssetScope targetScope, IUser user) throws FcAssetException
Analyzes the specified resource export data before it is imported into the given target scope, checking whether the target scope already contains a resource with the same UUID and whether the user may overwrite it.- Parameters:
inputStream- The InputStream containing the resource export data to analyze.targetScope- The scope into which the resource should be imported.user- The user requesting the import.- Returns:
- The analysis result, describing the exported resource and the conflicting resource, if any.
- Throws:
IllegalArgumentException- if the input stream, target scope or user is null.FcAssetException- if the export data is invalid, the target scope does not exist, the user may not read the conflicting resource or another error occurs during analysis.
-
analyzeForTemplateImport
AssetImportAnalysisResult analyzeForTemplateImport(InputStream inputStream, AssetScope targetScope, IUser user) throws FcAssetException
Analyzes the specified template export data before it is imported into the given target scope, checking whether the target scope already contains a template with the same UUID and whether the user may overwrite it.- Parameters:
inputStream- The InputStream containing the template export data to analyze.targetScope- The scope into which the template should be imported.user- The user requesting the import.- Returns:
- The analysis result, describing the exported template and the conflicting template, if any.
- Throws:
IllegalArgumentException- if the input stream, target scope or user is null.FcAssetException- if the export data is invalid, the target scope does not exist, the user may not read the conflicting template or another error occurs during analysis.
-
exportResource
void exportResource(ResourceExportSpec spec, OutputStream output, IUser user) throws FcAssetException
Exports the specified project according to the provided export specification.- Parameters:
spec- The export specification detailing what to export.output- The OutputStream to which the exported project data will be written.user- The user requesting the export.- Throws:
IllegalArgumentException- if the spec, user, or output is null.FcAssetException- if an error occurs during the export process.
-
exportTemplate
void exportTemplate(TemplateExportSpec spec, OutputStream output, IUser user) throws FcAssetException
Exports the specified template according to the provided export specification.- Parameters:
spec- The export specification detailing what to export.output- The OutputStream to which the exported template data will be written.user- The user requesting the export.- Throws:
IllegalArgumentException- if the spec, user, or output is null.FcAssetException- if an error occurs during the export process.
-
importResource
ResourceImportResult importResource(ResourceImportSpec spec, InputStream inputStream, IUser user) throws FcAssetException
Imports a resource from the provided InputStream according to the given import specification.- Parameters:
spec- The import specification detailing how to perform the import, e.g. the target scope and whether to update existing assets.inputStream- The InputStream from which the resource data will be read.user- The user requesting the import.- Returns:
- An IAssetImportResult containing the results of the import, e.g. the IDs of the created or updated assets and any errors that occurred during the import.
- Throws:
FcAssetException- if an error occurs during the import process, e.g. if the input data is invalid or the user lacks permissions to perform the import.
-
importTemplate
TemplateImportResult importTemplate(TemplateImportSpec spec, InputStream inputStream, IUser user) throws FcAssetException
Imports a template from the provided InputStream according to the given import specification.- Parameters:
spec- The import specification detailing how to perform the import, e.g. the target scope and whether to update existing assets.inputStream- The InputStream from which the template data will be read.user- The user requesting the import.- Returns:
- An IAssetImportResult containing the results of the import, e.g. the IDs of the created or updated assets and any errors that occurred during the import.
- Throws:
FcAssetException- if an error occurs during the import process, e.g. if the input data is invalid or the user lacks permissions to perform the import.
-
-