2022-01-27 15:02:53 +01:00
package org.gcube.application.geoportal.common.model.rest ;
2021-09-20 16:47:35 +02:00
import lombok.AllArgsConstructor ;
import lombok.Data ;
import lombok.NoArgsConstructor ;
2021-10-06 14:34:07 +02:00
import org.gcube.application.geoportal.common.faults.InvalidRequestException ;
2021-09-20 16:47:35 +02:00
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TempFile {
private String id ;
2022-04-08 14:52:11 +02:00
private String url ;
2021-09-20 16:47:35 +02:00
private String filename ;
2021-10-06 14:34:07 +02:00
public void validate ( ) throws InvalidRequestException {
2022-04-08 14:52:11 +02:00
if ( ( id = = null | | id . isEmpty ( ) ) & & ( url = = null | | url . isEmpty ( ) ) ) throw new InvalidRequestException ( " Invalid temp file " + this + " : ID null or empty and no url defined " ) ;
2021-10-06 14:34:07 +02:00
if ( filename = = null | | filename . isEmpty ( ) ) throw new InvalidRequestException ( " Invalid temp file " + this + " : filename null or empty " ) ;
}
2021-09-20 16:47:35 +02:00
}