Examples of beginTx()


Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            EntityManager em = PersistenceService.getInstance().getEntityManager();

            persistenceSvc.beginTx();
            Long healthRecordId = getEntity().getHealthRecordId();
            try {
                requests = em.createNamedQuery("HealthrecordRequest.findByRecIdRequested")
                    .setParameter("recIdRequested", healthRecordId)
                    .getResultList();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        String approvalRequest = new String();

        try {
            if (! securityContext.isUserInRole(UserConfig.ROLE_PATIENT)) throw new Exception("Not in patient role for approval request");
           
            persistenceSvc.beginTx();
            HealthrecordRequest approvedRequest = em.find(HealthrecordRequest.class, requestId);

            //ensure we are linking a request that is of our own record
            if (approvedRequest.getRecIdRequested() == getEntity().getHealthRecordId()) {
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    public BloodPressureConverter get() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new BloodPressureConverter(getEntity(), uriInfo.getAbsolutePath(), Api.DEFAULT_EXPAND_LEVEL);
        } finally {
            PersistenceService.getInstance().close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            if (data.hasError) {
                throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
            }

            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();

            updateEntity(getEntity(), data.resolveEntity(em));
            persistenceSvc.commitTx();
        } finally {
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        String denyRequest = new String();

        try {
            if (! securityContext.isUserInRole(UserConfig.ROLE_PATIENT)) throw new Exception("Not in patient role for denial request");
           
            persistenceSvc.beginTx();
            HealthrecordRequest toDelete = em.find(HealthrecordRequest.class, requestId);

            //ensure we are deleting a request that is of our own record
            if (toDelete.getRecIdRequested() == getEntity().getHealthRecordId()) {
                em.remove(toDelete);
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            //check updateable
            if (getEntity().getDataSourceId() != 1) {
                throw new WebApplicationException(Response.Status.FORBIDDEN);
            }
           
            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        Height latestHeight = null;
        Boolean calculateBMI = true;
        try {
            EntityManager em = PersistenceService.getInstance().getEntityManager();

            persistenceSvc.beginTx();
            Long healthRecordId = getEntity().getHealthRecordId();
            try {
                latestHeight = (Height)em.createNamedQuery("Height.getLatestByHealthRecordId")
                    .setParameter("healthRecordId", healthRecordId)
                    .setMaxResults(1)
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    public PainConverter get() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new PainConverter(getEntity(), uriInfo.getAbsolutePath(), Api.DEFAULT_EXPAND_LEVEL);
        } finally {
            PersistenceService.getInstance().close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            if (data.hasError) {
                throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
            }

            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            updateEntity(getEntity(), data.resolveEntity(em));
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            //check updateable
            if (getEntity().getDataSourceId() != 1) {
                throw new WebApplicationException(Response.Status.FORBIDDEN);
            }
           
            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.