Examples of OrganizationalUnitGrant


Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

    logger.debug("this is hierarchy:"+paramLabelHierarchy);
    List<OrganizationalUnitGrantNode> grants = DAOFactory.getOrganizationalUnitDAO().getGrantsValidByDate(miId, dateOfKPI);
    if(grants != null){
      for(int i = 0; i<grants.size(); i++){       
        OrganizationalUnitGrantNode grantNode = grants.get(i);
        OrganizationalUnitGrant grant = grantNode.getGrant();       
        OrganizationalUnitHierarchy hier = grant.getHierarchy();
        if(paramLabelOU == null){
          //scheduling mode
          if(executionModalityScheduler){
            //than all OU valid by date are filling
            if(hier.getLabel().equalsIgnoreCase(paramLabelHierarchy)){
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

  }
  public OrganizationalUnitGrant toOrganizationalUnitGrant(
      SbiOrgUnitGrant hibGrant, Session aSession) {
    OrganizationalUnitHierarchy hierarchy = toOrganizationalUnitHierarchy(hibGrant.getSbiOrgUnitHierarchies());
    ModelInstance modelInstance = ModelInstanceDAOImpl.toModelInstanceWithoutChildren(hibGrant.getSbiKpiModelInst(), aSession);
    OrganizationalUnitGrant grant = new OrganizationalUnitGrant(hibGrant.getId(), hibGrant.getIsAvailable(), modelInstance,
        hierarchy, hibGrant.getStartDate(), hibGrant.getEndDate(), hibGrant.getLabel(),
        hibGrant.getName(), hibGrant.getDescription());
    return grant;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

    try {
      modelInstanceNode = ModelInstanceDAOImpl.toModelInstanceNode(hibGrantNode.getSbiKpiModelInst());
    } catch (EMFUserError e) {
      throw new RuntimeException(e);
    }
    OrganizationalUnitGrant grant = toOrganizationalUnitGrant(hibGrantNode.getSbiOrgUnitGrant(), aSession);
    OrganizationalUnitGrantNode grantNode = new OrganizationalUnitGrantNode(ouNode, modelInstanceNode, grant);
    return grantNode;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

      //load all organizational units
      List<OrganizationalUnitGrantNode> grants = DAOFactory.getOrganizationalUnitDAO().getGrants(mi.getId());
      if(grants != null){
        for (OrganizationalUnitGrantNode organizationalUnitGrantNode : grants) {
          OrganizationalUnitGrant organizationalUnitGrant = organizationalUnitGrantNode.getGrant();
          insertOrgUnitGrant(organizationalUnitGrant, session);
          insertOrgUnitGrantNodes(organizationalUnitGrantNode, session);
        }
      }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

    if( !(o instanceof OrganizationalUnitGrant) ) {
      throw new SerializationException("OrganizationalUnitGrantJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      OrganizationalUnitGrant grant = (OrganizationalUnitGrant) o;
      result = new JSONObject();
      result.put(ID, grant.getId() );
      result.put(LABEL, grant.getLabel() );
      result.put(NAME, grant.getName() );
      result.put(DESCRIPTION, grant.getDescription() );
      if(grant.getIsAvailable() != null){
        result.put(IS_AVAILABLE, grant.getIsAvailable());
      }
      String df = GeneralUtilities.getServerDateFormat();
      SimpleDateFormat dateFormat = new SimpleDateFormat();
      dateFormat.applyPattern(df);
      dateFormat.setLenient(false);
      result.put(START_DATE, dateFormat.format(grant.getStartDate()) );
      result.put(END_DATE, dateFormat.format(grant.getEndDate()) );
     
      OrganizationalUnitHierarchyJSONSerializer hierarchySer = new OrganizationalUnitHierarchyJSONSerializer();
      JSONObject hierarchyJSON = (JSONObject) hierarchySer.serialize(grant.getHierarchy(), locale);
      result.put(HIERARCHY, hierarchyJSON);
     
      ModelInstanceNodeJSONSerializer modelSer = new ModelInstanceNodeJSONSerializer();
      JSONObject modelInstanceJSON = (JSONObject) modelSer.serialize(grant.getModelInstance(), locale);
      result.put(MODEL_INSTANCE, modelInstanceJSON);
     
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

      result.put(START_DATE, dateFormat.format(goal.getStartDate()) );
      result.put(END_DATE, dateFormat.format(goal.getEndDate()) );
     
      if(goal.getGrant()!=null){
       
        OrganizationalUnitGrant grant = DAOFactory.getOrganizationalUnitDAO().getGrant(goal.getGrant());
        result.put(GRANT_ID, goal.getGrant());
        result.put(GRANT_NAME, grant.getName());
      }
     
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    }
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

      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());
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

        logger.debug("Loaded the list of ous childs of the node with id"+nodeId+".");
      }else if (serviceType != null && serviceType.equalsIgnoreCase(OU_HIERARCHY_AND_ROOT)) {
       
        logger.debug("Loading the grant..");
        Integer grantId =  getAttributeAsInteger("grantId");
        OrganizationalUnitGrant grant = orUnitDao.getGrant(grantId);
        logger.debug("Grant loaded.");

        Integer hierarchyId = grant.getHierarchy().getId();
        OrganizationalUnitNode ou = orUnitDao.getRootNode(hierarchyId);
       
        try {
          JSONObject hierarchyWithRoot = new JSONObject();
          hierarchyWithRoot.put("ouRootName",ou.getOu().getName());
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

  /**
   * Load the list of grants and serialize them in a JSOMObject. The list live in the attributes with name rows
   * @param grantId the id of the grant
   */
  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) {
View Full Code Here

Examples of it.eng.spagobi.kpi.ou.bo.OrganizationalUnitGrant

   * @param grantJSON the JSON representation of the grant
   * @param grantNodesJSON the JSON representation of the nodes
   */
  private void insertGrant(JSONObject grantJSON,JSONArray grantNodesJSON){
    try {
      OrganizationalUnitGrant grant = deserializeOrganizationalUnitGrant(grantJSON);
      //set unavailable
      grant.setIsAvailable(false);
      List<OrganizationalUnitGrantNode> grantNodes = null;
      logger.debug("start saving");
      if(grant.getId()!=null){
        miChildrenToUncheckList = new ArrayList<Integer>();
        ouChildrenByParentIDMap = new HashMap<Integer,List<OrganizationalUnitNode>>();
        logger.debug("modify");
        orUnitDao.eraseNodeGrants(grant.getId());
        logger.debug("erased nodes");
        orUnitDao.modifyGrant(grant);
        logger.debug("modified grant");
        grantNodes = deserializeOrganizationalUnitGrantNodesAndUpdateChilds(grantNodesJSON, grant);
        logger.debug("modify grant");
      }else{
        logger.debug("insert");
        orUnitDao.insertGrant(grant);
        //first time save all
        logger.debug("inserted grant");
        grantNodes = getAllNodesToInsert(grant);
      }
      grant.setIsAvailable(true);
      logger.debug("prepared nodes to save of size:"+grantNodes.size());
      orUnitDao.insertNodeGrants(grantNodes, grant.getId());
      logger.debug("end saving process");
      writeBackToClient( new JSONAcknowledge() );
    } catch (IOException e) {
      throw new SpagoBIServiceException(SERVICE_NAME, "Impossible to write back the responce to the client", e);
    } catch (Exception e) {
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.