Examples of SbiSnapshots


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

  private void insertSnapshot(SbiObjects obj, SbiObjects exportedObj) throws EMFUserError {
    logger.debug("IN");
    List exportedSnapshotsList = null;
    List currentSnapshotsList = null;
    SbiSnapshots expSbiSnapshots = null;
    try {
      Query hibQuery = sessionExpDB.createQuery(" from SbiSnapshots ot where ot.sbiObject.biobjId = " + exportedObj.getBiobjId());
      exportedSnapshotsList = hibQuery.list();
      if (exportedSnapshotsList.isEmpty()) {
        logger.debug("Exported document with label = [" + exportedObj.getLabel() + "] has no snapshots");
        return;
      }
      hibQuery = sessionCurrDB
      .createQuery(" from SbiSnapshots ot where ot.sbiObject.biobjId = " + obj.getBiobjId());
      currentSnapshotsList = hibQuery.list();
      Iterator exportedSnapshotsListIt = exportedSnapshotsList.iterator();
      while (exportedSnapshotsListIt.hasNext()) {
        expSbiSnapshots = (SbiSnapshots) exportedSnapshotsListIt.next();
        if (isAlreadyExisting(expSbiSnapshots, currentSnapshotsList)) {
          logger.info("Exported snaphost with name = [" + expSbiSnapshots.getName() + "] and creation date = [" + expSbiSnapshots.getCreationDate() + "] (of document with name = [" + exportedObj.getName() + "] and label = [" + exportedObj.getLabel() + "]) is already existing, most likely it is the same snapshot, so it will not be inserted.");
          metaLog.log("Exported snaphost with name = [" + expSbiSnapshots.getName() + "] and creation date = [" + expSbiSnapshots.getCreationDate() + "] (of document with name = [" + exportedObj.getName() + "] and label = [" + exportedObj.getLabel() + "]) is already existing, most likely it is the same snapshot, so it will not be inserted.");
          continue;
        } else {
          SbiSnapshots newSnapshots = ImportUtilities.makeNewSbiSnapshots(expSbiSnapshots);
          newSnapshots.setSbiObject(obj);
          SbiBinContents binary = insertBinaryContent(expSbiSnapshots.getSbiBinContents());
          newSnapshots.setSbiBinContents(binary);
          sessionCurrDB.save(newSnapshots);
        }
      }
    } catch (Exception e) {
      if (expSbiSnapshots != null) {
View Full Code Here

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

  private boolean isAlreadyExisting(SbiSnapshots expSbiSnapshots,
      List currentSnapshotsList) {
    Iterator currentSnapshotsListIt = currentSnapshotsList.iterator();
    while (currentSnapshotsListIt.hasNext()) {
      SbiSnapshots currentSnapshot = (SbiSnapshots) currentSnapshotsListIt.next();
      if (((currentSnapshot.getName() == null && expSbiSnapshots.getName() == null) ||
          (currentSnapshot.getName() != null && currentSnapshot.getName().equals(expSbiSnapshots.getName())))
          && ((currentSnapshot.getDescription() == null && expSbiSnapshots.getDescription() == null) ||
              (currentSnapshot.getDescription() != null && currentSnapshot.getDescription().equals(expSbiSnapshots.getDescription())))
              && currentSnapshot.getCreationDate().equals(expSbiSnapshots.getCreationDate())) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

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


  private void updateSnapshot(SbiObjects obj, Integer objIdExp) throws EMFUserError {
    logger.debug("IN");
    List subObjList = null;
    SbiSnapshots expSbiSnapshots = null;
    try {
      Query hibQuery = sessionCurrDB.createQuery(" from SbiSnapshots ot where ot.sbiObject.biobjId = " + obj.getBiobjId());
      subObjList = hibQuery.list();
      if (subObjList.isEmpty()) {
        logger.warn(" Error during reading of Existing SbiSnapshots");
      }
      SbiSnapshots existingSbiSnapshots = (SbiSnapshots) subObjList.get(0);

      hibQuery = sessionExpDB.createQuery(" from SbiSnapshots ot where ot.sbiObject.biobjId = " + objIdExp);
      subObjList = hibQuery.list();
      if (subObjList.isEmpty()) {
        logger.warn(" SbiSnapshots is not present");
        return;
      }

      expSbiSnapshots = (SbiSnapshots) subObjList.get(0);

      existingSbiSnapshots.setCreationDate(expSbiSnapshots.getCreationDate());
      existingSbiSnapshots.setDescription(expSbiSnapshots.getDescription());
      existingSbiSnapshots.setName(expSbiSnapshots.getName());
      //existingSbiSnapshots.setSbiObject(obj);
      SbiBinContents existingBinaryContent=existingSbiSnapshots.getSbiBinContents();
      sessionCurrDB.delete(existingBinaryContent);
      SbiBinContents binary = insertBinaryContent(expSbiSnapshots.getSbiBinContents());
      existingSbiSnapshots.setSbiBinContents(binary);
      sessionCurrDB.update(existingSbiSnapshots);

    } catch (Exception e) {
      if (expSbiSnapshots != null) {
        logger.error("Error while updating exported snapshot with name [" + expSbiSnapshots.getName() + "] " +
View Full Code Here

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

      SbiBinContents hibBinContent = new SbiBinContents();
      hibBinContent.setId(snapshot.getBinId());
      hibBinContent.setContent(template);

      SbiSnapshots sub=new SbiSnapshots();
      sub.setCreationDate(snapshot.getDateCreation());
      sub.setDescription(snapshot.getDescription());
      sub.setName(snapshot.getName());
      sub.setSbiBinContents(hibBinContent);
      sub.setSbiObject(hibBIObj);
      sub.setSnapId(snapshot.getId());


      session.save(sub);
      session.save(hibBinContent);
      tx.commit();
View Full Code Here

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

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

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

      query.setInteger(0, idBIObj.intValue());
     
      List hibSnaps = query.list();
      Iterator iterHibSnaps = hibSnaps.iterator();
      while(iterHibSnaps.hasNext()) {
        SbiSnapshots hibSnap = (SbiSnapshots)iterHibSnaps.next();
        Snapshot snap = toSnapshot(hibSnap);
        snaps.add(snap);
      }
      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

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

      updateSbiCommonInfo4Insert(hibBinContent);
      Integer idBin = (Integer)aSession.save(hibBinContent);
      // recover the saved binary hibernate object
      hibBinContent = (SbiBinContents) aSession.load(SbiBinContents.class, idBin);
      // store the object note
      SbiSnapshots hibSnap = new SbiSnapshots();
      hibSnap.setCreationDate(new Date());
      hibSnap.setDescription(description);
      hibSnap.setName(name);
      hibSnap.setSbiBinContents(hibBinContent);
      hibSnap.setSbiObject(hibBIObject);
      updateSbiCommonInfo4Insert(hibSnap);
      aSession.save(hibSnap);
      tx.commit();
    } catch (HibernateException he) {
      logException(he);
View Full Code Here

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

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiSnapshots hibSnap = (SbiSnapshots)aSession.load(SbiSnapshots.class, idSnap);
      snap = toSnapshot(hibSnap);
      tx.commit();
    } catch (HibernateException he) {
      logException(he);
      if (tx != null)
View Full Code Here

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

   *
   * @return the sbi snapshots
   */
  public static SbiSnapshots makeNewSbiSnapshots(SbiSnapshots obj){
    logger.debug("IN");
    SbiSnapshots newObj = new SbiSnapshots();
    newObj.setCreationDate(obj.getCreationDate());
    newObj.setDescription(obj.getDescription());
    newObj.setName(obj.getName());
    logger.debug("OUT");
    return newObj;
  }
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.