Package it.eng.spagobi.analiticalmodel.document.bo

Examples of it.eng.spagobi.analiticalmodel.document.bo.Snapshot


        //delete snapshots eventually associated
        ISnapshotDAO snapshotsDAO = DAOFactory.getSnapshotDAO();
        List snapshots = snapshotsDAO.getSnapshots(obj.getId());
        for (int i=0; i < snapshots.size(); i++){
          Snapshot aSnapshots = (Snapshot) snapshots.get(i);
          snapshotsDAO.deleteSnapshot(aSnapshots.getId());
        }

        //delete notes eventually associated
        IObjNoteDAO objNoteDAO = DAOFactory.getObjNoteDAO();
        objNoteDAO.eraseNotes(obj.getId());
View Full Code Here


    // get the list of snapshots
    List snapshots = getSnapshotList(obj);
    // get the list of viewpoints
    List viewpoints = getViewpointList(obj);
    // get required snapshot
    Snapshot snapshot = getRequiredSnapshot(request, snapshots);
    // get required subObject
    SubObject subObj = getRequiredSubObject(request, subObjects);
    // get parameters
    String userProvidedParametersStr = (String) request.getAttribute(ObjectsTreeConstants.PARAMETERS);
    logger.debug("Used defined parameters: [" + userProvidedParametersStr + "]");
View Full Code Here

   * @param snapshots The list of existing snapshots for the current document
   * @return the required snapshot
   */
  private Snapshot getRequiredSnapshot(SourceBean request, List snapshots) {
    logger.debug("IN");
    Snapshot snapshot = null;
    String snapshotIdStr = (String) request.getAttribute(SpagoBIConstants.SNAPSHOT_ID);
    String snapshotName = (String) request.getAttribute(SpagoBIConstants.SNAPSHOT_NAME);
    if (snapshotName == null && snapshotIdStr == null) {
      logger.debug("Neither SNAPSHOT_NAME nor SNAPSHOT_ID are specified on request. Returning null.");
      return null;
    }
    // get also the snapshot number
    String snapshotNumberStr = (String) request.getAttribute(SpagoBIConstants.SNAPSHOT_HISTORY_NUMBER);
    int snapshotNumber = 0;
    if (snapshotNumberStr != null) {
      try {
        snapshotNumber = new Integer(snapshotNumberStr).intValue();
      } catch (Exception e) {
        logger.error("Snapshot history specified [" + snapshotNumberStr + "] is not a valid integer number, using default 0");
        snapshotNumber = 0;
      }
    }
    if (snapshotName != null) {
      logger.debug("Looking for snapshot with name [" + snapshotName + "] and number [" + snapshotNumberStr + "] ...");
      try {
        snapshot = SchedulerUtilities.getNamedHistorySnapshot(snapshots, snapshotName, snapshotNumber);
      } catch (Exception e) {
        logger.error(e);
      }
    } else {
      try {
        Integer snapshotId = new Integer(snapshotIdStr);
        Iterator it = snapshots.iterator();
        while (it.hasNext() && snapshot == null) {
          Snapshot aSnapshot = (Snapshot) it.next();
          if (aSnapshot.getId().equals(snapshotId)) {
            snapshot = aSnapshot;
          }
        }
      } catch (Exception e) {
        logger.error(e);
View Full Code Here

  private JSONObject handleSnapshotExecution(Integer snapshotId) {
   
    JSONObject response= null;
   
    ISnapshotDAO dao;
    Snapshot snapshot;
    BIObject obj;
    String url;
    ExecutionInstance executionInstance;
   
    logger.debug("IN");
   
    try {
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null in order to properly generate execution url");
     
     
      // we are not executing a subobject, so delete subobject if existing
      executionInstance.setSubObject(null);
     
      dao = null;
      try {
        dao = DAOFactory.getSnapshotDAO();
      } catch (EMFUserError e) {
        logger.error("Error while istantiating DAO", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
      }
      Assert.assertNotNull(dao, "An internal error occurred while istantiating DAO. DAO cannot be null.");

      snapshot = null;
      try {
        snapshot = dao.loadSnapshot(snapshotId);
      } catch (EMFUserError e) {
        logger.error("Snapshot with id = " + snapshotId + " not found", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Scheduled execution not found", e);
      }
      Assert.assertNotNull(dao, "An internal error occurred while loading snapshot [" + snapshotId + "]. Snapshot cannot be null.");
     
      obj = executionInstance.getBIObject();
      if (obj.getId().equals(snapshot.getBiobjId())) {
        executionInstance.setSnapshot(snapshot);
        url = executionInstance.getSnapshotUrl();
        response = new JSONObject();
        try {
          response.put("url", url);
View Full Code Here

    // TODO check if the user is able to execute the document (even if it does no make sense to be able to see the document but not to execute it...)
    byte[] content = null;
    if (ObjectsAccessVerifier.canSee(obj, profile)) {
      logger.debug("Current user [" + ((UserProfile) profile).getUserId().toString() + "] can see snapshot with id = " + idSnap + " of document with id = " + objectId);
      ISnapshotDAO snapdao = DAOFactory.getSnapshotDAO();
      Snapshot snap = snapdao.loadSnapshot(idSnap);
      content = snap.getContent();
    } else {
      logger.error("Current user [" + ((UserProfile) profile).getUserId().toString() + "] CANNOT see snapshot with id = " + idSnap + " of document with id = " + objectId);
      //content = "You cannot see required snapshot.".getBytes();
      content = "You cannot see required snapshot.".getBytes("UTF-8");
    }
View Full Code Here

    if( !(o instanceof Snapshot) ) {
      throw new SerializationException("SnapshotJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      Snapshot snapshot = (Snapshot)o;
      result = new JSONObject();
      result.put(ID, snapshot.getId() );
      result.put(NAME, snapshot.getName() );
      result.put(DESCRIPTION, snapshot.getDescription() );     
      result.put(CREATION_DATE, DATE_FORMATTER.formatsnapshot.getDateCreation() ) );
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
     
    }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.bo.Snapshot

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.