Package it.eng.spagobi.analiticalmodel.document.dao

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO


    logger.debug("IN");

    try {
      // BIObject obj = executionInstance.getBIObject();
      UserProfile userProfile = (UserProfile) this.getUserProfile();
      IBIObjectDAO dao = null;
      try {
        dao = DAOFactory.getBIObjectDAO();
      } catch (EMFUserError e) {
        logger.error("Error while istantiating DAO", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
      }
      String ids = this.getAttributeAsString(OBJECT_ID);
      String func = this.getAttributeAsString(FUNCT_ID);
      Integer iFunc = new Integer(func);
      logger.debug("Input Folder:" + func);
      logger.debug("Input Object:" + ids);
      // ids contains the id of the object to be deleted separated by ,
      String[] idArray = ids.split(",");
      for (int i = 0; i < idArray.length; i++) {
        Integer id = new Integer(idArray[i]);
        BIObject biObject = null;
        try {
          biObject = dao.loadBIObjectById(id);
        } catch (EMFUserError e) {
          logger.error("BIObject with id = " + id + " not found", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Customized view not found", e);
        }

        if (userProfile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          // delete document
          try {
            dao.eraseBIObject(biObject, iFunc);
            logger.debug("Object deleted by administrator");
          } catch (EMFUserError e) {
            logger.error("Error to delete Document", e);
            throw new SpagoBIServiceException(SERVICE_NAME, "Error to delete Document", e);
          }
        } else {
          String userId = ((UserProfile)userProfile).getUserId().toString();
          ILowFunctionalityDAO functDAO = DAOFactory.getLowFunctionalityDAO();
          LowFunctionality lowFunc = functDAO.loadLowFunctionalityByID(iFunc, false);

          if(lowFunc==null){
            logger.error("Functionality does not exist");
            throw new Exception("Functionality does not exist");         
          }

          if(lowFunc.getPath().equals("/"+userId)){ // folder is current user one
            dao.eraseBIObject(biObject, iFunc);
            logger.debug("Object deleted");
          }
          else{
            logger.error("Functionality is not user's one");
            throw new Exception("Functionality  is not user's one");         
View Full Code Here


        Integer objId = null;
        if (objIdStr != null) objId = new Integer (objIdStr);
        response.setAttribute("SUBJECT_ID",objIdStr);
   
    PaginatorIFace paginator = new GenericPaginator();   
    IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
    List objectsList = null;
    if (initialPath != null && !initialPath.trim().equals("")) {
      objectsList = objDAO.loadAllBIObjectsFromInitialPath(initialPath, currentFieldOrder+ " " + currentTypOrder);
    } else {
      objectsList = objDAO.loadAllBIObjects(currentFieldOrder + " " + currentTypOrder);
    }
   
    String checked = (String)request.getAttribute("checked");
    if (checked  == null )
      checked = (String)request.getAttribute("optChecked");
View Full Code Here

    throws EMFUserError, SourceBeanException {
    BIObject obj = null;
    try {
      String idObjStr = (String) request.getAttribute(ObjectsTreeConstants.OBJECT_ID);
      Integer idObj = new Integer(idObjStr);
      IBIObjectDAO objdao = biobjDAO;
      obj = objdao.loadBIObjectById(idObj);
      String idFunctStr = (String) request.getAttribute(ObjectsTreeConstants.FUNCT_ID);
      if (idFunctStr != null) {
        Integer idFunct = new Integer(idFunctStr);
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          // deletes the document from the specified folder, no matter the permissions
          objdao.eraseBIObject(obj, idFunct);
        } else {
          // deletes the document from the specified folder if the profile is a developer for that folder
          if (ObjectsAccessVerifier.canDev(obj.getStateCode(), idFunct, profile)) {
            objdao.eraseBIObject(obj, idFunct);
          }
        }
      } else {
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          if (initialPath != null && !initialPath.trim().equals("")) {
            // in case of local administrator, deletes the document in the folders where he can admin
            List funcsId = obj.getFunctionalities();
            for (Iterator it = funcsId.iterator(); it.hasNext(); ) {
              Integer idFunct = (Integer) it.next();
              LowFunctionality folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(idFunct, false);
              String folderPath = folder.getPath();
              if (folderPath.equalsIgnoreCase(initialPath) || folderPath.startsWith(initialPath + "/")) {
                objdao.eraseBIObject(obj, idFunct);
              }
            }
          } else {
            // deletes the document from all the folders, no matter the permissions
            objdao.eraseBIObject(obj, null);
          }
        } else {
          // deletes the document from all the folders on which the profile is a developer
          List funcsId = obj.getFunctionalities();
          for (Iterator it = funcsId.iterator(); it.hasNext(); ) {
            Integer idFunct = (Integer) it.next();
            if (ObjectsAccessVerifier.canDev(obj.getStateCode(), idFunct, profile)) {
              objdao.eraseBIObject(obj, idFunct);
            }
          }
        }
      }
      /*
 
View Full Code Here

    }


    logger.debug("Getting the chart object");

    IBIObjectDAO dao;
    BIObject obj=null;
    try {
      dao = DAOFactory.getBIObjectDAO();
      if(label!=null)
        obj=dao.loadBIObjectByLabel(label);
    } catch (EMFUserError e) {
      logger.error("Error in recovering object",e);
      return "".getBytes();
    }
View Full Code Here

      String returnedContentType = "";
      String fileextension = "";
      byte[] documentBytes = null;

      IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
      BIObject biobj = null;
      if (objLabel != null && !objLabel.trim().equals("")) {
        biobj = biobjdao.loadBIObjectByLabel(objLabel);
      } else {
        biobj = biobjdao.loadBIObjectById(new Integer(objid));
      }
      // create the execution controller
      ExecutionController execCtrl = new ExecutionController();
      execCtrl.setBiObject(biobj);
     
View Full Code Here

        objTemplate.setCreationUser(userId);
        objTemplate.setCreationDate(new Date());
      }

      logger.debug("Saving document ...");
      IBIObjectDAO biObjDAO = DAOFactory.getBIObjectDAO();
      biObjDAO.setUserProfile(profile);
      biObjDAO.insertBIObject(obj, objTemplate);
      toReturn = obj.getId();
      if (toReturn != null) {
        logger.info("Document saved with id = " + toReturn);
      } else {
        logger.error("Document not saved!!");
View Full Code Here

      String template = getTemplate(datamartName);
      objTemplate.setContent(template.getBytes());

      //inserts the document
      logger.debug("Saving document ...");
      IBIObjectDAO biObjDAO = DAOFactory.getBIObjectDAO();
      biObjDAO.setUserProfile(profile);
      biObjDAO.insertBIObject(obj, objTemplate);
      Integer newIdObj = obj.getId();
      if (newIdObj != null) {
        logger.info("Document saved with id = " + newIdObj);
      } else {
        logger.error("Document not saved!!");
View Full Code Here

    // lOAD ALL THE FUNCTIONALITIES ASSOCIATED TO THE BIOBJECT (but not into request)
    // First case: the current user is not an administrator (so he cannot see all the functionalities)
    // and the modality is Modify. In this case some functionalities, that the user cannot see, can be
    // already associated to the object (by different users). This associations mustn't be erased.
    if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List prevFuncsId = prevObj.getFunctionalities();
      for (Iterator it = prevFuncsId.iterator(); it.hasNext(); ) {
        Integer funcId = (Integer) it.next();
        if (!ObjectsAccessVerifier.canDev(stateCode, funcId, profile)) {
          functionalities.add(funcId);
        }
      }
    }
    // Second case: the current user is a local administrator (he can admin only a part of the tree)
    // and the modality is Modify. In this case some funtionalities in oder part of the tree, which the
    // user cannot see, can be already associated to the object. This associations mustn't be erased.
    if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)
        && initialPath != null && !initialPath.trim().equals(""
        && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List functionalitiesId = prevObj.getFunctionalities();
      Iterator it = functionalitiesId.iterator();
      while (it.hasNext()) {
        Integer folderId = (Integer) it.next();
        LowFunctionality folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(folderId, false);
View Full Code Here

      return notes ;
    }
  
   private void saveNotes(String execIdentifier,String objectid , String notes,IEngUserProfile profile) {
      try
          IBIObjectDAO objectDAO = DAOFactory.getBIObjectDAO();
          BIObject biobject = objectDAO.loadBIObjectById(new Integer(objectid));
          EMFErrorHandler errorHandler = getErrorHandler();
         
          IObjNoteDAO objNoteDAO = DAOFactory.getObjNoteDAO();
          objNoteDAO.setUserProfile(profile);
          ObjNote objNote = objNoteDAO.getExecutionNotes(new Integer(objectid), execIdentifier);
View Full Code Here

          processDefinitionFile.getAbsolutePath(),
          dossierConfigFile.getAbsolutePath()
      };
      template = generateTemplateZipFile(files, pathTempFolder);
      ObjTemplate objTemplate = generateObjTemplate(template);
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject dossier = objDAO.loadBIObjectById(dossierId);
      objDAO.modifyBIObject(dossier, objTemplate);
      template.delete();
    } catch (Exception e) {
      logger.error(e);
    } finally {
      if (template != null) template.delete();
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

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.