Interface ModelContentConverter<T extends ModelContent>


  • public interface ModelContentConverter<T extends ModelContent>
    Model content converter interface
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      byte[] convertToBytes​(T modelContent)
      Convert an instance of the model content to bytes array
      java.util.Optional<T> convertToModelContent​(byte[] bytes)
      Convert a bytes array to the handled model content entity.
      ModelType getHandledModelType()
      Get handled model type by this converter.
      default org.activiti.cloud.services.common.file.FileContent overrideModelId​(org.activiti.cloud.services.common.file.FileContent fileContent, java.util.Map<java.lang.String,​java.lang.String> modelIdentifiers)
      Converts the file content to the handled model content entity, sets the given id, and converts back to a FileContent.
    • Method Detail

      • getHandledModelType

        ModelType getHandledModelType()
        Get handled model type by this converter.
        Returns:
        handled model type
      • convertToModelContent

        java.util.Optional<T> convertToModelContent​(byte[] bytes)
        Convert a bytes array to the handled model content entity.
        Parameters:
        bytes - the bytes to convert
        Returns:
        the model content, or Optional.empty()
      • convertToBytes

        byte[] convertToBytes​(T modelContent)
        Convert an instance of the model content to bytes array
        Parameters:
        modelContent - the model content instance to convert
        Returns:
        the bytes array
      • overrideModelId

        default org.activiti.cloud.services.common.file.FileContent overrideModelId​(org.activiti.cloud.services.common.file.FileContent fileContent,
                                                                                    java.util.Map<java.lang.String,​java.lang.String> modelIdentifiers)
        Converts the file content to the handled model content entity, sets the given id, and converts back to a FileContent. If the id is already the expected one, it returns it unchanged.
        Parameters:
        fileContent - the FileContent wrapper to convert and fix
        modelIdentifiers - the mapping of the old ids to the new ones
        Returns:
        the fixed FileContent