All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openxava.annotations.Files Maven / Gradle / Ivy

package org.openxava.annotations;

import java.lang.annotation.*;

/**
 * The user can upload several files in this property, so the files are attached to the entity. 

* * The files that are images are shown with image preview. * The user can download any file or see any image (if it is an image) just clicking on it. * * The data type is String with a length of 32. * * Applies to properties.

* * Example: *

 *  @Files
 *  @Column(length=32)
 *  private String documents;
 * 
* * It's synonymous of @Stereotype("FILES"). * * @since 6.6 * @author Javier Paniza */ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.FIELD, ElementType.METHOD }) public @interface Files { /** * Comma separated list of accepted mime types.

* * If the uploaded file does not match with specified types the file is rejected.
* For example, with this code: *

	 * @Files(acceptFileTypes="image/*")
	 * @Column(length=32)
	 * private String photos;
	 * 
* * The user can only upload images, and with this one: *
	 * @Files(acceptFileTypes="text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
	 * @Column(length=32)
  	 * private String spreadsheets;
  	 * 
* Only CSV and Excel files. As you can see in acceptFileTypes you put a * list of mime types * separated by commas and you can use wildcards. */ String acceptFileTypes() default ""; /** * Maximum size of the file to upload in Kb.

* * If the uploaded file is greater than the specified size the file is rejected.
* For example, with this code: *

	 * @Files(maxFileSizeInKb=200)
	 * @Column(length=32)
	 * private String documents;
	 * 
* The user can only upload files of 200 Kb or less.
* * The default value is -1L that means no limit. */ long maxFileSizeInKb() default -1L; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy