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

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


        IEngineDriver aEngineDriver = (IEngineDriver)Class.forName(driverClassName).newInstance();
        Map mapPars = aEngineDriver.getParameterMap(obj, profile, executionRole);
        String id = (String) requestSB.getAttribute("vpId");
        if (id != null){
          IViewpointDAO VPDAO = DAOFactory.getViewpointDAO();   
          Viewpoint vp =  VPDAO.loadViewpointByID(new Integer(id));
          String[] vpParameters = vp.getVpValueParams().split("%26");
          if (vpParameters != null){
            for (int i=0; i< vpParameters.length; i++){
              String param = (String)vpParameters[i];
              String name = param.substring(0, param.indexOf("%3D"));
              String value = param.substring(param.indexOf("%3D")+3);
View Full Code Here


   * @throws EMFUserError the EMF user error
   *
   * @see it.eng.spagobi.analiticalmodel.document.dao.IViewpointDAO#loadViewpointByID(java.lang.Integer)
   */
  public Viewpoint loadViewpointByID(Integer id) throws EMFUserError {
    Viewpoint toReturn = null;
    Session aSession = null;
    Transaction tx = null;
   
    try {
      aSession = getSession();
View Full Code Here

   * @throws EMFUserError the EMF user error
   *
   * @see it.eng.spagobi.analiticalmodel.document.dao.IViewpointDAO#loadViewpointByName(java.lang.String)
   */
  public Viewpoint loadViewpointByNameAndBIObjectId(String name, Integer biobjectId) throws EMFUserError {
    Viewpoint toReturn = null;
    Session aSession = null;
    Transaction tx = null;
   
    try {
      aSession = getSession();
View Full Code Here

   *
   * @param hibViewpoint The hybernate viewpoint at input
   * @return The corrispondent <code>Viewpoint</code> object
   */
  public Viewpoint toViewpoint(SbiViewpoints hibViewpoint){
    Viewpoint aViewpoint = new Viewpoint();
    aViewpoint.setVpId(hibViewpoint.getVpId());
    aViewpoint.setBiobjId(hibViewpoint.getSbiObject().getBiobjId());
    aViewpoint.setVpOwner(hibViewpoint.getVpOwner());
    aViewpoint.setVpName(hibViewpoint.getVpName());
    aViewpoint.setVpDesc(hibViewpoint.getVpDesc());
    aViewpoint.setVpScope(hibViewpoint.getVpScope());
    aViewpoint.setVpValueParams(hibViewpoint.getVpValueParams());
    aViewpoint.setVpCreationDate(hibViewpoint.getVpCreationDate());
    return  aViewpoint;
  }
View Full Code Here

    }

    IViewpointDAO biViewpointDAO = DAOFactory.getViewpointDAO();
    biViewpointDAO.setUserProfile(profile);
    // check if a viewpoint with the same name yet exists
    Viewpoint tmpVP = biViewpointDAO.loadViewpointByNameAndBIObjectId(nameVP, obj.getId());
    if (tmpVP != null) {
      errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
          6002, null));
      // set into the response the right information for loopback
      response.setAttribute(SpagoBIConstants.PUBLISHER_NAME,
      "ExecuteBIObjectPageParameter");
      logger.debug("OUT");
      return;
    }
    Viewpoint aViewpoint = new Viewpoint();
    aViewpoint.setBiobjId(obj.getId());
    aViewpoint.setVpName(nameVP);
    aViewpoint.setVpOwner(ownerVP);
    aViewpoint.setVpDesc(descVP);
    aViewpoint.setVpScope(scopeVP);
    aViewpoint.setVpValueParams(contentVP);
    aViewpoint.setVpCreationDate(new Timestamp(System.currentTimeMillis()));
    biViewpointDAO.insertViewpoint(aViewpoint);

    // set data in response
    response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "ExecuteBIObjectPageParameter");
View Full Code Here

        // if user is administrator, he can delete it
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          canDelete = true;
        } else {
          // if user is not administrator, he can delete it only if he is the owner
          Viewpoint vp = vpDAO.loadViewpointByID(vpId);
          if (vp == null) {
            logger.warn("Viewpoiny with id = " + vpId + " not found!");
            continue;
          }
          if (vp.getVpOwner().equals(userId)) {
            canDelete = true;
          }
        }
        if (canDelete) {
          logger.error("Deleting viewpoint with id = " + vpId + " ...");
View Full Code Here

  throws Exception {
    logger.debug("OUT");
    String id = (String) request.getAttribute("vpId");

    IViewpointDAO VPDAO = DAOFactory.getViewpointDAO();
    Viewpoint vp = VPDAO.loadViewpointByID(new Integer(id));
    ExecutionInstance instance = getExecutionInstance();
    BIObject obj = instance.getBIObject();
    // gets parameter's values and creates a string of values
    List parameters = obj.getBiObjectParameters();
    Iterator iterParams = parameters.iterator();

    String allParametersValues = vp.getVpValueParams();
    allParametersValues = allParametersValues.replace("%26", "&");
    allParametersValues = allParametersValues.replace("%3D", "=");
    instance.applyViewpoint( allParametersValues, false);
    //instance.setParameterValues(allParametersValues, false);
    // check parameters values
View Full Code Here

        //delete viewpoints eventually associated
        List viewpoints = new ArrayList();
        IViewpointDAO biVPDAO = DAOFactory.getViewpointDAO();
        viewpoints =  biVPDAO.loadAllViewpointsByObjID(obj.getId());
        for (int i=0; i<viewpoints.size(); i++){
          Viewpoint vp =(Viewpoint)viewpoints.get(i);
          biVPDAO.eraseViewpoint(vp.getVpId());
        }

        //delete snapshots eventually associated
        ISnapshotDAO snapshotsDAO = DAOFactory.getSnapshotDAO();
        List snapshots = snapshotsDAO.getSnapshots(obj.getId());
View Full Code Here

    if( !(o instanceof Viewpoint) ) {
      throw new SerializationException("ViewpointJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      Viewpoint viewpoint = (Viewpoint)o;
      result = new JSONObject();
     
     
      result.put(ID, viewpoint.getVpId() );
      result.put(DOCUMENT_ID, viewpoint.getBiobjId() );
      result.put(OWNER, viewpoint.getVpOwner() );
     
      result.put(NAME, viewpoint.getVpName() );
      result.put(DESCRIPTION, viewpoint.getVpDesc() );     
      result.put(SCOPE, viewpoint.getVpScope() );
     
      result.put(CREATION_DATE, DATE_FORMATTER.formatviewpoint.getVpCreationDate() ) );
     
      JSONObject parametersJSON = new JSONObject();
      String str = viewpoint.getVpValueParams();
      String[] parameters = str.split("%26");
      for(int i = 0; i < parameters.length; i++) {
        String[] parameter = parameters[i].split("%3D");
        if(parameter.length > 1 ) {
          parametersJSON.put(parameter[0], parameter[1]);
View Full Code Here

    String viewpointOwner;
    JSONObject viewpointJSON;
    String viewpointString;
   
    IViewpointDAO viewpointDAO;
    Viewpoint viewpoint;

   
   
   
    logger.debug("IN");
   
    try{
     
      viewpointName = getAttributeAsString(NAME);
      viewpointDescription = getAttributeAsString(DESCRIPTION);
      viewpointScope = getAttributeAsString(SCOPE);
      viewpointJSON = getAttributeAsJSONObject( VIEWPOINT );
     
      logger.debug("Parameter [" + NAME + "] is equals to [" + viewpointName + "]");
      logger.debug("Parameter [" + DESCRIPTION + "] is equals to [" + viewpointDescription + "]");
      logger.debug("Parameter [" + SCOPE + "] is equals to [" + viewpointScope + "]");
      logger.debug("Parameter [" + viewpointScope + "] is equals to [" + viewpointJSON + "]");
     
      Assert.assertTrue(!StringUtilities.isEmpty(viewpointScope), "Viewpoint's name cannot be null or empty");
      Assert.assertNotNull(!StringUtilities.isEmpty(viewpointDescription), "Viewpoint's description cannot be null or empty");
      Assert.assertNotNull(!StringUtilities.isEmpty(viewpointScope), "Viewpoint's scope cannot be null or empty");
      Assert.assertNotNull(viewpointJSON, "Viewpoint's content cannot be null");
     
      executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      Assert.assertNotNull(executionInstance, "Execution instance cannot be null");
     
      userProfile = this.getUserProfile();
      Assert.assertNotNull(userProfile, "Impossible to retrive user profile");
     
      biobjectId = executionInstance.getBIObject().getId();
      Assert.assertNotNull(executionInstance, "Impossible to retrive analytical document id");
     
      logger.debug("User: [" + userProfile.getUserUniqueIdentifier() + "]");
      logger.debug("Document Id:  [" + biobjectId + "]");
     
      viewpointOwner = (String) ((UserProfile)userProfile).getUserId();
     
      Iterator it = viewpointJSON.keys();
      Assert.assertTrue(it.hasNext(), "Viewpoint's content cannot be empty");
      viewpointString = "";
      while (it.hasNext()) {
        String parameterName = (String) it.next();
        String parameterValue;
        try {
          parameterValue = viewpointJSON.getString( parameterName );
        } catch (JSONException e) {
          logger.error("Impossible read value for the parameter [" + parameterName + "] into viewpoint's content", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Impossible read value for the parameter [" + parameterName + "] into viewpoint's content", e);
        }
       
        // defines the string of parameters to save into db
        if(!StringUtilities.isEmpty(parameterValue)) {
          viewpointString += parameterName + "%3D" + parameterValue + "%26";
        }
      }
     
      if (viewpointString.endsWith("%26")) {
        viewpointString = viewpointString.substring(0, viewpointString.length() - 3);
      }
     
      logger.debug("Viewpoint's content will be saved on database as: [" + viewpointString + "]");
     
      try {
        viewpointDAO = DAOFactory.getViewpointDAO();
        viewpoint = viewpointDAO.loadViewpointByNameAndBIObjectId(viewpointName, biobjectId);
        if (viewpoint != null) throw new SpagoBIServiceException(SERVICE_NAME, "A viewpoint with the name [" + viewpointName + "] alredy exist");
        //Assert.assertTrue(viewpoint == null, "A viewpoint with the name [" + viewpointName + "] alredy exist");
      } catch (EMFUserError e) {
        logger.error("Impossible to check if a viewpoint with name [" + viewpointName + "] already exists", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to check if a viewpoint with name [" + viewpointName + "] already exists", e);
     
     
      try {
        viewpointDAO = DAOFactory.getViewpointDAO();
        viewpointDAO.setUserProfile(userProfile);
        viewpoint = new Viewpoint();
        viewpoint.setBiobjId( biobjectId );
        viewpoint.setVpName( viewpointName );
        viewpoint.setVpOwner( viewpointOwner );
        viewpoint.setVpDesc( viewpointDescription );
        viewpoint.setVpScope( viewpointScope );
        viewpoint.setVpValueParams( viewpointString );
        viewpoint.setVpCreationDate(new Timestamp(System.currentTimeMillis()));
        viewpointDAO.insertViewpoint(viewpoint);
      } catch (EMFUserError e) {
        logger.error("Impossible to save viewpoint [" + viewpointName + "]", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to check if a viewpoint with name [" + viewpointName + "] already exists", e);
      }
View Full Code Here

TOP

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

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.