Project

General

Profile

1
package eu.dnetlib.goldoa.domain;
2

    
3
import javax.persistence.AttributeConverter;
4

    
5
/**
6
 * Created by panagiotis on 24/1/2017.
7
 */
8
public class RequestStatusConverter implements AttributeConverter<Request.RequestStatus,Integer> {
9

    
10
    public Integer convertToDatabaseColumn(Request.RequestStatus value) {
11
        if ( value == null ) {
12
            return -1;
13
        }
14
        return value.getCode();
15
    }
16

    
17

    
18
    public Request.RequestStatus convertToEntityAttribute(Integer value) {
19
        if ( value == -1 ) {
20
            return null;
21
        }
22
        return Request.RequestStatus.forStatus(value);
23
    }
24
}
(107-107/117)