Package it.eng.spagobi.utilities.service

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


      JSONObject noteJSON = new JSONObject();
      JSONObject results = new JSONObject();
      if (objnote != null)
        noteJSON = (JSONObject) SerializerFactory.getSerializer("application/json").serialize( objnote,null );
      //results.put("results", noteJSON);
      writeBackToClient( new JSONSuccess( noteJSON ) );
    } catch (IOException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
    } catch (SerializationException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize objects", e);
    } /*catch (JSONException e) {
View Full Code Here


       
        logger.debug("Loaded models list");
        JSONArray modelsListJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(modelRootsList,locale);
        JSONObject modelsResponseJSON = createJSONResponseModelsList(modelsListJSON, new Integer(6));

        writeBackToClient(new JSONSuccess(modelsResponseJSON));

      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving model tree", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving model tree", e);
      }
      }else if (serviceType != null && serviceType.equalsIgnoreCase(MODEL_NODES_LIST)) {
     
      try
       
        String parentId = (String)getAttributeAsString("modelId");
        if(parentId == null || parentId.startsWith("xnode")){
          writeBackToClient(new JSONSuccess("OK"));
          return;
        }
        Model aModel = modelDao.loadModelWithChildrenById(Integer.parseInt(parentId));
       
        logger.debug("Loaded model tree");
        JSONArray modelChildrenJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(aModel.getChildrenNodes(),  locale);
        writeBackToClient(new JSONSuccess(modelChildrenJSON));

      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving model tree", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving model tree", e);
      }
    }else if (serviceType != null && serviceType.equalsIgnoreCase(MODEL_NODES_LIST_WITH_KPI)) {
     
      try
       
        String parentId = (String)getAttributeAsString("modelId");
        if(parentId == null || parentId.startsWith("xnode")){
          writeBackToClient(new JSONSuccess("OK"));
          return;
        }
        Model dbModel = modelDao.loadModelWithChildrenById(Integer.parseInt(parentId));
       
        ModelExtended aModel = new ModelExtended(dbModel);
       
        aModel.setExtendedChildrenNodes(dbModel.getChildrenNodes());
       
        logger.debug("Loaded model tree");
        JSONArray modelChildrenJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(aModel.getExtendedChildrenNodes(),  locale);
        writeBackToClient(new JSONSuccess(modelChildrenJSON));

      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving model tree", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving model tree", e);
      }
    } else if (serviceType != null  && serviceType.equalsIgnoreCase(MODEL_NODES_SAVE)) {
      JSONArray nodesToSaveJSON = getAttributeAsJSONArray(NODES_TO_SAVE);
      List<Model> modelNodes = null;
      if(nodesToSaveJSON != null){
        try {
          modelNodes = deserializeNodesJSONArray(nodesToSaveJSON);
         
          //save them
          JSONObject response = saveModelNodes(modelNodes);
          writeBackToClient(new JSONSuccess(response));
         
        } catch (Exception e) {
          logger.error(e.getMessage(), e);
          writeErrorsBackToClient();
          throw new SpagoBIServiceException(SERVICE_NAME,
              "Exception saving model nodes", e);
        }
      }
     
    } else if (serviceType != null  && serviceType.equalsIgnoreCase(MODEL_NODE_DELETE)) {
     
      Integer modelId = getAttributeAsInteger("modelId");
      logger.warn("DELETING NODE WITH MODEL_ID:"+modelId);
      try {
        modelDao.deleteModel(modelId);
        logger.debug("Model deleted");
        writeBackToClient( new JSONSuccess("Operation succeded") );
      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving model to delete", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving model to delete", e);
      }
View Full Code Here

      } catch (SerializationException e) {
        throw new SpagoBIServiceException("Impossible to serialize datastore", e);
      }
     
      try {
        writeBackToClient( new JSONSuccess( dataSetJSON, callback ) );
      } catch (IOException e) {
        throw new SpagoBIServiceException("Impossible to write back the responce to the client", e);
      }
    } catch (Throwable t) {
      SpagoBIServiceExceptionHandler.getInstance().getWrappedException(SERVICE_NAME, t);
View Full Code Here

      try{
        Integer nodeId =  getAttributeAsInteger("nodeId");
        logger.debug("nodeId:"+ nodeId);
        List<GoalNode> children = daoGoal.getChildrenNodes(nodeId);
        JSONArray ja = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(children,  getLocale());
        writeBackToClient(new JSONSuccess(ja));       
      } catch (NumberFormatException e) {
        logger.debug("The goal node "+ getAttribute("nodeId") +" is not saved yet ");
        try{
          writeBackToClient(new JSONSuccess(new JSONArray()));
        }catch (IOException io){
          logger.debug("Error getting the child of the goal node");
          throw new SpagoBIServiceException(SERVICE_NAME, "Error getting the child of the goal node",e);
        }
      } catch (Exception ee){
        logger.debug("Error getting the child of the goal node");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error getting the child of the goal node",ee);
      }
      logger.debug("Loaded children");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(OU_GOAL_ROOT)) {
      logger.debug("Loading the root node of the goal tree with:");
      JSONObject jo;
      Integer goalId =  getAttributeAsInteger("goalId");
      Integer ouId =  getAttributeAsInteger("ouId");
      logger.debug("goalId: "+goalId+" ,ouId "+ouId);
      GoalNode root = daoGoal.getRootNode(goalId, ouId);
      try{
        if(root!=null){
          jo = (JSONObject) SerializerFactory.getSerializer("application/json").serialize(root, getLocale());
        }else{
          jo = new JSONObject();
        }
        writeBackToClient(new JSONSuccess(jo))
      } catch (Exception e){
        logger.debug("Error getting the root of the goal");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error getting the root of the goal",e);
      }
      logger.debug("Goal root loaded");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(INSERT_GOAL_NODE)) {
      logger.debug("Adding the goal node: ");
      JSONObject JSONGoal =  getAttributeAsJSONObject("goalNode");
      Integer goalId =  getAttributeAsInteger("goalId");
      Integer ouId =  getAttributeAsInteger("ouId");
      logger.debug("JSONGoal: "+JSONGoal);
      try{
        GoalNode gn = insertGoalNode(JSONGoal, null, goalId, ouId);
        JSONObject jo = (JSONObject) SerializerFactory.getSerializer("application/json").serialize(gn, getLocale());
        writeBackToClient(new JSONSuccess(jo))
      } catch (Exception e){
        logger.debug("Error inserting the goal node");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error inserting the goal node",e);
      }
      logger.debug("Node added");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(INSERT_GOAL_DETAILS)) {
      logger.debug("Adding the details of the goal node: ");
      List<GoalKpi> kpisList = new ArrayList<GoalKpi>();
      JSONObject JSONGoalDetails =  getAttributeAsJSONObject("goalDetails");
      JSONObject goalNode =  JSONGoalDetails.optJSONObject("goalNode");
      Integer goalNodeId =  goalNode.optInt("id");
      String goalDesc =  goalNode.optString("goalDesc");
      String goalName =  goalNode.optString("name");
      logger.debug(goalNode);
      GoalNode gn = new GoalNode(goalName, "", goalDesc, null, null);
      gn.setId(goalNodeId);
     
      JSONArray kpis =  JSONGoalDetails.optJSONArray("kpis");
      try{
        for(int i=0; i<kpis.length(); i++){
          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");
    }
    if (serviceType != null && serviceType.equalsIgnoreCase(GOALS_LIST)) {
      logger.debug("Getting the list of the goals");
      try{
      List<Goal> goals = daoGoal.getGoalsList();
      JSONArray jo = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(goals,  getLocale());
      JSONObject grantsJSONObject = new JSONObject();
      grantsJSONObject.put("rows",jo);
      writeBackToClient(new JSONSuccess(grantsJSONObject))
      } catch (Exception e){
        logger.debug("Error getting the goals list");
        throw new SpagoBIServiceException(SERVICE_NAME, "Error getting the goals list",e);
      }
      logger.debug("List loaded");
View Full Code Here

        List periodicities = perDao.loadPeriodicityList();
        logger.debug("Loaded periodicities list");
        JSONArray periodicitiesJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(periodicities, locale);
        JSONObject periodicitiesResponseJSON = createJSONResponsePeriodicities(periodicitiesJSON);

        writeBackToClient(new JSONSuccess(periodicitiesResponseJSON));

      } catch (Throwable e) {
        logger.error("Exception occurred while retrieving users", e);
        throw new SpagoBIServiceException(SERVICE_NAME,
            "Exception occurred while retrieving users", e);
      }
    } else if (serviceType != null  && serviceType.equalsIgnoreCase(PERIODICITY_INSERT)) {
     
      String id = getAttributeAsString(ID);
      String name = getAttributeAsString(NAME);
      String months = getAttributeAsString(MONTHS);
      String days = getAttributeAsString(DAYS);
      String hours = getAttributeAsString(HOURS);
      String minutes = getAttributeAsString(MINUTES);   

      if (name != null) {
        Periodicity per = new Periodicity();
        per.setName(name);
       
        if(months!=null && !months.equals("")){
          per.setMonths(new Integer(months));
        }else{
          per.setMonths(new Integer("0"));
        }
        if(days!=null && !days.equals("")){
          per.setDays(new Integer(days));
        }else{
          per.setDays(new Integer("0"));
        }
        if(hours!=null && !hours.equals("")){
          per.setHours(new Integer(hours));
        }else{
          per.setHours(new Integer("0"));
        }
        if(minutes!=null && !minutes.equals("")){
          per.setMinutes(new Integer(minutes));
        }else{
          per.setMinutes(new Integer("0"));
        }     
       
        try {
          if(id != null && !id.equals("") && !id.equals("0")){             
            per.setIdKpiPeriodicity(Integer.valueOf(id));
            perDao.modifyPeriodicity(per);
            logger.debug("Resource "+id+" updated");
            JSONObject attributesResponseSuccessJSON = new JSONObject();
            attributesResponseSuccessJSON.put("success", true);
            attributesResponseSuccessJSON.put("responseText", "Operation succeded");
            attributesResponseSuccessJSON.put("id", id);
            writeBackToClient( new JSONSuccess(attributesResponseSuccessJSON) );
          }else{
            Integer perID = perDao.insertPeriodicity(per);
            logger.debug("New Resource inserted");
            JSONObject attributesResponseSuccessJSON = new JSONObject();
            attributesResponseSuccessJSON.put("success", true);
            attributesResponseSuccessJSON.put("responseText", "Operation succeded");
            attributesResponseSuccessJSON.put("id", perID);
            writeBackToClient( new JSONSuccess(attributesResponseSuccessJSON) );
          }

        } catch (Throwable e) {
          logger.error(e.getMessage(), e);
          throw new SpagoBIServiceException(SERVICE_NAME,
View Full Code Here

       
        try {
          JSONObject hierarchyWithRoot = new JSONObject();
          hierarchyWithRoot.put("ouRootName",ou.getOu().getName());
          hierarchyWithRoot.put("ouRootId",ou.getNodeId());
          writeBackToClient( new JSONSuccess( hierarchyWithRoot ) );
        } catch (Exception e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
        }

        logger.debug("Loaded ou root of grant with id"+grantId);
      }else if (serviceType != null && serviceType.equalsIgnoreCase(OU_HIERARCHY_ROOT)) {
        Integer hierarchyId = getAttributeAsInteger("hierarchyId");
        Integer modelInstanceId = getAttributeAsInteger("modelInstanceId");
        List<Integer> modelInstances = new ArrayList<Integer>();

        Integer grantId;
        try{
          grantId =  getAttributeAsInteger("grantId");
          logger.debug("Loading the ou root of the hierarchy with id"+hierarchyId+" and grant "+grantId+"...");
        }catch(Throwable e){
          grantId = null;
         
          try{
            ModelInstance aModel = DAOFactory.getModelInstanceDAO().loadModelInstanceWithChildrenById(modelInstanceId);
            modelInstances = getModelInstances(aModel.getId());
          }catch(Exception ee){

          }
          logger.debug("Loading the ou root of the hierarchy with id"+hierarchyId+"...");
        }

       
        getHierarchyRootNode(hierarchyId, grantId, modelInstances);
        logger.debug("Loaded the ou root of the hierarchy with id"+hierarchyId+"...");
      }else if (serviceType != null && serviceType.equalsIgnoreCase(OU_GRANT_ERESE)) {
        Integer grantId = getAttributeAsInteger("grantId");
        logger.debug("Eresing the grant with id "+grantId+"...");
        eraseGrant(grantId);
        logger.debug("Eresed the grant with id "+grantId+"...");
      }else if (serviceType != null && serviceType.equalsIgnoreCase(OU_GRANT_INSERT)) {
        JSONArray grantNodesJSON = getAttributeAsJSONArray(GRANTNODES);
        JSONObject grantJSON = getAttributeAsJSONObject(GRANT);
        logger.debug("Adding the grant "+grantNodesJSON+"..."+grantJSON);
        insertGrant(grantJSON, grantNodesJSON);
        logger.debug("Added the grant.");

      }else if (serviceType != null && serviceType.equalsIgnoreCase(KPI_ACTIVE_CHILDS_LIST)) {
        Integer ouNodeId =  getAttributeAsInteger("ouNodeId");
        Integer grantId =  getAttributeAsInteger("grantId");
        Integer goalNodeId =  null;
        try{
          goalNodeId = getAttributeAsInteger("goalNodeId");
        }catch (NumberFormatException e) {
          goalNodeId = null;
        }
        String parentId = (String)getAttributeAsString("modelInstId");
       
        List<OrganizationalUnitNodeWithGrant> ousWithGrants = orUnitDao.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());
        }
       
        try{
          if(parentId == null || parentId.startsWith("xnode")){
            writeBackToClient( new JSONAcknowledge() );
            return;
          }
          ModelInstance aModel = DAOFactory.getModelInstanceDAO().loadModelInstanceWithChildrenById(Integer.parseInt(parentId));
          List<ModelInstance> children = aModel.getChildrenNodes();
         
          for(int i=0; i<children.size(); i++){
            if(modelInstances.contains(children.get(i).getId())){
              children.get(i).setActive(true);
            }
          }

          JSONArray modelChildrenJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(children,  getLocale());
         
         
          if(goalNodeId!=null){
            List<GoalKpi> listGoalKpi = DAOFactory.getGoalDAO().getGoalKpi(goalNodeId);
            for(int i=0; i<modelChildrenJSON.length(); i++){
              for(int j=0; j<listGoalKpi.size(); j++){
                if(listGoalKpi.get(j).getModelInstanceId().equals( children.get(i).getId())){
                  ((JSONObject)modelChildrenJSON.get(i)).put("weight1", ""+listGoalKpi.get(j).getWeight1());
                  ((JSONObject)modelChildrenJSON.get(i)).put("weight2", ""+listGoalKpi.get(j).getWeight2());
                  ((JSONObject)modelChildrenJSON.get(i)).put("threshold1", ""+listGoalKpi.get(j).getThreshold1());
                  ((JSONObject)modelChildrenJSON.get(i)).put("threshold2", ""+listGoalKpi.get(j).getThreshold2());
                  ((JSONObject)modelChildrenJSON.get(i)).put("sign1", ""+listGoalKpi.get(j).getSign1());
                  ((JSONObject)modelChildrenJSON.get(i)).put("sign2", ""+listGoalKpi.get(j).getSign2());
                  break;
                }
              }
            }
          }
          writeBackToClient(new JSONSuccess(modelChildrenJSON));

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

 
    try {
      JSONArray grantsJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize( grants, null);
      JSONObject grantsJSONObject = new JSONObject();
      grantsJSONObject.put("rows", grantsJSON);
      writeBackToClient( new JSONSuccess( grantsJSONObject ) );
    } catch (Exception e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
    }
  }
View Full Code Here

  private void getGrant(Integer grantId){
    OrganizationalUnitGrant grant = orUnitDao.getGrant(grantId);
 
    try {
      JSONObject grantsJSON = (JSONObject) SerializerFactory.getSerializer("application/json").serialize( grant, null);
      writeBackToClient( new JSONSuccess( grantsJSON ) );
    } catch (Exception e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
    }
  }
View Full Code Here

  private void getHierarchiesList(){
    List<OrganizationalUnitHierarchy> ous = orUnitDao.getHierarchiesList();
 
    try {
      JSONArray grantsJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize( ous, null);
      writeBackToClient( new JSONSuccess( grantsJSON ) );
    } catch (IOException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
    } catch (SerializationException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
    }
View Full Code Here

      }
    }else{
      ousWithGrants = orUnitDao.getChildrenNodesWithGrants(nodeId, grantId);
    } try {
      JSONArray grantsJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize( ousWithGrants, null);
      writeBackToClient( new JSONSuccess( grantsJSON ) );
    } catch (IOException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
    } catch (SerializationException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to serialize the responce to the client", e);
    }
View Full Code Here

TOP

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

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.