Example usage for javax.persistence EnumType STRING

List of usage examples for javax.persistence EnumType STRING

Introduction

In this page you can find the example usage for javax.persistence EnumType STRING.

Prototype

EnumType STRING

To view the source code for javax.persistence EnumType STRING.

Click Source Link

Document

Persist enumerated type property or field as a string.

Usage

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.RoleAssignmentPE.java

@NotNull(message = ValidationMessages.ROLE_NOT_NULL_MESSAGE)
@Column(name = ColumnNames.ROLE_COLUMN)
@Enumerated(EnumType.STRING)
public final RoleCode getRole() {
    return role;
}

From source file:org.opencustomer.db.vo.system.ListConfigurationVO.java

@Column(name = "list_type")
@Enumerated(EnumType.STRING)
public Type getType() {
    return type;
}

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.EventPE.java

@NotNull(message = ValidationMessages.EVENT_TYPE_NOT_NULL_MESSAGE)
@Column(name = ColumnNames.EVENT_TYPE)
@Enumerated(EnumType.STRING)
public EventType getEventType() {
    return eventType;
}

From source file:org.projectforge.business.fibu.kost.Kost1DO.java

@Enumerated(EnumType.STRING)
@Column(length = 30)
public KostentraegerStatus getKostentraegerStatus() {
    return kostentraegerStatus;
}

From source file:org.opencustomer.db.vo.system.UserLoginLogVO.java

@Column(name = "login_type")
@Enumerated(EnumType.STRING)
public Type getType() {
    return type;
}

From source file:de.micromata.genome.db.jpa.genomecore.chronos.JpaJobResultDO.java

@Column(name = "STATE")
@Enumerated(EnumType.STRING)
public State getState() {
    return state;
}

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.DataTypePE.java

@Column(name = ColumnNames.CODE_COLUMN)
@Length(min = 1, max = 40, message = ValidationMessages.CODE_LENGTH_MESSAGE)
@NotNull(message = ValidationMessages.CODE_NOT_NULL_MESSAGE)
@Pattern(regex = AbstractIdAndCodeHolder.CODE_PATTERN, flags = java.util.regex.Pattern.CASE_INSENSITIVE, message = ValidationMessages.CODE_PATTERN_MESSAGE)
@Enumerated(EnumType.STRING)
public final EntityDataType getCode() {
    return code;//from  ww w.  java 2s.c  om
}

From source file:com.marand.thinkmed.medications.model.impl.MedicationExternalImpl.java

@Override
@Enumerated(EnumType.STRING)
public MedicationExternalSystemType getExternalSystemType() {
    return externalSystemType;
}

From source file:org.batoo.jpa.jdbc.ValueConverter.java

/**
 * convert jdbc data to entity basic values
 * /*  www. ja v  a  2  s .com*/
 * @param value
 *            jdbc raw value
 * @param javaType
 *            type of value
 * @param temporalType
 *            temporal type
 * @param enumType
 *            enum type
 * @param values
 *            EnumType values array for faster operation, leave it to be null but it will be slow
 * @param method
 *            Method for enum valueOf for faster operation, leave it to be null but it will be slow
 * @param lob
 *            is Lob
 * @return java value
 * @since 2.0.1
 */
@SuppressWarnings("unchecked")
public static Object fromJdbc(Object value, Class<?> javaType, TemporalType temporalType, EnumType enumType,
        Enum<?>[] values, Method method, boolean lob) {
    if (value == null) {
        return null;
    }

    if (temporalType != null) {
        if (javaType == Calendar.class) {
            final Calendar calendarValue = Calendar.getInstance();
            switch (temporalType) {
            case DATE:
                if (value instanceof java.sql.Date) {
                    calendarValue.setTime((java.sql.Date) value);
                    return calendarValue;
                }
            case TIME:
                if (value instanceof java.sql.Time) {
                    calendarValue.setTime((java.sql.Time) value);
                    return calendarValue;
                }
            case TIMESTAMP:
                if (value instanceof java.sql.Timestamp) {
                    calendarValue.setTime((java.sql.Timestamp) value);
                    return calendarValue;
                }
            }
        }
    }

    if (enumType != null) {
        try {
            final Class<Enum<?>> enumJavaType = (Class<Enum<?>>) javaType;
            if (enumType == EnumType.ORDINAL && values == null) {
                values = (Enum<?>[]) enumJavaType.getMethod("values").invoke(null);
            } else if (enumType == EnumType.STRING && method == null) {
                method = enumJavaType.getMethod("valueOf", String.class);
            }

            if (enumType == EnumType.ORDINAL) {
                value = values[((Number) value).shortValue()];
            } else {
                value = method.invoke(null, value);
            }
        } catch (final Exception e) {
        }
    }

    if (lob) {
        value = readLob(value, javaType);
    }

    return value;
}

From source file:org.opencustomer.db.vo.calendar.EventCalendarVO.java

@Column(name = "invitation_status")
@Enumerated(EnumType.STRING)
public InvitationStatus getInvitationStatus() {
    return invitationStatus;
}