Package com.logicaldoc.ai.serializer
Class Serializer
java.lang.Object
com.logicaldoc.ai.serializer.Serializer
- Direct Known Subclasses:
- DocumentSerializer,- FileSerializer
Takes care of serializing / deserializing the files required by an
 
AIModel- Since:
- 9.2
- Author:
- Marco Meschieri - LogicalDOC
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidexportModel(AIModel<?, ?> model, File file) Exports into an zip archive this model plus the training filesabstract StringRetrieves a reference (path, id or other) to a file used by the modelimportModel(String modelName, long tenantId, File file) Imports a model from a provided archive, if present it saves the trained file and the training data but it does not store the model itself in the database.abstract InputStreamloadTrainedModel(AIModel<?, ?> model) abstract InputStreamloadTrainingData(AIModel<?, ?> model) abstract voidsaveTrainedModel(AIModel<?, ?> model, InputStream data) Saves the trained model, the input stream gets closedabstract voidsaveTrainingData(AIModel<?, ?> model, InputStream data) Saves the training data set, the input stream gets closed
- 
Constructor Details- 
Serializerpublic Serializer()
 
- 
- 
Method Details- 
loadTrainingDatapublic abstract InputStream loadTrainingData(AIModel<?, ?> model) throws IOException, com.logicaldoc.core.PersistenceException- Throws:
- IOException
- com.logicaldoc.core.PersistenceException
 
- 
loadTrainedModelpublic abstract InputStream loadTrainedModel(AIModel<?, ?> model) throws IOException, com.logicaldoc.core.PersistenceException- Throws:
- IOException
- com.logicaldoc.core.PersistenceException
 
- 
saveTrainingDatapublic abstract void saveTrainingData(AIModel<?, ?> model, InputStream data) throws IOException, com.logicaldoc.core.PersistenceExceptionSaves the training data set, the input stream gets closed- Parameters:
- model- The model
- data- The data to save
- Throws:
- IOException- Error storing the training data
- com.logicaldoc.core.PersistenceException- Error in the data layer
 
- 
saveTrainedModelpublic abstract void saveTrainedModel(AIModel<?, ?> model, InputStream data) throws IOException, com.logicaldoc.core.PersistenceExceptionSaves the trained model, the input stream gets closed- Parameters:
- model- The model
- data- The data to save
- Throws:
- IOException- Error storing the model
- com.logicaldoc.core.PersistenceException- Error in the data layer
 
- 
getFilepublic abstract String getFile(AIModel<?, ?> model, String suffix) throws IOException, com.logicaldoc.core.PersistenceExceptionRetrieves a reference (path, id or other) to a file used by the model- Parameters:
- model- The model
- suffix- The file suffix
- Returns:
- the file's reference
- Throws:
- IOException- Error retrieving the file
- com.logicaldoc.core.PersistenceException- Error in the data layer
 
- 
exportModelpublic void exportModel(AIModel<?, ?> model, File file) throws IOException, com.logicaldoc.core.PersistenceExceptionExports into an zip archive this model plus the training files- Parameters:
- model- The model to export
- file- The archive to export to
- Throws:
- IOException- I/O error
- com.logicaldoc.core.PersistenceException- Error in the data layers
 
- 
importModelpublic AIModel importModel(String modelName, long tenantId, File file) throws IOException, com.logicaldoc.core.PersistenceException Imports a model from a provided archive, if present it saves the trained file and the training data but it does not store the model itself in the database.- Parameters:
- modelName- Name of the new model to create or an existing one to override
- tenantId- Identifier of the tenant
- file- The archive containing model definition and it's trained data
- Returns:
- The model extracted from the archive, not stored in the database
- Throws:
- IOException- Generic IO Error
- com.logicaldoc.core.PersistenceException- Error in the data layers
 
 
-