Package it.eng.spagobi.utilities.service

Examples of it.eng.spagobi.utilities.service.JSONAcknowledge


      if ( !result ){
        throw new ConsoleEngineRuntimeException("Impossible to perform update statement");   
      }
     
      try {
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        String msg = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), msg, e);
      }
     
View Full Code Here


      logger.debug("Statement [" + stmt.toString() + "] has been  succesfully executed");
   
      conn.commit();
               
      try {
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        String msg = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), msg, e);
      }
     
View Full Code Here

      BIObject biObjToIndex = DAOFactory.getBIObjectDAO().loadBIObjectById(biobjectId);
      LuceneIndexer.updateBiobjInIndex(biObjToIndex, false);
     
     
      try {
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        String message = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }
     
View Full Code Here

      analysisState.setSelectedLevelName( analysisStateJSON.getString(HIERARCHY_LEVEL) );
      analysisState.setSelectedLayers( JSONUtils.asList( analysisStateJSON.getJSONArray(FEATURES) ) );     
      getGeoEngineInstance().setAnalysisState( analysisState );
   
      try {
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        String message = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }   
     
View Full Code Here

        }
      }
     
      try {
        JSONObject results = new JSONObject();
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e) {
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
      }

    } finally {
View Full Code Here

    } else if (serviceType != null  && serviceType.equalsIgnoreCase(CONTACT_DELETE)) {
      Integer id = getAttributeAsInteger(ID);
      try {
        contactDao.delete(id);
        logger.debug("Contact deleted");
        writeBackToClient( new JSONAcknowledge("Operation succeded") );

      } catch (Throwable e) {
        logger.error("Exception occurred while deleting role", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while deleting contact",
View Full Code Here

          kpisList.add(deserializeKpiNode((JSONObject)kpis.get(i), goalNodeId));
        }
        daoGoal.ereseGoalKpis(goalNodeId);
        daoGoal.insertGoalKpis(kpisList, goalNodeId);
        daoGoal.updateGoalNode(gn);
        writeBackToClient(new JSONAcknowledge())
      } catch (Exception e){
        logger.debug("Error adding the details to the goal node");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error adding the details to the goal node",e);
      }
      logger.debug("Added the goal details");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(UPDATE_GOAL_NAME)) {
      logger.debug("Updating the name of the goal with id:");
      Integer goalNode =  getAttributeAsInteger("goalId");
      logger.debug("id:"+goalNode);
      String goalName =  getAttributeAsString("newName");
     
      daoGoal.updateGoalName(goalNode, goalName);
      try{
        writeBackToClient(new JSONAcknowledge());
      } catch (IOException e){
        logger.debug("Error sending the response after the erese of the goal node");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error sending the response after the erese of the goal node",e);
      }
      logger.debug("Goal name updated");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(ERESE_GOAL_NODE)) {
      logger.debug("Removing the goal node with id:");
      Integer goalNode =  getAttributeAsInteger("id");
      logger.debug("id:"+goalNode);
      daoGoal.ereseGoalNode(goalNode);
      try{
        writeBackToClient(new JSONAcknowledge());
      } catch (IOException e){
        logger.debug("Error sending the response after the erese of the goal node");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error sending the response after the erese of the goal node",e);
      }
      logger.debug("Goal removed");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(KPI_GOAL_ROOT_NODE)) {
      logger.debug("Loading the kpi model instances linked to the goal: ");
      Integer grantId =  getAttributeAsInteger("grantId");
      Integer goalNodeId =  getAttributeAsInteger("goalNodeId");
      Integer ouNodeId =  getAttributeAsInteger("ouNodeId");
      logger.debug("grantId: "+grantId+", goalNodeId"+goalNodeId);
      OrganizationalUnitGrant grant = DAOFactory.getOrganizationalUnitDAO().getGrant(grantId);
      ModelInstance mi = grant.getModelInstance();
     
      List<OrganizationalUnitNodeWithGrant> ousWithGrants = DAOFactory.getOrganizationalUnitDAO().getGrantNodes(ouNodeId, grantId);
      List<OrganizationalUnitGrantNode> grants = new ArrayList<OrganizationalUnitGrantNode>();
      for(int i=0; i<ousWithGrants.size(); i++){
        grants.addAll(ousWithGrants.get(i).getGrants());
      }
      List<Integer> modelInstances = new ArrayList<Integer>();
     
      for(int i=0; i<grants.size(); i++){
        modelInstances.add(grants.get(i).getModelInstanceNode().getModelInstanceNodeId());
      }
     
      if(modelInstances.contains(mi.getId())){
        mi.setActive(true);
      }
     
      try {
        JSONObject modelInstanceJSON = (JSONObject) SerializerFactory.getSerializer("application/json").serialize( mi, null);
       
        if(goalNodeId!=null){
          List<GoalKpi> listGoalKpi = daoGoal.getGoalKpi(goalNodeId);
          for(int i=0; i<listGoalKpi.size(); i++){
            if(listGoalKpi.get(i).getModelInstanceId().equals( mi.getId())){
              modelInstanceJSON.put("weight1", ""+listGoalKpi.get(i).getWeight1());
              modelInstanceJSON.put("weight2", ""+listGoalKpi.get(i).getWeight2());
              modelInstanceJSON.put("sign1", ""+listGoalKpi.get(i).getSign1());
              if(listGoalKpi.get(i).getSign1()==110){
                modelInstanceJSON.put("threshold1", "");
              }else{
                modelInstanceJSON.put("threshold1", ""+listGoalKpi.get(i).getThreshold1());
              }
              modelInstanceJSON.put("sign2", ""+listGoalKpi.get(i).getSign2());
              if(listGoalKpi.get(i).getSign2()==110){
                modelInstanceJSON.put("threshold2", "");
              }else{
                modelInstanceJSON.put("threshold2", ""+listGoalKpi.get(i).getThreshold2());
              }
              break;
            }
          }
        }
        writeBackToClient( new JSONSuccess( modelInstanceJSON ) );
      } catch (Exception e) {
        logger.debug("Impossible to serialize the responce to the client");
        throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
      }
      logger.debug("kpi model instances loaded.");
    }
 
   
    if (serviceType != null && serviceType.equalsIgnoreCase(GOAL_ERESE)) {
      logger.debug("Removing the goal with id:");
      Integer goalId = getAttributeAsInteger("goalId");
      logger.debug(goalId);
      logger.debug(goalId);
      daoGoal.eraseGoal(goalId);
      try{
        writeBackToClient( new JSONAcknowledge() );
      } catch (IOException e){
        logger.debug("Error sending the response after the erese of the goal");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error sending the response after the erese of the goal",e);
      }
      logger.debug("Goal removed");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(GOAL_INSERT)) {
      logger.debug("Adding the goal: ");
      JSONObject goalJSON = getAttributeAsJSONObject(GOAL);
      logger.debug(goalJSON);
      try{
        Goal goal = deserializeGoal(goalJSON);
        daoGoal.insertGoal(goal);
        writeBackToClient( new JSONAcknowledge() );
      } catch (Exception e){
        logger.debug("Error inserting the goal");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error inserting the goal",e);
      }
      logger.debug("Goal added");
View Full Code Here

    } else if (serviceType != null  && serviceType.equalsIgnoreCase(PERIODICITY_DELETE)) {
      Integer id = getAttributeAsInteger(ID);
      try {
        perDao.deletePeriodicity(id);
        logger.debug("Resource deleted");
        writeBackToClient( new JSONAcknowledge("Operation succeded") );
      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving resource to delete", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving resource to delete", e);
      }
View Full Code Here

          modelInstances.add(grants.get(i).getModelInstanceNode().getModelInstanceNodeId());
        }
       
        try{
          if(parentId == null || parentId.startsWith("xnode")){
            writeBackToClient( new JSONAcknowledge() );
            return;
          }
          ModelInstance aModel = DAOFactory.getModelInstanceDAO().loadModelInstanceWithChildrenById(Integer.parseInt(parentId));
          List<ModelInstance> children = aModel.getChildrenNodes();
         
View Full Code Here

   * @param grantId the id of the grant to erase
   */
  private void eraseGrant(Integer grantId){
    orUnitDao.eraseGrant(grantId);
    try {
      writeBackToClient( new JSONAcknowledge() );
    } catch (IOException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
    }
  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.utilities.service.JSONAcknowledge

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.