Search in sources :

Example 16 with Transient

use of javax.persistence.Transient in project FP-PSP-SERVER by FundacionParaguaya.

the class SnapshotIndicatorPriorityEntity method setEstimatedDateAsISOString.

@Transient
public SnapshotIndicatorPriorityEntity setEstimatedDateAsISOString(String date) {
    if (date != null) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
        this.setEstimatedDate(LocalDate.parse(date, formatter));
    }
    return this;
}
Also used : DateTimeFormatter(java.time.format.DateTimeFormatter) Transient(javax.persistence.Transient)

Example 17 with Transient

use of javax.persistence.Transient in project Gemma by PavlidisLab.

the class PrincipalComponentAnalysis method getEigenvectorArrays.

/**
 * @return Convenience method to access the eigenvectors, as a List of Double[].
 */
@Transient
public List<Double[]> getEigenvectorArrays() throws IllegalArgumentException {
    ByteArrayConverter bac = new ByteArrayConverter();
    List<Double[]> result = new ArrayList<>(this.getNumComponentsStored());
    Collection<BioAssay> bioAssays = this.getBioAssayDimension().getBioAssays();
    if (bioAssays.size() < this.getNumComponentsStored()) {
        /*
             * This is a sanity check. The number of components stored is fixed at some lower value
             */
        throw new IllegalArgumentException("EE id = " + this.getExperimentAnalyzed().getId() + ", PCA: Number of components stored (" + this.getNumComponentsStored() + ") is less than the number of bioAssays (" + bioAssays.size() + ")");
    }
    for (int i = 0; i < bioAssays.size(); i++) {
        result.add(null);
    }
    for (Eigenvector ev : this.getEigenVectors()) {
        int index = ev.getComponentNumber() - 1;
        if (index >= this.getNumComponentsStored())
            continue;
        double[] doubleArr = bac.byteArrayToDoubles(ev.getVector());
        Double[] dA = ArrayUtils.toObject(doubleArr);
        result.set(index, dA);
    }
    CollectionUtils.filter(result, new Predicate() {

        @Override
        public boolean evaluate(Object object) {
            return object != null;
        }
    });
    return result;
}
Also used : ByteArrayConverter(ubic.basecode.io.ByteArrayConverter) ArrayList(java.util.ArrayList) Predicate(org.apache.commons.collections.Predicate) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) Transient(javax.persistence.Transient)

Example 18 with Transient

use of javax.persistence.Transient in project OpenClinica by OpenClinica.

the class AbstractAuditableMutableDomainObject method setUpdaterAndDate.

@Transient
public void setUpdaterAndDate(UserAccountBean updater) {
    setUpdater(updater);
    setUpdatedDate(new Date());
}
Also used : Date(java.util.Date) Transient(javax.persistence.Transient)

Example 19 with Transient

use of javax.persistence.Transient in project OpenClinica by OpenClinica.

the class RuleSetRuleBean method getAllActionsWithEvaluatesToAsKey.

