store files in databases and calendar component

Hi all, I have two questions about Cuba-platform:

  1. Is this expected to have an api to store files in database? As there to filesystem with filestorage.
  2. Are you planning to implement a visual calendar component with events?, with months, weeks, days, etc.
    Thank you all and greetings.

Hello Jose Alberto,

  1. You can store files in a database as a byte array. I’ve attached sample project in which I use UploadFiled to upload a file to temporal local file storage and then convert loaded file to a byte array. Here is the code of uploading:

userPhotoUpload.addFileUploadSucceedListener(event -> {
            File file = fileUploadingAPI.getFile(userPhotoUpload.getFileId());

            if (file != null) {
                try {
                    byte[] array = FileUtils.readFileToByteArray(file);
                    getItem().setFile(array);
                } catch (IOException e) {
                    throw new RuntimeException(e.getMessage(), e);
                }
            }
        });

and the entity code:


@Table(name = "STOREFILES_PERSON")
@Entity(name = "storefiles$Person")
public class Person extends StandardEntity {
...
    @Column(name = "FILE_")
    protected byte[] file;

    public void setFile(byte[] file) {
        this.file = file;
    }

    public byte[] getFile() {
        return file;
    }
...
}
  1. We have plans to adding calendar component into the range of components, available by default, but there is no specific date when it will be done. For now, you can use Vaadin Calendar component as it is. You can have a look at the timesheets sample (it works only for full version of the Studio though) to see how to use Vaadin Calendar in CUBA project.

Regards,
Gleb.

Gleb, thanks for the reply and example.
Regards

The Calendar component is implemented in the platform version 6.3: Calendar - CUBA Platform. Developer’s Manual