Search in sources :

Example 16 with ServiceRegistrationJpaImpl

use of org.opencastproject.serviceregistry.impl.jpa.ServiceRegistrationJpaImpl in project opencast by opencast.

the class ServiceRegistryJpaImpl method getServiceRegistration.

protected ServiceRegistrationJpaImpl getServiceRegistration(EntityManager em, String serviceType, String host) {
    try {
        Query q = em.createNamedQuery("ServiceRegistration.getRegistration");
        q.setParameter("serviceType", serviceType);
        q.setParameter("host", host);
        return (ServiceRegistrationJpaImpl) q.getSingleResult();
    } catch (NoResultException e) {
        return null;
    }
}
Also used : Query(javax.persistence.Query) TypedQuery(javax.persistence.TypedQuery) ServiceRegistrationJpaImpl(org.opencastproject.serviceregistry.impl.jpa.ServiceRegistrationJpaImpl) NoResultException(javax.persistence.NoResultException)

Aggregations

ServiceRegistrationJpaImpl (org.opencastproject.serviceregistry.impl.jpa.ServiceRegistrationJpaImpl)16 EntityManager (javax.persistence.EntityManager)9 NoResultException (javax.persistence.NoResultException)8 NotFoundException (org.opencastproject.util.NotFoundException)8 PersistenceException (javax.persistence.PersistenceException)7 RollbackException (javax.persistence.RollbackException)7 ServiceRegistryException (org.opencastproject.serviceregistry.api.ServiceRegistryException)7 URISyntaxException (java.net.URISyntaxException)6 Job (org.opencastproject.job.api.Job)6 TrustedHttpClientException (org.opencastproject.security.api.TrustedHttpClientException)6 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)6 ConfigurationException (org.osgi.service.cm.ConfigurationException)6 ArrayList (java.util.ArrayList)5 EntityTransaction (javax.persistence.EntityTransaction)5 Query (javax.persistence.Query)4 TypedQuery (javax.persistence.TypedQuery)4 LinkedList (java.util.LinkedList)3 Test (org.junit.Test)3 ServiceRegistration (org.opencastproject.serviceregistry.api.ServiceRegistration)3 HostRegistrationJpaImpl (org.opencastproject.serviceregistry.impl.jpa.HostRegistrationJpaImpl)3