Examples of ISubObjectDAO


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

    private Content readSubObjectContent(String user,String subObjectId){
      logger.debug("IN");
      Content content=new Content();
      try {
          Integer id = new Integer(subObjectId);
          ISubObjectDAO subdao = DAOFactory.getSubObjectDAO();
          SubObject subobj = subdao.getSubObject(id);
          byte[] cont = subobj.getContent();
          BASE64Encoder bASE64Encoder = new BASE64Encoder();
          content.setContent(bASE64Encoder.encode(cont));
          content.setFileName(subobj.getName());
          return content;
View Full Code Here

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

 
    private Content readSubObjectContent(String user,String subObjectName, Integer objId){
      logger.debug("IN");
      Content content=new Content();
      try {
          ISubObjectDAO subdao = DAOFactory.getSubObjectDAO();
          SubObject subobj = subdao.getSubObjectByNameAndBIObjectId(subObjectName, objId);
          byte[] cont = subobj.getContent();
          BASE64Encoder bASE64Encoder = new BASE64Encoder();
          content.setContent(bASE64Encoder.encode(cont));
          content.setFileName(subobj.getName());
          return content;
View Full Code Here

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

    }
   
    private String saveSubObject(String user,String documentiId,String analysisName,String analysisDescription,String visibilityBoolean,String content){
  logger.debug("IN");
  try {
      ISubObjectDAO subdao = DAOFactory.getSubObjectDAO();
      subdao.setUserID(user);
      Integer docId = new Integer(documentiId);
      boolean subobjExists = false;
     
      //gets subobj if yet presents
      Integer id = null;
      SubObject objSub = subdao.getSubObjectByNameAndBIObjectId(analysisName, docId);
      if (objSub != null){
        id = objSub.getId();
        //check ability to modify:
        if (!user.equals(objSub.getOwner())) {
            logger.debug("KO - User " + user + " cannot modify subobjects");
            return "KO - You cannot modify subobjects";
          }
        subobjExists = true;
      }
      else
        objSub = new SubObject();
     
      objSub.setDescription(analysisDescription);
     
      if (visibilityBoolean!=null && visibilityBoolean.equals("true")){
        objSub.setIsPublic(new Boolean(true));
      }else{
        objSub.setIsPublic(new Boolean(false));
      }
      objSub.setOwner(user);
      objSub.setName(analysisName);
      objSub.setContent(content.getBytes());
     
      //if subobject doesn't exist, it will be created
      if (!subobjExists)
        id = subdao.saveSubObject(docId, objSub);
      else
        //update the subobject
        id = subdao.modifySubObject(docId, objSub);;
     
      String toReturn = "OK - " + id.toString();
      return toReturn;
  } catch (NumberFormatException e) {
      logger.error("NumberFormatException",e);
View Full Code Here

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

      if (isMap) {
        exporter.insertMapCatalogue(session);
      }

      if (exportSubObjects) {
        ISubObjectDAO subDao = DAOFactory.getSubObjectDAO();
        List subObjectLis = subDao.getSubObjects(biobj.getId());
        if (subObjectLis != null && !subObjectLis.isEmpty())
          exporter.insertAllSubObject(biobj, subObjectLis, session);
      }
      if (exportSnapshots) {
        ISnapshotDAO subDao = DAOFactory.getSnapshotDAO();
        List snapshotLis = subDao.getSnapshots(biobj.getId());
        if (snapshotLis != null && !snapshotLis.isEmpty())
          exporter.insertAllSnapshot(biobj, snapshotLis, session);
      }

      // insert functionalities and association with object
View Full Code Here

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

    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();
      ISubObjectDAO dao = null;
      try {
        dao = DAOFactory.getSubObjectDAO();
      } catch (EMFUserError e) {
        logger.error("Error while istantiating DAO", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
      }
      String ids = this.getAttributeAsString(SUBOBJECT_ID);
      // ids contains the id of the subobjects to be deleted separated by ,
      String[] idArray = ids.split(",");
      for (int i = 0; i < idArray.length; i++) {
        Integer id = new Integer(idArray[i]);
        SubObject subObject = null;
        try {
          subObject = dao.getSubObject(id);
        } catch (EMFUserError e) {
          logger.error("SubObject with id = " + id + " not found", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Customized view not found", e);
        }
        if (subObject.getBiobjId().equals(obj.getId())) {
          boolean canDeleteSubObject = false;
          if (userProfile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)
              || subObject.getOwner().equals(userProfile.getUserId().toString())) {
            canDeleteSubObject = true;
          }
          if (canDeleteSubObject) {
            logger.info("User [id: " + userProfile.getUserUniqueIdentifier() + ", userId: " + userProfile.getUserId() + ", name: " + userProfile.getUserName() + "] " +
                "is deleting customized view [id: " + subObject.getId() + ", name: " + subObject.getName() + "] ...");
            try {
              dao.deleteSubObject(id);
            } catch (EMFUserError e) {
              throw new SpagoBIServiceException(SERVICE_NAME, "Error while deleting customized view", e);
            }
            logger.debug("Customized view [id: " + subObject.getId() + ", name: " + subObject.getName() + "] deleted.");
          } else {
View Full Code Here

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

  private void deleteSubObjectHandler(SourceBean request, SourceBean response)
  throws Exception {
    logger.debug("IN");
    UserProfile profile = (UserProfile) getUserProfile();
    String userId = profile.getUserId().toString();
    ISubObjectDAO subobjdao = DAOFactory.getSubObjectDAO();
    List subobjectsIdsList = request.getAttributeAsList(SpagoBIConstants.SUBOBJECT_ID);
    if (subobjectsIdsList != null && !subobjectsIdsList.isEmpty()) {
      Iterator it = subobjectsIdsList.iterator();
      while (it.hasNext()) {
        String subobjectIdStr = (String) it.next();
        Integer subobjectId = new Integer(subobjectIdStr);
        // check if the user is able to erase the subobject
        boolean canDelete = false;
        // if user is administrator, he can delete it
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          canDelete = true;
        } else {
          // if user is not administrator, he can delete it only if he is the owner
          SubObject subobject = subobjdao.getSubObject(subobjectId);
          if (subobject == null) {
            logger.warn("Subobject with id = " + subobjectId + " not found!");
            continue;
          }
          if (subobject.getOwner().equals(userId)) {
            canDelete = true;
          }
        }
        if (canDelete) {
          logger.error("Deleting subobject with id = " + subobjectId + " ...");
          subobjdao.deleteSubObject(subobjectId);
        } else {
          logger.error("Current user [" + userId + "] CANNOT erase subobject with id = " + subobjectId);
        }
      }
    }
View Full Code Here

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

   */
  private List getSubObjectsList(BIObject obj, IEngUserProfile profile) {
    logger.debug("IN");
    List subObjects = new ArrayList();
    try {
      ISubObjectDAO subobjdao = DAOFactory.getSubObjectDAO();
      subObjects = subobjdao
      .getAccessibleSubObjects(obj.getId(), profile);
    } catch (Exception e) {
      logger.error("Error retriving the subObject list", e);
    }
    logger.debug("OUT");
View Full Code Here

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

        } catch (JSONException e) {
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize errors to the client", e);
        }
      } else {
     
        ISubObjectDAO dao = null;
        try {
          dao = DAOFactory.getSubObjectDAO();
        } catch (EMFUserError e) {
          logger.error("Error while istantiating DAO", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
        }
 
        SubObject subObject = null;
        try {
          subObject = dao.getSubObject(subObjectId);
        } catch (EMFUserError e) {
          logger.error("SubObject with id = " + subObjectId + " not found", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Customized view not found", 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.