Package it.eng.spagobi.analiticalmodel.document.metadata

Examples of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjects


      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiViewpoints hibViewpoint = new SbiViewpoints();

      //hibViewpoint.setVpId(vpId);
      SbiObjects aSbiObject = (SbiObjects) aSession.load(SbiObjects.class, viewpoint.getBiobjId());
      hibViewpoint.setSbiObject(aSbiObject);
      hibViewpoint.setVpDesc(viewpoint.getVpDesc());
      hibViewpoint.setVpOwner(viewpoint.getVpOwner());
      hibViewpoint.setVpName(viewpoint.getVpName());
      hibViewpoint.setVpScope(viewpoint.getVpScope());
View Full Code Here


    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiObjects hibBIObject = (SbiObjects) aSession.load(SbiObjects.class, idBIObj);
      SbiBinContents hibBinContent = new SbiBinContents();
      hibBinContent.setContent(content);
      updateSbiCommonInfo4Insert(hibBinContent);
      Integer idBin = (Integer)aSession.save(hibBinContent);
      // recover the saved binary hibernate object
View Full Code Here

    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      // load object
      SbiObjects hibBIObject = (SbiObjects) aSession.load(SbiObjects.class, obj.getId());     
      // erase object from functionalities
      Set hibObjFuncs = hibBIObject.getSbiObjFuncs();
      Iterator itObjFunc = hibObjFuncs.iterator();
      while (itObjFunc.hasNext()) {
        SbiObjFunc aSbiObjFunc = (SbiObjFunc) itObjFunc.next();
        if (idFunct == null || aSbiObjFunc.getId().getSbiFunctions().getFunctId().intValue() == idFunct.intValue()) {
          logger.debug("Deleting object [" + obj.getName() + "] from folder [" + aSbiObjFunc.getId().getSbiFunctions().getPath() + "]");
          aSession.delete(aSbiObjFunc);
        }
      }

      aSession.flush();
      // reload object
      aSession.refresh(hibBIObject);

      // if the object is no more referenced in any folder, erases it from sbi_obejcts table
      hibObjFuncs = hibBIObject.getSbiObjFuncs();
      if (hibObjFuncs == null || hibObjFuncs.size() == 0) {

        logger.debug("The object [" + obj.getName() + "] is no more referenced by any functionality. It will be completely deleted from db.");

        // delete templates
        String hql = "from SbiObjTemplates sot where sot.sbiObject.biobjId="+obj.getId();
        Query query = aSession.createQuery(hql);
        List templs = query.list();
        Iterator iterTempls = templs.iterator();
        while(iterTempls.hasNext()) {
          SbiObjTemplates hibObjTemp = (SbiObjTemplates)iterTempls.next();
          SbiBinContents hibBinCont = hibObjTemp.getSbiBinContents();
          aSession.delete(hibObjTemp);
          aSession.delete(hibBinCont);

        }

        //delete subobjects eventually associated
        ISubObjectDAO subobjDAO = DAOFactory.getSubObjectDAO();
        List subobjects =  subobjDAO.getSubObjects(obj.getId());
        for (int i=0; i < subobjects.size(); i++){
          SubObject s = (SubObject) subobjects.get(i);
          //subobjDAO.deleteSubObject(s.getId());
          subobjDAO.deleteSubObjectSameConnection(s.getId(), aSession);
        }

        //delete viewpoints eventually associated
        List viewpoints = new ArrayList();
        IViewpointDAO biVPDAO = DAOFactory.getViewpointDAO();
        viewpoints =  biVPDAO.loadAllViewpointsByObjID(obj.getId());
        for (int i=0; i<viewpoints.size(); i++){
          Viewpoint vp =(Viewpoint)viewpoints.get(i);
          biVPDAO.eraseViewpoint(vp.getVpId());
        }

        //delete snapshots eventually associated
        ISnapshotDAO snapshotsDAO = DAOFactory.getSnapshotDAO();
        List snapshots = snapshotsDAO.getSnapshots(obj.getId());
        for (int i=0; i < snapshots.size(); i++){
          Snapshot aSnapshots = (Snapshot) snapshots.get(i);
          snapshotsDAO.deleteSnapshot(aSnapshots.getId());
        }

        //delete notes eventually associated
        IObjNoteDAO objNoteDAO = DAOFactory.getObjNoteDAO();
        objNoteDAO.eraseNotes(obj.getId());

        //delete metadata eventually associated
        List metadata = DAOFactory.getObjMetadataDAO().loadAllObjMetadata();
        IObjMetacontentDAO objMetaContentDAO = DAOFactory.getObjMetacontentDAO();
        if (metadata != null && !metadata.isEmpty()) {
          Iterator it = metadata.iterator();
          while (it.hasNext()) {
            ObjMetadata objMetadata = (ObjMetadata) it.next();
            ObjMetacontent objMetacontent = (ObjMetacontent) DAOFactory.getObjMetacontentDAO().loadObjMetacontent(objMetadata.getObjMetaId(), obj.getId(), null);
            if(objMetacontent!=null){
              objMetaContentDAO.eraseObjMetadata(objMetacontent);
            }
          }
        }     


        // delete parameters associated
        Set objPars = hibBIObject.getSbiObjPars();
        Iterator itObjPar = objPars.iterator();
        BIObjectParameterDAOHibImpl objParDAO = new BIObjectParameterDAOHibImpl();
        while (itObjPar.hasNext()) {
          SbiObjPar aSbiObjPar = (SbiObjPar) itObjPar.next();
          BIObjectParameter aBIObjectParameter = new BIObjectParameter();
View Full Code Here

     
      // allRolesWithPermission will store all roles with permissions on folders containing the required document
      List allRolesWithPermission = new ArrayList();

      // first filter on roles: finds only roles with permissions on folders containing the required document
      SbiObjects hibBIObject = (SbiObjects)aSession.load(SbiObjects.class, id);
      String objectState = hibBIObject.getState().getValueCd();
      String permission = ObjectsAccessVerifier.getPermissionFromDocumentState(objectState);
      Set hibObjFuncs = hibBIObject.getSbiObjFuncs();
      Iterator itObjFunc = hibObjFuncs.iterator();
      while (itObjFunc.hasNext()) {
        SbiObjFunc aSbiObjFunc = (SbiObjFunc) itObjFunc.next();
        SbiFunctions aSbiFunctions = aSbiObjFunc.getId().getSbiFunctions();
        String funcTypeCd = aSbiFunctions.getFunctTypeCd();
View Full Code Here

      String hql = " from SbiObjects where path = ? " ;

      Query hqlQuery = aSession.createQuery(hql);
      hqlQuery.setSerializable(0, path);

      SbiObjects hibObject = (SbiObjects)hqlQuery.uniqueResult();
      if (hibObject == null) return null;
      biObject = toBIObject(hibObject);
      tx.commit();
    } catch (HibernateException he) {
      logger.error(he);
View Full Code Here

      //if flag flgDelete is true delete all parameters associated to document composition
      if (flgDelete){
        List lstDocParameters = DAOFactory.getBIObjectParameterDAO().loadBIObjectParametersById(biObject.getId());
        for (int i=0; i< lstDocParameters.size(); i++){
          BIObjectParameter docParam = (BIObjectParameter)lstDocParameters.get(i);
          SbiObjects aSbiObject = new SbiObjects();
          Integer objId = biObject.getId();
          aSbiObject.setBiobjId( biObject.getId());

          SbiParameters aSbiParameter = new SbiParameters();
          aSbiParameter.setParId(docParam.getParameter().getId());   

          SbiObjPar hibObjPar =  new SbiObjPar();
          hibObjPar.setObjParId(docParam.getId());
          hibObjPar.setLabel(docParam.getLabel());

          hibObjPar.setSbiObject(aSbiObject);
          hibObjPar.setSbiParameter(aSbiParameter);

          aSession.delete(hibObjPar);
        }
      }


      //for every document child gets parameters and inserts these into new document composition object
      for (int i=0; i<lstLabeldDocs.size(); i++){
        //BIObject docChild = DAOFactory.getBIObjectDAO().loadBIObjectByLabel((String)lstLabeldDocs.get(i));
        BIObject docChild = loadBIObjectByLabel((String)lstLabeldDocs.get(i));

        if (docChild == null){
          logger.error("Error while getting document child "+ (String)lstLabeldDocs.get(i) +" for document composition.");
          List lstLabel = new ArrayList();
          lstLabel.add((String)lstLabeldDocs.get(i));
          throw new EMFUserError(EMFErrorSeverity.ERROR, "1005", lstLabel, "component_spagobidocumentcompositionIE_messages");
        }
        else {
          List lstDocChildParameters = DAOFactory.getBIObjectParameterDAO().loadBIObjectParametersById(docChild.getId());
          for (int j=0; j<lstDocChildParameters.size(); j++){
            BIObjectParameter objPar  = (BIObjectParameter)lstDocChildParameters.get(j);
            if (!totalParameters.contains(objPar.getLabel())){
              SbiObjects aSbiObject = new SbiObjects();
              //aSbiObject.setBiobjId(biObject.getId());
              Integer objId = biObject.getId();
              if (objId == null || objId.compareTo(new Integer("0"))==0)
                objId = biObject.getId();
              aSbiObject.setBiobjId(objId);

              SbiParameters aSbiParameter = new SbiParameters();
              aSbiParameter.setParId(objPar.getParID());
              SbiObjPar sbiObjPar = new SbiObjPar();
              sbiObjPar.setSbiObject(aSbiObject);
View Full Code Here

        else {
          List lstDocChildParameters = DAOFactory.getBIObjectParameterDAO().loadBIObjectParametersById(docChild.getId());
          for (int j=0; j<lstDocChildParameters.size(); j++){
            BIObjectParameter objPar  = (BIObjectParameter)lstDocChildParameters.get(j);
            if (!totalParameters.contains(objPar.getLabel())){
              SbiObjects aSbiObject = new SbiObjects();
              //aSbiObject.setBiobjId(biObject.getId());
              Integer objId = biobjectId;
              if (objId == null || objId.compareTo(new Integer("0"))==0)
                objId = biobjectId;
              aSbiObject.setBiobjId(objId);

              SbiParameters aSbiParameter = new SbiParameters();
              aSbiParameter.setParId(objPar.getParID());
              SbiObjPar sbiObjPar = new SbiObjPar();
              sbiObjPar.setSbiObject(aSbiObject);
View Full Code Here

      }

      List hibList = query.list();
      Iterator it = hibList.iterator();
      while (it.hasNext()) {
        SbiObjects object = (SbiObjects) it.next();
        realResult.add(toBIObject(object));
      }
      tx.commit();
    } catch (HibernateException he) {
      logger.error(he);
View Full Code Here

      }   

      List hibList = query.list();
      Iterator it = hibList.iterator();
      while (it.hasNext()) {
        SbiObjects object = (SbiObjects) it.next();
        realResult.add(toBIObject(object));
      }
      tx.commit();
    } catch (HibernateException he) {
      logger.error(he);
View Full Code Here

      }
      //executes query
      List hibList = query.list();
      Iterator it = hibList.iterator();
      while (it.hasNext()) {
        SbiObjects object = (SbiObjects) it.next();
        realResult.add(toBIObject(object));
      }
      tx.commit();
    } catch (HibernateException he) {
      logger.error(he);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjects

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.