Package it.eng.spagobi.analiticalmodel.document.metadata

Examples of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjTemplates


        return;
      }
      // finds the next prog value
      Integer nextProg = getNextProg(obj.getBiobjId());

      SbiObjTemplates expTemplate = (SbiObjTemplates) templateList.get(0);
      SbiObjTemplates newObj = ImportUtilities.makeNewSbiObjTemplates(expTemplate);
      newObj.setProg(nextProg);
      if (nextProg.intValue() > 1) {
        // old current template is no more active
        logger.debug("Update template...");
        SbiObjTemplates existingObjTemplate = getCurrentActiveTemplate(obj.getBiobjId());
        existingObjTemplate.setActive(new Boolean(false));
        sessionCurrDB.save(existingObjTemplate);
      }
      newObj.setSbiObject(obj);
      SbiBinContents binary = insertBinaryContent(expTemplate.getSbiBinContents());
      newObj.setSbiBinContents(binary);
View Full Code Here


  private SbiObjTemplates getCurrentActiveTemplate(Integer biobjId) {
    logger.debug("IN");
    String hql = "from SbiObjTemplates sot where sot.active=true and sot.sbiObject.biobjId=" + biobjId;
    Query query = sessionCurrDB.createQuery(hql);
    SbiObjTemplates hibObjTemp = (SbiObjTemplates)query.uniqueResult();
    logger.debug("OUT");
    return hibObjTemp;
  }
View Full Code Here

      }

      byte[] template = biobjTempl.getContent();

      SbiBinContents hibBinContent = new SbiBinContents();
      SbiObjTemplates hibObjTemplate = new SbiObjTemplates();
      hibObjTemplate.setObjTempId(biobjTempl.getBiobjId());
      hibBinContent.setId(biobjTempl.getBinId());
      hibBinContent.setContent(template);


      hibObjTemplate.setActive(new Boolean(true));
      hibObjTemplate.setCreationDate(biobjTempl.getCreationDate());
      hibObjTemplate.setCreationUser(biobjTempl.getCreationUser());
      hibObjTemplate.setDimension(biobjTempl.getDimension());
      hibObjTemplate.setName(biobjTempl.getName());
      hibObjTemplate.setProg(biobjTempl.getProg());
      hibObjTemplate.setSbiBinContents(hibBinContent);
      hibObjTemplate.setSbiObject(hibBIObj);

      session.save(hibBinContent);
      session.save(hibObjTemplate);
      tx.commit();
    } catch (Exception e) {
View Full Code Here

    Session aSession = null;
    Transaction tx = null;   
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiObjTemplates hibObjTemp = (SbiObjTemplates)aSession.load(SbiObjTemplates.class,  tempId);
      objTemp = toObjTemplate(hibObjTemp);
      tx.commit();
    }catch(HibernateException he){
      logException(he);
      if (tx != null) tx.rollback()
View Full Code Here

      //String hql = "from SbiObjTemplates sot where sot.active=true and sot.sbiObject.biobjId="+biobjId;
      String hql = "from SbiObjTemplates sot where sot.active=true and sot.sbiObject.biobjId=?";

      Query query = aSession.createQuery(hql);
      query.setInteger(0, biobjId.intValue());
      SbiObjTemplates hibObjTemp = (SbiObjTemplates)query.uniqueResult();
      if(hibObjTemp==null) {
        objTemp = null;
      } else {
        objTemp = toObjTemplate(hibObjTemp);
      }
View Full Code Here

      //String hql = "from SbiObjTemplates sot where sot.active=true and sot.sbiObject.biobjId="+biobjId;
      String hql = "from SbiObjTemplates sot where sot.active=true and sot.sbiObject.biobjId=?";

      Query query = aSession.createQuery(hql);
      query.setInteger(0, biobjId.intValue());
      SbiObjTemplates hibObjTemp = (SbiObjTemplates)query.uniqueResult();
      if(hibObjTemp==null) {
        objTemp = null;
      } else {
        objTemp = toObjTemplate(hibObjTemp);
      }
View Full Code Here

    Session aSession = null;
    Transaction tx = null;   
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiObjTemplates hibObjTemp = (SbiObjTemplates)aSession.load(SbiObjTemplates.class,  tempId);
      SbiBinContents hibBinCont = hibObjTemp.getSbiBinContents();
      aSession.delete(hibBinCont);
      aSession.delete(hibObjTemp);
      tx.commit();
    }catch(HibernateException he){
      logException(he);
View Full Code Here

      } else {
        nextProg = new Integer(maxProg.intValue() + 1);
      }
     
      // store the object template
      SbiObjTemplates hibObjTemplate = new SbiObjTemplates();
      //check if id is already defined. In positive case update template else insert a new one
      if (objTemplate.getId() != null && objTemplate.getId().compareTo(new Integer("-1")) != 0){
        hibObjTemplate = (SbiObjTemplates)aSession.load(SbiObjTemplates.class, objTemplate.getId());
        hibObjTemplate.setActive(new Boolean(true));
      } else {
        hibObjTemplate.setActive(new Boolean(true));
        hibObjTemplate.setCreationDate(new Date());
        hibObjTemplate.setName(objTemplate.getName());
        hibObjTemplate.setProg(nextProg);
        hibObjTemplate.setSbiBinContents(hibBinContent);
        SbiObjects obj = (SbiObjects) aSession.load(SbiObjects.class, objTemplate.getBiobjId());
        hibObjTemplate.setSbiObject(obj);
        // metadata
        String user = objTemplate.getCreationUser();
        if (user == null || user.equals(""))user = obj.getCreationUser();
        hibObjTemplate.setCreationUser(user);
        hibObjTemplate.setDimension(objTemplate.getDimension());
        updateSbiCommonInfo4Insert(hibObjTemplate);
        aSession.save(hibObjTemplate);
      }
      tx.commit();
    } catch(HibernateException he) {
View Full Code Here

        String hql = "from SbiObjTemplates sot where sot.sbiObject.biobjId="+obj.getId();
        Query query = aSession.createQuery(hql);
        List templs = query.list();
        Iterator iterTempls = templs.iterator();
        while(iterTempls.hasNext()) {
          SbiObjTemplates hibObjTemp = (SbiObjTemplates)iterTempls.next();
          SbiBinContents hibBinCont = hibObjTemp.getSbiBinContents();
          aSession.delete(hibObjTemp);
          aSession.delete(hibBinCont);

        }
View Full Code Here

   *
   * @return the sbi obj templates
   */
  public static SbiObjTemplates makeNewSbiObjTemplates(SbiObjTemplates obj){
    logger.debug("IN");
    SbiObjTemplates newObj = new SbiObjTemplates();
    newObj.setActive(obj.getActive());
    newObj.setCreationDate(obj.getCreationDate());
    newObj.setCreationUser(obj.getCreationUser());
    newObj.setName(obj.getName());
    newObj.setProg(obj.getProg());
    newObj.setDimension(obj.getDimension());
    logger.debug("OUT");
    return newObj;
  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjTemplates

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.