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

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


                  for(int i=0; i<hits.length; i++) {
                  ScoreDoc hit = hits[i];
                  Document doc = searcher.doc(hit.doc);
                    String biobjId = doc.get(IndexingConstants.BIOBJ_ID);

                    BIObject obj =DAOFactory.getBIObjectDAO().loadBIObjectForDetail(Integer.valueOf(biobjId));
                    if(obj != null){
                  boolean canSee = ObjectsAccessVerifier.canSee(obj, profile);
                    if (canSee) {
                      objects.add(obj);
                    }                 
View Full Code Here


    session.delAttribute("modalityBkp");
  }
 
  private Integer getBIObjectIdFromLoopbackContext() {
    Integer id = null;
    BIObject obj = (BIObject)session.getAttribute("LookupBIObject");
    if(obj != null) id = obj.getId();
    return id;
  }
View Full Code Here

    // object not in REL state are not considered
    List objects = folder.getBiObjects();
    List releasedObjects = new ArrayList();
    Iterator it = objects.iterator();
    while (it.hasNext()) {
      BIObject obj = (BIObject) it.next();
      Integer visible = obj.getVisible();
      if (obj.getStateCode().equalsIgnoreCase("REL") && (visible == null || visible.intValue() != 0))
          releasedObjects.add(obj);
    }
    folder.setBiObjects(releasedObjects);
    // iterator on the child folders
    List subFolders = functionDAO.loadChildFunctionalities(folder.getId(), false);
View Full Code Here

      }

      //onlyOneFunct=true;
      Integer objId = new Integer(objIdStr);
      IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
      BIObject obj = biobjdao.loadBIObjectById(objId);
      Integer fId=Integer.decode(funcIdStr);

      // check that the functionality specified is the user one or that user is administrator

      // first case: user is administrator
