Package org.jasig.portal.events

Examples of org.jasig.portal.events.EventType


                final StatsSession statsSession = this.getStatsSession(person);
                portalEvent.setStatsSession(statsSession);
            }

            //Ensure the EventType has been persisted, assumes un-persisted events have an id of 0
            final EventType eventType = portalEvent.getEventType().intern();
            if (eventType.getId() == 0 || !this.entityManager.contains(eventType)) {
                //If an existing EventType is found load it, if not persist the one we have
                //Due to EventType's behavior we don't need to replace the eventType with the foundEventType, they synchronize on load
                final EventType foundEventType = this.findExistingEventType(eventType);
                if (foundEventType == null) {
                    this.entityManager.persist(eventType);
                }
            }
           
View Full Code Here


    /**
     * Contains the logic to query for an already persisted EventType with the same type value.
     */
    protected EventType findExistingEventType(EventType eventType) {
        if (eventType.getId() != 0) {
            final EventType foundEventType = this.entityManager.find(EventType.class, eventType.getId());
            if (foundEventType != null) {
                return foundEventType;
            }
           
            eventType.setId(0);
        }
       
        //No id, do a lookup based on the event type
        final HibernateEntityManager hibernateEntityManager = ((HibernateEntityManager)this.entityManager);
        final Session session = hibernateEntityManager.getSession();
       
        //Setup the Criteria query
        final Criteria eventTypeCriteria = session.createCriteria(EventType.class);
        eventTypeCriteria.add(Restrictions.naturalId().set("type", eventType.getType()));
        eventTypeCriteria.setCacheable(true);
        eventTypeCriteria.setMaxResults(1);
       
        final EventType foundEventType = (EventType)eventTypeCriteria.uniqueResult();
        return foundEventType;
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.events.EventType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.