@Transient
public HashMap<String, ArrayList<RuleActionBean>> getAllActionsWithEvaluatesToAsKey(String actionEvaluatesTo) {
    HashMap<String, ArrayList<RuleActionBean>> h = new HashMap<String, ArrayList<RuleActionBean>>();
    for (RuleActionBean action : actions) {
        String key = action.getExpressionEvaluatesTo().toString();
        if (actionEvaluatesTo == null || actionEvaluatesTo.equals(key)) {
            if (h.containsKey(key)) {
                h.get(key).add(action);
            } else {
                ArrayList<RuleActionBean> a = new ArrayList<RuleActionBean>();
                a.add(action);
                h.put(key, a);
            }
        }
    }
    return h;
}
Also used : RuleActionBean(org.akaza.openclinica.domain.rule.action.RuleActionBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Transient(javax.persistence.Transient)

Example 20 with Transient

use of javax.persistence.Transient in project hibernate-orm by hibernate.

the class JPAOverriddenAnnotationReader method initAnnotations.

/*
	 * The idea is to create annotation proxies for the xml configuration elements. Using this proxy annotations together
	 * with the {@link JPAMetadataProvider} allows to handle xml configuration the same way as annotation configuration.
	 */
private void initAnnotations() {
    if (annotations == null) {
        XMLContext.Default defaults = xmlContext.getDefault(className);
        if (className != null && propertyName == null) {
            // is a class
            Element tree = xmlContext.getXMLTree(className);
            Annotation[] annotations = getPhysicalAnnotations();
            List<Annotation> annotationList = new ArrayList<>(annotations.length + 5);
            annotationsMap = new HashMap<>(annotations.length + 5);
            for (Annotation annotation : annotations) {
                if (!annotationToXml.containsKey(annotation.annotationType())) {
                    // unknown annotations are left over
                    annotationList.add(annotation);
                }
            }
            addIfNotNull(annotationList, getEntity(tree, defaults));
            addIfNotNull(annotationList, getMappedSuperclass(tree, defaults));
            addIfNotNull(annotationList, getEmbeddable(tree, defaults));
            addIfNotNull(annotationList, getTable(tree, defaults));
            addIfNotNull(annotationList, getSecondaryTables(tree, defaults));
            addIfNotNull(annotationList, getPrimaryKeyJoinColumns(tree, defaults, true));
            addIfNotNull(annotationList, getIdClass(tree, defaults));
            addIfNotNull(annotationList, getCacheable(tree, defaults));
            addIfNotNull(annotationList, getInheritance(tree, defaults));
            addIfNotNull(annotationList, getDiscriminatorValue(tree, defaults));
            addIfNotNull(annotationList, getDiscriminatorColumn(tree, defaults));
            addIfNotNull(annotationList, getSequenceGenerator(tree, defaults));
            addIfNotNull(annotationList, getTableGenerator(tree, defaults));
            addIfNotNull(annotationList, getNamedQueries(tree, defaults));
            addIfNotNull(annotationList, getNamedNativeQueries(tree, defaults));
            addIfNotNull(annotationList, getNamedStoredProcedureQueries(tree, defaults));
            addIfNotNull(annotationList, getNamedEntityGraphs(tree, defaults));
            addIfNotNull(annotationList, getSqlResultSetMappings(tree, defaults));
            addIfNotNull(annotationList, getExcludeDefaultListeners(tree, defaults));
            addIfNotNull(annotationList, getExcludeSuperclassListeners(tree, defaults));
            addIfNotNull(annotationList, getAccessType(tree, defaults));
            addIfNotNull(annotationList, getAttributeOverrides(tree, defaults, true));
            addIfNotNull(annotationList, getAssociationOverrides(tree, defaults, true));
            addIfNotNull(annotationList, getEntityListeners(tree, defaults));
            addIfNotNull(annotationList, getConverts(tree, defaults));
            this.annotations = annotationList.toArray(new Annotation[annotationList.size()]);
            for (Annotation ann : this.annotations) {
                annotationsMap.put(ann.annotationType(), ann);
            }
            checkForOrphanProperties(tree);
        } else if (className != null) {
            // && propertyName != null ) { //always true but less confusing
            Element tree = xmlContext.getXMLTree(className);
            Annotation[] annotations = getPhysicalAnnotations();
            List<Annotation> annotationList = new ArrayList<>(annotations.length + 5);
            annotationsMap = new HashMap<>(annotations.length + 5);
            for (Annotation annotation : annotations) {
                if (!annotationToXml.containsKey(annotation.annotationType())) {
                    // unknown annotations are left over
                    annotationList.add(annotation);
                }
            }
            preCalculateElementsForProperty(tree);
            Transient transientAnn = getTransient(defaults);
            if (transientAnn != null) {
                annotationList.add(transientAnn);
            } else {
                if (defaults.canUseJavaAnnotations()) {
                    Annotation annotation = getPhysicalAnnotation(Access.class);
                    addIfNotNull(annotationList, annotation);
                }
                getId(annotationList, defaults);
                getEmbeddedId(annotationList, defaults);
                getEmbedded(annotationList, defaults);
                getBasic(annotationList, defaults);
                getVersion(annotationList, defaults);
                getAssociation(ManyToOne.class, annotationList, defaults);
                getAssociation(OneToOne.class, annotationList, defaults);
                getAssociation(OneToMany.class, annotationList, defaults);
                getAssociation(ManyToMany.class, annotationList, defaults);
                getAssociation(Any.class, annotationList, defaults);
                getAssociation(ManyToAny.class, annotationList, defaults);
                getElementCollection(annotationList, defaults);
                addIfNotNull(annotationList, getSequenceGenerator(elementsForProperty, defaults));
                addIfNotNull(annotationList, getTableGenerator(elementsForProperty, defaults));
                addIfNotNull(annotationList, getConvertsForAttribute(elementsForProperty, defaults));
            }
            processEventAnnotations(annotationList, defaults);
            // FIXME use annotationsMap rather than annotationList this will be faster since the annotation type is usually known at put() time
            this.annotations = annotationList.toArray(new Annotation[annotationList.size()]);
            for (Annotation ann : this.annotations) {
                annotationsMap.put(ann.annotationType(), ann);
            }
        } else {
            this.annotations = getPhysicalAnnotations();
            annotationsMap = new HashMap<>(annotations.length + 5);
            for (Annotation ann : this.annotations) {
                annotationsMap.put(ann.annotationType(), ann);
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) AnnotatedElement(java.lang.reflect.AnnotatedElement) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) ClassLoaderAccess(org.hibernate.boot.spi.ClassLoaderAccess) Access(javax.persistence.Access) ManyToMany(javax.persistence.ManyToMany) OneToMany(javax.persistence.OneToMany) Any(org.hibernate.annotations.Any) ManyToAny(org.hibernate.annotations.ManyToAny) Annotation(java.lang.annotation.Annotation) ManyToOne(javax.persistence.ManyToOne) ManyToAny(org.hibernate.annotations.ManyToAny) OneToOne(javax.persistence.OneToOne) ArrayList(java.util.ArrayList) List(java.util.List) Transient(javax.persistence.Transient)

Aggregations

Transient (javax.persistence.Transient)22 ArrayList (java.util.ArrayList)6 UniqueConstraint (javax.persistence.UniqueConstraint)5 HashMap (java.util.HashMap)4 Method (java.lang.reflect.Method)3 RuleActionBean (org.akaza.openclinica.domain.rule.action.RuleActionBean)3 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 ManyToMany (javax.persistence.ManyToMany)2 ManyToOne (javax.persistence.ManyToOne)2 OneToMany (javax.persistence.OneToMany)2 OneToOne (javax.persistence.OneToOne)2 ToStringBuilder (org.apache.commons.lang.builder.ToStringBuilder)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 Annotation (java.lang.annotation.Annotation)1 AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Field (java.lang.reflect.Field)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 List (java.util.List)1 Access (javax.persistence.Access)1