View Full Code Here

  public void doService() {
    logger.debug("IN");
    try {
      // retrieving execution instance from session, no need to check if user is able to execute the current document
      ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      BIObject obj = executionInstance.getBIObject();
      BIObjectNotesManager objectNManager = new BIObjectNotesManager();
      String execIdentifier = objectNManager.getExecutionIdentifier(obj);
     
      String previousNotes = this.getAttributeAsString("PREVIOUS_NOTES");
      logger.debug("Parameter [" + PREVIOUS_NOTES + "] is equal to [" + previousNotes + "]");
     
      String notes = this.getAttributeAsString("NOTES");
      logger.debug("Parameter [" + NOTES + "] is equal to [" + notes + "]");
     
      String message = this.getAttributeAsString(MESSAGE);
      logger.debug("Parameter [" + MESSAGE + "] is equal to [" + message + "]");
     
      String visibility = this.getAttributeAsString(VISIBILITY);
      logger.debug("Parameter [" + VISIBILITY + "] is equal to [" + visibility + "]");
     
      String resultStr = null;
     
      ObjNote objnote = null;
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile  profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      String owner = (String)((UserProfile)profile).getUserId();
      try {
        objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
      } catch (Exception e) {
        logger.error("Cannot load notes for document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot load notes", e);
      }
      String currentNotes = "";
      if (objnote != null) {
        logger.debug("Existing notes found with the same execution identifier");
        byte[] content = objnote.getContent();
        currentNotes = new String(content);
      }
      if (!"INSERT_NOTE".equalsIgnoreCase(MESSAGE) && !currentNotes.equals(previousNotes)) {
        logger.debug("Notes have been created by another user");
        resultStr = "conflict";
      } else {
        logger.debug("Saving notes...");
        try {
          saveNotes(execIdentifier, obj.getId(), notes, objnote, owner, visibility,profile);
          logger.debug("Notes saved");
          resultStr = "ok";
        } catch (Exception e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Error while saving notes", e);
        }
View Full Code Here

    logger.debug("IN");
   
    try {
      // retrieving execution instance from session, no need to check if user is able to execute the current document
      ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
      BIObject obj = executionInstance.getBIObject();
      UserProfile userProfile = (UserProfile) this.getUserProfile();
      ISnapshotDAO dao = null;
      try {
        dao = DAOFactory.getSnapshotDAO();
      } catch (EMFUserError e) {
        logger.error("Error while istantiating DAO", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
      }
      String ids = this.getAttributeAsString(SNAPSHOT_ID);
      // ids contains the id of the snapshots to be deleted separated by ,
      String[] idArray = ids.split(",");
      for (int i = 0; i < idArray.length; i++) {
        Integer id = new Integer(idArray[i]);
        Snapshot snapshot = null;
        try {
          snapshot = dao.loadSnapshot(id);
        } catch (EMFUserError e) {
          logger.error("Snapshot with id = " + id + " not found", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Scheduled execution not found", e);
        }
        if (snapshot.getBiobjId().equals(obj.getId())) {
          logger.info("User [id: " + userProfile.getUserUniqueIdentifier() + ", userId: " + userProfile.getUserId() + ", name: " + userProfile.getUserName() + "] " +
              "is deleting scheduled execution [id: " + snapshot.getId() + ", name: " + snapshot.getName() + "] ...");
          try {
            dao.deleteSnapshot(id);
          } catch (EMFUserError e) {
            throw new SpagoBIServiceException(SERVICE_NAME, "Error while deleting scheduled execution", e);
          }
          logger.debug("Scheduled execution [id: " + snapshot.getId() + ", name: " + snapshot.getName() + "] deleted.");
        } else {
          logger.error("Cannot delete scheduled execution with id = " + snapshot.getBiobjId() + ": " +
              "it is not relevant to the current document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]");
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot delete scheduled execution: it is not relevant to the current document");
        }
       
      }
      try {
View Full Code Here

    Assert.assertNotNull(getContext(), "Execution context cannot be null" );
    Assert.assertNotNull(getContext().getExecutionInstance( ExecutionInstance.class.getName() ), "Execution instance cannot be null");
 
    executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
   
    BIObject obj = executionInstance.getBIObject();
    String roleName = executionInstance.getExecutionRole();

    List parametersForExecution = new ArrayList();
    List parameters = obj.getBiObjectParameters();
   
    if (parameters != null && parameters.size() > 0) {
      Iterator iter = parameters.iterator();
      while (iter.hasNext()) {
        BIObjectParameter biparam = (BIObjectParameter) iter.next();
View Full Code Here

  }
 
  private static void addBiobjFieldsToDocument(Document doc, Integer biObjectID){
    logger.debug("IN");
    try {
      BIObject biObj = DAOFactory.getBIObjectDAO().loadBIObjectById(biObjectID);
      doc.add(new Field(IndexingConstants.BIOBJ_NAME, biObj.getName(),
          Field.Store.NO, Field.Index.ANALYZED));
      if(biObj.getDescription() != null){
        doc.add(new Field(IndexingConstants.BIOBJ_DESCR, biObj.getDescription(),
          Field.Store.NO, Field.Index.ANALYZED));
      }
      if(biObj.getLabel() != null){
        doc.add(new Field(IndexingConstants.BIOBJ_LABEL, biObj.getLabel(),
          Field.Store.NO, Field.Index.ANALYZED));
      }
     
    } catch (EMFUserError e) {
      logger.error(e.getMessage(), e);
View Full Code Here

  private static Logger logger = Logger.getLogger(BIObjectNotesManager.class);
 
  public String getExecutionIdentifier(Integer biobjID, String executionRole, HashMap execUrlParMapWithValues ) {
   
    logger.debug("IN");
    BIObject biobj = null;
    try {
      biobj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(biobjID, executionRole);
    } catch (EMFUserError e1) {
      logger.error("EMFUser Error",e1);
      e1.printStackTrace();
    }
   
    BIObjectParameter biobjpar = null;
    String parUrlName = null;
    String identif = null;
    List biobjpars = null;
    Iterator iterBiobjPars = null;
   
    if(biobj!=null){
      identif = "biobject=" + biobj.getLabel() + "&";
      biobjpars = biobj.getBiObjectParameters();
      iterBiobjPars = biobjpars.iterator();
      while(iterBiobjPars.hasNext()){
        biobjpar = (BIObjectParameter)iterBiobjPars.next();
        Parameter par = biobjpar.getParameter();
        if((par==null) || (!par.isFunctional())){
View Full Code Here

   */
  public BIObject loadBIObjectForExecutionByIdAndRole(Integer id, String role) throws EMFUserError {
    logger.debug("IN");
    Session aSession = null;
    Transaction tx = null;
    BIObject biObject = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      biObject = loadBIObjectForDetail(id);
      //String hql = "from SbiObjPar s where s.sbiObject.biobjId = " + biObject.getId() + " order by s.priority asc";
      String hql = "from SbiObjPar s where s.sbiObject.biobjId = ? order by s.priority asc";
      Query hqlQuery = aSession.createQuery(hql);
      hqlQuery.setInteger(0, biObject.getId().intValue());
      List hibObjectPars = hqlQuery.list();
      SbiObjPar hibObjPar = null;
      Iterator it = hibObjectPars.iterator();
      BIObjectParameter tmpBIObjectParameter = null;
      BIObjectParameterDAOHibImpl aBIObjectParameterDAOHibImpl = new BIObjectParameterDAOHibImpl();
      IParameterDAO aParameterDAO = DAOFactory.getParameterDAO();
      List biObjectParameters = new ArrayList();
      Parameter aParameter = null;
      int count = 1;
      while (it.hasNext()) {
        hibObjPar = (SbiObjPar) it.next();
        tmpBIObjectParameter = aBIObjectParameterDAOHibImpl.toBIObjectParameter(hibObjPar);

        //*****************************************************************
        //**************** START PRIORITY RECALCULATION *******************
        //*****************************************************************
        Integer priority = tmpBIObjectParameter.getPriority();
        if (priority == null || priority.intValue() != count) {
          logger.warn("The priorities of the biparameters for the document with id = " + biObject.getId() + " are not sorted. Priority recalculation starts.");
          aBIObjectParameterDAOHibImpl.recalculateBiParametersPriority(biObject.getId(), aSession);
          tmpBIObjectParameter.setPriority(new Integer(count));
        }
        count++;
        //*****************************************************************
        //**************** END PRIORITY RECALCULATION *******************
        //*****************************************************************

        aParameter = aParameterDAO.loadForExecutionByParameterIDandRoleName(
            tmpBIObjectParameter.getParID(), role);
        tmpBIObjectParameter.setParID(aParameter.getId());
        tmpBIObjectParameter.setParameter(aParameter);
        biObjectParameters.add(tmpBIObjectParameter);
      }
      biObject.setBiObjectParameters(biObjectParameters);
      tx.commit();
    } catch (HibernateException he) {
      logger.error(he);
      if (tx != null)
        tx.rollback();
View Full Code Here

TOP

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

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.