Examples of PersistenceService


Examples of ag.ion.bion.officelayer.internal.document.PersistenceService

   * @author Andreas Br�ker 
   */
  public IPersistenceService getPersistenceService() {
    if (persistenceService == null) {
      XStorable xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xComponent);
      persistenceService = new PersistenceService(this, xStorable);
    }
    return persistenceService;
  }
View Full Code Here

Examples of com.degloba.persistencia.JPA.PersistenceService

    {
     
      facesContext = FacesContext.getCurrentInstance(); // Contexte JSF
     
      // CUIDADO !!!!!!!!! el #{persistenceService} no s'ha de cambiar encara que es canvii de persistence-unit
    PersistenceService persistenceService = (PersistenceService) facesContext.getApplication().evaluateExpressionGet(facesContext, "#{persistenceService}", PersistenceService.class);
   
    EntityManager em = persistenceService.getEntityManager();
       
        EntityTransaction transaction = em.getTransaction();
       
        try {
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

  }
  catch(NullPointerException ex) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }

        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            //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

     *
     * @param userId identifier for the entity
     */
    @DELETE
    public void delete() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

     */
    @Path("available/")
    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getUsernameAvailable() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            try {
                Long uId = (Long) em.createNamedQuery("User.findUserIdByUsername")
                    .setParameter("username", username)
                    .getSingleResult();
                /*
 
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

    public void setPassword(JSONObject json) throws JSONException {
        String password = (String) json.get("password");
        if (password == null || password.length() == 0) {
            throw new WebApplicationException(Response.Status.BAD_REQUEST);
        }
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            User updatedUser = getEntity();
            updatedUser.setPassword(password);
            updatedUser.setRequiresReset(Boolean.TRUE);
            updateEntity(getEntity(), updatedUser);
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

            @QueryParam("max") @DefaultValue("10") int max,
            @QueryParam("source") @DefaultValue("self") String source,
            @QueryParam("orderBy") @DefaultValue("dateadded") String orderBy,
            @QueryParam("desc") @DefaultValue("1") int desc)
    {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new WeightsConverter(
                getEntities(start, max, source, orderBy, desc),
                uriInfo.getAbsolutePath(),
                Api.DEFAULT_EXPAND_LEVEL
            );
        } finally {
            persistenceSvc.commitTx();
            persistenceSvc.close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

        }
        catch(NullPointerException ex) {
            throw new WebApplicationException(Response.Status.FORBIDDEN);
        }
       
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            if (data.hasError) {
                throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
            }

            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            Weight entity = data.resolveEntity(em);
            createEntity(data.resolveEntity(em));
            persistenceSvc.commitTx();
            return Response.created(uriInfo.getAbsolutePath().resolve(entity.getWeightId() + "/")).build();
        } finally {
            persistenceSvc.close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService

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

Examples of com.krminc.phr.dao.PersistenceService

        }
        catch(NullPointerException ex) {
            throw new WebApplicationException(Response.Status.FORBIDDEN);
        }
       
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            //check updateable
            if (getEntity().getDataSourceId() != 1) {
                throw new WebApplicationException(Response.Status.FORBIDDEN);
            }

            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
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.