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.fiveamsolutions.nci.commons.data.security.AbstractUser.java

/**
 * @return the status
 */
@NotNull
@Enumerated(value = EnumType.STRING)
@Searchable
public AccountStatus getStatus() {
    return status;
}

From source file:edu.duke.cabig.c3pr.domain.PlannedNotification.java

/**
 * Gets the event name.
 * 
 * @return the event name
 */
@Enumerated(EnumType.STRING)
public NotificationEventTypeEnum getEventName() {
    return eventName;
}

From source file:org.projectforge.address.AddressDO.java

@Enumerated(EnumType.STRING)
@Column(name = "form", length = 10)
public FormOfAddress getForm() {
    return form;
}

From source file:it.infn.ct.futuregateway.apiserver.resources.Task.java

/**
 * Returns the status of the task.//from w w  w.  ja  v a  2s .c  om
 *
 * @return The status.
 * @see it.infn.ct.futuregateway.apiserver.v1.resources.Task.STATUS
 */
@Enumerated(EnumType.STRING)
public STATUS getStatus() {
    return status;
}

From source file:org.rhq.enterprise.server.util.CriteriaQueryGenerator.java

private String getParameterReplacedValue(Object value) {
    String returnValue;//from w  ww.j a va 2 s.c o m
    if (value instanceof String) {
        returnValue = "'" + prepareStringBindValue((String) value) + "'";
    } else if (value instanceof Enum<?>) {
        // note: this strategy won't work for entities with multiple enums that are persisted differently
        EnumType type = getPersistenceEnumType(value.getClass());
        if (type == EnumType.STRING) {
            returnValue = "'" + String.valueOf(value) + "'";
        } else {
            returnValue = String.valueOf(value);
        }
    } else if (value instanceof List<?>) {
        List<?> valueList = (List<?>) value;
        StringBuilder results = new StringBuilder();
        boolean first = true;
        for (Object nextValue : valueList) {
            if (first) {
                first = false;
            } else {
                results.append(",");
            }
            results.append(getParameterReplacedValue(nextValue));
        }
        returnValue = results.toString();
    } else {
        returnValue = String.valueOf(value);
    }
    return returnValue;
}

From source file:org.emonocot.model.Taxon.java

/**
 * @return the rank
 */
@Enumerated(value = EnumType.STRING)
public Rank getTaxonRank() {
    return taxonRank;
}

From source file:org.opennms.netmgt.model.OnmsNode.java

/**
 * Flag indicating source of nodeLabel//from w ww .  j a  v  a2 s.c  om
 * - 'U' = user defined
 * - 'H' = IP hostname
 * - 'S' = sysName
 * - 'A' = IP address
 *
 * TODO: change this to an enum
 *
 * @return a {@link String} object.
 */
@XmlElement(name = "labelSource")
@Column(name = "nodeLabelSource", length = 1)
@Enumerated(EnumType.STRING)
@XmlJavaTypeAdapter(NodeLabelSourceXmlAdapter.class)
public NodeLabelSource getLabelSource() {
    return m_labelSource;
}

From source file:org.emonocot.model.Taxon.java

@Enumerated(value = EnumType.STRING)
public TaxonomicStatus getTaxonomicStatus() {
    return taxonomicStatus;
}

From source file:org.rhq.enterprise.server.util.CriteriaQueryGenerator.java

private EnumType getPersistenceEnumType(Class<?> enumFieldType) {
    for (Field nextField : getClass().getFields()) {
        nextField.setAccessible(true);//from  w  w  w . ja v  a 2s.  co m
        if (nextField.getType().equals(enumFieldType)) {
            Enumerated enumeratedAnnotation = nextField.getAnnotation(Enumerated.class);
            if (enumeratedAnnotation != null) {
                return enumeratedAnnotation.value();
            }
        }
    }
    return EnumType.STRING; // catch-all
}

From source file:org.emonocot.model.Taxon.java

/**
 * @return the nomenclatural code
 */
@Enumerated(EnumType.STRING)
public NomenclaturalCode getNomenclaturalCode() {
    return nomenclaturalCode;
}