예제 #1
0
 @Override
 public PluginDetails getPluginDetails(final Long pluginId) {
   EntityManager em = daoManager.getEntityManagerFromFactory();
   try {
     daoManager.startTransaction(em);
     PluginDetailsEntity entity = em.find(PluginDetailsEntity.class, pluginId);
     return entity;
   } catch (Exception e) {
     daoManager.closeEntityManager(em);
     return null;
   }
 }
예제 #2
0
  @Override
  public void deleteDetails(final Long pluginId) {
    EntityManager em = daoManager.getEntityManagerFromFactory();

    try {
      daoManager.startTransaction(em);
      PluginDetailsEntity entity = em.find(PluginDetailsEntity.class, pluginId);

      File karFile = new File(entity.getKar());

      if (karFile.delete()) {
        em.remove(entity);
        em.flush();
        daoManager.commitTransaction(em);
      }
    } catch (Exception ex) {
      daoManager.rollBackTransaction(em);
      LOG.error("ConfigDataService deleteOperation:" + ex.toString());
    } finally {
      daoManager.closeEntityManager(em);
    }
  }
예제 #3
0
  @Override
  public void saveDetails(
      final String name, final String version, final String pathToKar /*, final Long userId,
    final Long roleId, final String token */) {
    PluginDetails pluginDetails = new PluginDetailsEntity();
    pluginDetails.setName(name);
    pluginDetails.setVersion(version);
    pluginDetails.setKar(pathToKar);

    EntityManager em = daoManager.getEntityManagerFactory().createEntityManager();

    try {
      daoManager.startTransaction(em);
      em.merge(pluginDetails);
      daoManager.commitTransaction(em);
    } catch (Exception e) {
      daoManager.rollBackTransaction(em);
      LOG.error("ConfigDataService saveProfile:" + e.toString());
    } finally {
      daoManager.closeEntityManager(em);
    }
  }