Examples of GuiGenericDataSet


Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

   */
  public GuiGenericDataSet restoreOlderDataSetVersion(Integer dsId, Integer dsVersion) throws EMFUserError {
    logger.debug("IN");
    Session aSession = null;
    Transaction tx = null;
    GuiGenericDataSet toReturn = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      if(dsId!=null && dsVersion!=null){

View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

      throw new SpagoBIServiceException(SERVICE_NAME,  "sbi.general.retrieveItemsError", e);
    }
  }
 
  private void datatsetInsert(IDataSetDAO dsDao, Locale locale){
    GuiGenericDataSet ds = getGuiGenericDatasetToInsert();   
    if(ds!=null){
      String id = getAttributeAsString(DataSetConstants.ID);
      try {
        if(id != null && !id.equals("") && !id.equals("0")){             
          ds.setDsId(Integer.valueOf(id));
          dsDao.modifyDataSet(ds);
          logger.debug("Resource "+id+" updated");
          JSONObject attributesResponseSuccessJSON = new JSONObject();
          attributesResponseSuccessJSON.put("success", true);
          attributesResponseSuccessJSON.put("responseText", "Operation succeded");
          attributesResponseSuccessJSON.put("id", id);
          writeBackToClient( new JSONSuccess(attributesResponseSuccessJSON) );
        }else{
          Integer dsID = dsDao.insertDataSet(ds);
          GuiGenericDataSet dsSaved = dsDao.loadDataSetById(dsID);
          logger.debug("New Resource inserted");
          JSONObject attributesResponseSuccessJSON = new JSONObject();
          attributesResponseSuccessJSON.put("success", true);
          attributesResponseSuccessJSON.put("responseText", "Operation succeded");
          attributesResponseSuccessJSON.put("id", dsID);
          if(dsSaved!=null){
            GuiDataSetDetail dsDetailSaved = dsSaved.getActiveDetail();
            attributesResponseSuccessJSON.put("dateIn", dsDetailSaved.getTimeIn());
            attributesResponseSuccessJSON.put("userIn", dsDetailSaved.getUserIn());
            attributesResponseSuccessJSON.put("versId", dsDetailSaved.getDsHId());
            attributesResponseSuccessJSON.put("versNum", dsDetailSaved.getVersionNum());
          }
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

      if(sbiActiveDatasetsList!=null && !sbiActiveDatasetsList.isEmpty()){
        Iterator it = sbiActiveDatasetsList.iterator();   
        while (it.hasNext()) {
          SbiDataSetHistory hibDataSet = (SbiDataSetHistory)it.next();
          GuiGenericDataSet ds = toDataSet(hibDataSet);
          List<GuiDataSetDetail> oldDsVersion = new ArrayList();

          if(hibDataSet.getSbiDsConfig()!=null){
            Integer dsId = hibDataSet.getSbiDsConfig().getDsId();
            Query hibQuery = aSession.createQuery("from SbiDataSetHistory h where h.active = ? and h.sbiDsConfig = ?" );
            hibQuery.setBoolean(0, false);
            hibQuery.setInteger(1, dsId)

            List<SbiDataSetHistory> olderTemplates = hibQuery.list();
            if(olderTemplates!=null && !olderTemplates.isEmpty()){
              Iterator it2 = olderTemplates.iterator();
              while(it2.hasNext()){
                SbiDataSetHistory hibOldDataSet = (SbiDataSetHistory) it2.next();
                if(hibOldDataSet!=null && !hibOldDataSet.isActive()){
                  GuiDataSetDetail dsD = toDataSetDetail(hibOldDataSet);   
                  oldDsVersion.add(dsD);
                }
              }
            }     
          }
          ds.setNonActiveDetails(oldDsVersion);
          toReturn.add(ds);
        }
      }     

    } catch (HibernateException he) {
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

 
  private void datatsetVersionRestore(IDataSetDAO dsDao, Locale locale){
    Integer dsID = getAttributeAsInteger(DataSetConstants.DS_ID);
    Integer dsVersionNum = getAttributeAsInteger(DataSetConstants.VERSION_NUM);
    try {
      GuiGenericDataSet dsNewDetail= dsDao.restoreOlderDataSetVersion(dsID, dsVersionNum);
      logger.debug("Dataset Version correctly Restored");
      List temp = new ArrayList();
      temp.add(dsNewDetail);
      JSONArray itemJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(temp, locale)
      JSONObject version = itemJSON.getJSONObject(0);
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

    return items;
  }
 
  private GuiGenericDataSet getGuiGenericDatasetToInsert() {
   
    GuiGenericDataSet ds = null;
   
    String label = getAttributeAsString(DataSetConstants.LABEL);
    String name = getAttributeAsString(DataSetConstants.NAME);
    String description = getAttributeAsString(DataSetConstants.DESCRIPTION);   
    String dsTypeCd = getAttributeAsString(DataSetConstants.DS_TYPE_CD);

    List<Domain> domainsDs = (List<Domain>)getSessionContainer().getAttribute("dsTypesList");   
    String dsType = "";
    if(domainsDs!=null && !domainsDs.isEmpty()){
      Iterator it = domainsDs.iterator();
      while(it.hasNext()){
        Domain d = (Domain)it.next();
        if(d!=null && d.getValueCd().equalsIgnoreCase(dsTypeCd)){
          dsType = d.getValueName();
          break;
        }
      }
    }     
   
      if (name != null && label != null && dsType!=null && !dsType.equals("")) {
     
        ds = new GuiGenericDataSet();   
      if(ds!=null){
        ds.setLabel(label);
        ds.setName(name);
       
        if(description != null && !description.equals("")){
          ds.setDescription(description);
        }
        GuiDataSetDetail dsActiveDetail = constructDataSetDetail(dsType);
        ds.setActiveDetail(dsActiveDetail)
      }else{
        logger.error("DataSet type is not existent");
        throw new SpagoBIServiceException(SERVICE_NAME,  "sbi.ds.dsTypeError");
      }
    }   
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

      if(sbiActiveDatasetsList!=null && !sbiActiveDatasetsList.isEmpty()){
        Iterator it = sbiActiveDatasetsList.iterator();   
        while (it.hasNext()) {
          SbiDataSetHistory hibDataSet = (SbiDataSetHistory)it.next();
          GuiGenericDataSet ds = toDataSet(hibDataSet);
          List<GuiDataSetDetail> oldDsVersion = new ArrayList();

          if(hibDataSet.getSbiDsConfig()!=null){
            Integer dsId = hibDataSet.getSbiDsConfig().getDsId();
            Query hibQuery = aSession.createQuery("from SbiDataSetHistory h where h.active = ? and h.sbiDsConfig = ?" );
            hibQuery.setBoolean(0, false);
            hibQuery.setInteger(1, dsId)

            List<SbiDataSetHistory> olderTemplates = hibQuery.list();
            if(olderTemplates!=null && !olderTemplates.isEmpty()){
              Iterator it2 = olderTemplates.iterator();
              while(it2.hasNext()){
                SbiDataSetHistory hibOldDataSet = (SbiDataSetHistory) it2.next();
                if(hibOldDataSet!=null && !hibOldDataSet.isActive()){
                  GuiDataSetDetail dsD = toDataSetDetail(hibOldDataSet);   
                  oldDsVersion.add(dsD);
                }
              }
            }     
          }
          ds.setNonActiveDetails(oldDsVersion);
          toReturn.add(ds);
        }
      }     
    } catch (HibernateException he) {
      logger.error("Error while loading the list of Resources", he)
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

    return toReturn;
  }

  public GuiGenericDataSet toDataSet(SbiDataSetHistory hibDataSet) throws EMFUserError{   
    logger.debug("IN");
    GuiGenericDataSet ds = new GuiGenericDataSet();
    GuiDataSetDetail dsActiveDetail = null;

    if(hibDataSet instanceof SbiFileDataSet){   
      dsActiveDetail = new FileDataSetDetail();
      ((FileDataSetDetail)dsActiveDetail).setFileName(((SbiFileDataSet)hibDataSet).getFileName());   
      dsActiveDetail.setDsType(FILE_DS_TYPE);
      logger.debug("File dataset");
    }

    if(hibDataSet instanceof SbiQueryDataSet){     
      dsActiveDetail=new QueryDataSetDetail();
      ((QueryDataSetDetail)dsActiveDetail).setQuery(((SbiQueryDataSet)hibDataSet).getQuery());
      SbiDataSource sbids=((SbiQueryDataSet)hibDataSet).getDataSource();
      if(sbids!=null){
        String dataSourceLabel = sbids.getLabel();
        ((QueryDataSetDetail)dsActiveDetail).setDataSourceLabel(dataSourceLabel);
      }
      dsActiveDetail.setDsType(JDBC_DS_TYPE);
      logger.debug("Jdbc dataset");
    }
   
    if(hibDataSet instanceof SbiQbeDataSet){     
      dsActiveDetail = new QbeDataSetDetail();
      QbeDataSetDetail aQbeDataSetDetail = (QbeDataSetDetail) dsActiveDetail;
      SbiQbeDataSet qbeHibDataSet = (SbiQbeDataSet) hibDataSet;
      aQbeDataSetDetail.setSqlQuery(qbeHibDataSet.getSqlQuery());
      aQbeDataSetDetail.setJsonQuery(qbeHibDataSet.getJsonQuery());
      aQbeDataSetDetail.setDatamarts(qbeHibDataSet.getDatamarts());
      SbiDataSource sbids = qbeHibDataSet.getDataSource();
      if (sbids!=null){
        aQbeDataSetDetail.setDataSourceLabel(sbids.getLabel());
      }
      dsActiveDetail.setDsType(QBE_DS_TYPE);
    }

    if(hibDataSet instanceof SbiWSDataSet){     
      dsActiveDetail=new WSDataSetDetail();
      ((WSDataSetDetail)dsActiveDetail).setAddress(((SbiWSDataSet)hibDataSet).getAdress());
      ((WSDataSetDetail)dsActiveDetail).setOperation(((SbiWSDataSet)hibDataSet).getOperation());
      dsActiveDetail.setDsType(WS_DS_TYPE);
      logger.debug("Ws dataset");
    }

    if(hibDataSet instanceof SbiScriptDataSet){     
      dsActiveDetail=new ScriptDataSetDetail();
      ((ScriptDataSetDetail)dsActiveDetail).setScript(((SbiScriptDataSet)hibDataSet).getScript());
      ((ScriptDataSetDetail)dsActiveDetail).setLanguageScript(((SbiScriptDataSet)hibDataSet).getLanguageScript());
      dsActiveDetail.setDsType(SCRIPT_DS_TYPE);
      logger.debug("Script dataset");
    }

    if(hibDataSet instanceof SbiJClassDataSet){     
      dsActiveDetail=new JClassDataSetDetail();
      ((JClassDataSetDetail)dsActiveDetail).setJavaClassName(((SbiJClassDataSet)hibDataSet).getJavaClassName());
      dsActiveDetail.setDsType(JCLASS_DS_TYPE);
      logger.debug("JClass dataset");
    }

    if(hibDataSet.getSbiDsConfig()!=null){
      ds.setDsId(hibDataSet.getSbiDsConfig().getDsId());
      ds.setName(hibDataSet.getSbiDsConfig().getName());
      ds.setLabel(hibDataSet.getSbiDsConfig().getLabel());
      ds.setDescription(hibDataSet.getSbiDsConfig().getDescription())
      ds.setMetaVersion(hibDataSet.getMetaVersion());
      ds.setUserIn(hibDataSet.getUserIn());
      ds.setTimeIn(new Date());
      dsActiveDetail.setDsId(hibDataSet.getSbiDsConfig().getDsId());

    }

    dsActiveDetail.setDsHId(hibDataSet.getDsHId());
    dsActiveDetail.setCategoryId((hibDataSet.getCategory()== null)? null:hibDataSet.getCategory().getValueId());
    dsActiveDetail.setCategoryValueName((hibDataSet.getCategory()== null)? null:hibDataSet.getCategory().getValueNm());
    dsActiveDetail.setTransformerId((hibDataSet.getTransformer()== null)? null:hibDataSet.getTransformer().getValueId());
    dsActiveDetail.setTransformerCd((hibDataSet.getTransformer()== null)? null:hibDataSet.getTransformer().getValueCd());
    dsActiveDetail.setPivotColumnName(hibDataSet.getPivotColumnName());
    dsActiveDetail.setPivotRowName(hibDataSet.getPivotRowName());
    dsActiveDetail.setPivotColumnValue(hibDataSet.getPivotColumnValue());
    dsActiveDetail.setNumRows(hibDataSet.isNumRows());     
    dsActiveDetail.setParameters(hibDataSet.getParameters());   
    dsActiveDetail.setDsMetadata(hibDataSet.getDsMetadata());   
    dsActiveDetail.setUserIn(hibDataSet.getUserIn());
    dsActiveDetail.setTimeIn(hibDataSet.getTimeIn());
    dsActiveDetail.setVersionNum(hibDataSet.getVersionNum());
    dsActiveDetail.setSbiVersionIn(hibDataSet.getSbiVersionIn());
    dsActiveDetail.setDsHId(hibDataSet.getDsHId());

    ds.setActiveDetail(dsActiveDetail);

    logger.debug("OUT");
    return ds;
  }
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

   * @param iDataSet The IDataSet
   * @return The corrispondent <code>GuiGenericDataSet</code> object
   * @throws EMFUserError
   */
  public GuiGenericDataSet toDataSet(IDataSet iDataSet) throws EMFUserError{   
    GuiGenericDataSet ds = new GuiGenericDataSet();
    GuiDataSetDetail dsActiveDetail = null;

    if(iDataSet instanceof FileDataSet){   
      dsActiveDetail = new FileDataSetDetail();
      ((FileDataSetDetail)dsActiveDetail).setFileName(((FileDataSet)iDataSet).getFileName());   
      dsActiveDetail.setDsType(FILE_DS_TYPE);
    }

    if(iDataSet instanceof JDBCDataSet){     
      dsActiveDetail=new QueryDataSetDetail();
      ((QueryDataSetDetail)dsActiveDetail).setQuery((String)(((JDBCDataSet)iDataSet).getQuery()));
      IDataSource iDataSource=((JDBCDataSet)iDataSet).getDataSource();
      if(iDataSource!=null){
        String dataSourceLabel = iDataSource.getLabel();
        ((QueryDataSetDetail)dsActiveDetail).setDataSourceLabel(dataSourceLabel);
      }
      dsActiveDetail.setDsType(JDBC_DS_TYPE);
    }
   
    if(iDataSet instanceof QbeDataSet){     
      dsActiveDetail = new QbeDataSetDetail();
      QbeDataSetDetail aQbeDataSetDetail = (QbeDataSetDetail) dsActiveDetail;
      QbeDataSet aQbeDataSet = (QbeDataSet) iDataSet;
      aQbeDataSetDetail.setJsonQuery(aQbeDataSet.getJsonQuery());
      aQbeDataSetDetail.setDatamarts(aQbeDataSet.getDatamarts());
      IDataSource iDataSource = aQbeDataSet.getDataSource();
      if (iDataSource!=null){
        String dataSourceLabel = iDataSource.getLabel();
        aQbeDataSetDetail.setDataSourceLabel(dataSourceLabel);
      }
      dsActiveDetail.setDsType(QBE_DS_TYPE);
    }

    if(iDataSet instanceof WebServiceDataSet){     
      dsActiveDetail=new WSDataSetDetail();
      ((WSDataSetDetail)dsActiveDetail).setAddress(((WebServiceDataSet)iDataSet).getAddress());
      ((WSDataSetDetail)dsActiveDetail).setOperation(((WebServiceDataSet)iDataSet).getOperation());
      dsActiveDetail.setDsType(WS_DS_TYPE);
    }

    if(iDataSet instanceof ScriptDataSet){     
      dsActiveDetail=new ScriptDataSetDetail();
      ((ScriptDataSetDetail)dsActiveDetail).setScript(((ScriptDataSet)iDataSet).getScript());
      ((ScriptDataSetDetail)dsActiveDetail).setLanguageScript(((ScriptDataSet)iDataSet).getLanguageScript());
      dsActiveDetail.setDsType(SCRIPT_DS_TYPE);
    }

    if(iDataSet instanceof JavaClassDataSet){     
      dsActiveDetail=new JClassDataSetDetail();
      ((JClassDataSetDetail)dsActiveDetail).setJavaClassName(((JavaClassDataSet)iDataSet).getClassName());
      dsActiveDetail.setDsType(JCLASS_DS_TYPE);
    }

    ds.setDsId(iDataSet.getId());
    ds.setName(iDataSet.getName());
    ds.setLabel(iDataSet.getLabel());
    ds.setDescription(iDataSet.getDescription())

    // set detail dataset ID
    dsActiveDetail.setTransformerId((iDataSet.getTransformerId() == null)? null:iDataSet.getTransformerId());
    dsActiveDetail.setPivotColumnName(iDataSet.getPivotColumnName());
    dsActiveDetail.setPivotRowName(iDataSet.getPivotRowName());
    dsActiveDetail.setPivotColumnValue(iDataSet.getPivotColumnValue());
    dsActiveDetail.setNumRows(iDataSet.isNumRows());     
    dsActiveDetail.setParameters(iDataSet.getParameters());   
    dsActiveDetail.setDsMetadata(iDataSet.getDsMetadata());   

    ds.setActiveDetail(dsActiveDetail);

    return ds;
  }
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

   * @return the data set as genericGuiDataset
   * @throws EMFUserError the EMF user error
   */
  public GuiGenericDataSet loadDataSetById(Integer dsId)throws EMFUserError {
    logger.debug("IN");
    GuiGenericDataSet toReturn = null;

    Session aSession = null;
    Transaction tx = null;

    try {
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.bo.GuiGenericDataSet

   * @return the data set as genericGuiDataset
   * @throws EMFUserError the EMF user error
   */
  public GuiGenericDataSet loadDataSetByLabel(String dsLabel)throws EMFUserError {
    logger.debug("IN");
    GuiGenericDataSet toReturn = null;
    GuiDataSetDetail detail = null;

    Session aSession = null;
    Transaction tx = null;

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.