Package de.xima.fc.asset.ms.impl.impex
Class AssetManagementServiceImpl
- java.lang.Object
-
- de.xima.fc.asset.ms.impl.impex.AssetManagementServiceImpl
-
- All Implemented Interfaces:
IAssetManagementService,Serializable
@ApplicationScoped public class AssetManagementServiceImpl extends Object implements IAssetManagementService
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AssetManagementServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete 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.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
-
analyzeForResourceExport
public ResourceExportAnalysisResult analyzeForResourceExport(InputStream inputStream) throws FcAssetException
Description copied from interface:IAssetManagementServiceAnalyzes the specified project for export, identifying all dependencies and checking user permissions.- Specified by:
analyzeForResourceExportin interfaceIAssetManagementService- Parameters:
inputStream- The InputStream containing the resource export data to analyze.- Returns:
- An IResourceExportDataAnalysisResult containing the identified dependencies and any errors.
- Throws:
FcAssetException- if the resource does not exist, the user lacks permissions or another error occurs during retrieval.
-
analyzeForTemplateExport
public TemplateExportAnalysisResult analyzeForTemplateExport(InputStream inputStream) throws FcAssetException
Description copied from interface:IAssetManagementServiceAnalyzes the specified template for export, identifying all dependencies and checking user permissions.- Specified by:
analyzeForTemplateExportin interfaceIAssetManagementService- 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
public AssetExportDataAnalysisResult analyzeAssetExportData(InputStream inputStream) throws FcAssetException
Description copied from interface:IAssetManagementServiceAnalyzes the specified asset export data, identifying the asset type, formcycle version and label of the export.- Specified by:
analyzeAssetExportDatain interfaceIAssetManagementService- 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
public AssetExportFileData readResourceFileFromExport(InputStream inputStream) throws FcAssetException
Description copied from interface:IAssetManagementServiceReads 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.- Specified by:
readResourceFileFromExportin interfaceIAssetManagementService- 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:
FcAssetException- if the export data is invalid, is not a resource export or does not contain a main file.
-
analyzeForResourceImport
public AssetImportAnalysisResult analyzeForResourceImport(InputStream inputStream, AssetScope targetScope, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceAnalyzes 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.- Specified by:
analyzeForResourceImportin interfaceIAssetManagementService- 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:
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
public AssetImportAnalysisResult analyzeForTemplateImport(InputStream inputStream, AssetScope targetScope, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceAnalyzes 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.- Specified by:
analyzeForTemplateImportin interfaceIAssetManagementService- 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:
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
public void exportResource(ResourceExportSpec spec, OutputStream output, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceExports the specified project according to the provided export specification.- Specified by:
exportResourcein interfaceIAssetManagementService- 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:
FcAssetException- if an error occurs during the export process.
-
exportTemplate
public void exportTemplate(TemplateExportSpec spec, OutputStream output, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceExports the specified template according to the provided export specification.- Specified by:
exportTemplatein interfaceIAssetManagementService- 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:
FcAssetException- if an error occurs during the export process.
-
importResource
public ResourceImportResult importResource(ResourceImportSpec spec, InputStream inputStream, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceImports a resource from the provided InputStream according to the given import specification.- Specified by:
importResourcein interfaceIAssetManagementService- 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
public TemplateImportResult importTemplate(TemplateImportSpec spec, InputStream inputStream, IUser user) throws FcAssetException
Description copied from interface:IAssetManagementServiceImports a template from the provided InputStream according to the given import specification.- Specified by:
importTemplatein interfaceIAssetManagementService- 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.
-
-