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:com.hmsinc.epicenter.model.surveillance.SurveillanceTask.java

/**
 * @return the representation// ww w  . j a va2  s.  c om
 */
@Column(name = "REPRESENTATION", unique = false, nullable = true, insertable = true, updatable = true, length = 40)
@Enumerated(EnumType.STRING)
public DataRepresentation getRepresentation() {
    return representation;
}

From source file:org.projectforge.business.scripting.ScriptDO.java

@Enumerated(EnumType.STRING)
@Column(length = 20)
public ScriptParameterType getParameter4Type() {
    return parameter4Type;
}

From source file:org.projectforge.business.task.TaskDO.java

@Enumerated(EnumType.STRING)
@Column(length = PRIORITY_LENGTH)
public Priority getPriority() {
    return priority;
}

From source file:com.hmsinc.epicenter.model.surveillance.SurveillanceTask.java

/**
 * @return the conditioning//w  w w .  j a v a2 s . c  o  m
 */
@Column(name = "CONDITIONING", unique = false, nullable = true, insertable = true, updatable = true, length = 40)
@Enumerated(EnumType.STRING)
public DataConditioning getConditioning() {
    return conditioning;
}

From source file:gov.nih.nci.firebird.data.AbstractPersonData.java

/**
 * @return the curationStatus/*w  w w  .j  a va2  s.c  o  m*/
 */
@Column(name = "curation_status", length = CurationStatus.MAXIMUM_NAME_LENGTH)
@Enumerated(EnumType.STRING)
@NotNull
public CurationStatus getCurationStatus() {
    return curationStatus;
}

From source file:org.projectforge.framework.persistence.user.entities.PFUserDO.java

@Enumerated(EnumType.STRING)
@Column(name = "time_notation", length = 6)
public TimeNotation getTimeNotation() {
    return timeNotation;
}

From source file:org.projectforge.business.scripting.ScriptDO.java

@Enumerated(EnumType.STRING)
@Column(length = 20)
public ScriptParameterType getParameter5Type() {
    return parameter5Type;
}

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

@Override
@Enumerated(EnumType.STRING)
public TitrationType getTitration() {
    return titration;
}

From source file:gov.nih.nci.firebird.data.user.ManagedInvestigator.java

/**
 * @return the current status
 */
@Enumerated(EnumType.STRING)
public ManagedInvestigatorStatus getStatus() {
    return status;
}

From source file:com.github.gekoh.yagen.ddl.TableConfig.java

private void gatherEnumCheckConstraints(final Map<String, String> attr2colName, final String attrPath,
        Class type) {//www.  j  a  va  2s  .  c  om
    //        HACK: we are using field annotations, need to skip methods otherwise we would have wrong constraints
    traverseFieldsAndMethods(type, true, false, new GatherFieldOrMethodInfoAction() {
        @Override
        public void gatherInfo(AccessibleObject fOm) {
            String attributeName = getAttributeName(fOm);
            String attrPathField = attrPath + "." + attributeName;
            Class attributeType = getAttributeType(fOm);

            if (fOm.isAnnotationPresent(Embedded.class)) {
                addAttributeOverrides(attr2colName, attrPathField, fOm);
                gatherEnumCheckConstraints(attr2colName, attrPathField, attributeType);
            } else if (attributeType.isEnum()) {
                String colName = attr2colName.get(attrPathField);
                if (colName == null) {
                    if (fOm.isAnnotationPresent(Column.class)) {
                        colName = getIdentifierForReference(fOm.getAnnotation(Column.class).name());
                    }

                    if (StringUtils.isEmpty(colName)) {
                        colName = getIdentifierForReference(attributeName);
                    }
                }
                boolean useName = fOm.isAnnotationPresent(Enumerated.class)
                        && fOm.getAnnotation(Enumerated.class).value() == EnumType.STRING;
                StringBuilder cons = new StringBuilder();
                for (Object e : attributeType.getEnumConstants()) {
                    if (cons.length() > 0) {
                        cons.append(", ");
                    }
                    if (useName) {
                        cons.append("'").append(((Enum) e).name()).append("'");
                    } else {
                        cons.append(((Enum) e).ordinal());
                    }
                }
                columnNameToEnumCheckConstraints.put(colName, cons.toString());
            }
        }
    });

    Class superClass = getEntitySuperclass(type);
    if (superClass != null) {
        gatherEnumCheckConstraints(attr2colName, attrPath, superClass);
    }
}