Package it.eng.spagobi.behaviouralmodel.lov.metadata

Examples of it.eng.spagobi.behaviouralmodel.lov.metadata.SbiLov


      return;
    }
    Iterator it = lovsList.iterator();
    while (it.hasNext()) {
      SourceBean aLovsSB = (SourceBean) it.next();
      SbiLov aLov = new SbiLov();
      aLov.setLabel((String) aLovsSB.getAttribute("label"));
      aLov.setName((String) aLovsSB.getAttribute("name"));
      aLov.setDescr((String) aLovsSB.getAttribute("descr"));
      aLov.setDefaultVal((String) aLovsSB.getAttribute("defaultVal"));
      aLov.setProfileAttr((String) aLovsSB.getAttribute("profileAttr"));

      SourceBean lovProviderSB = (SourceBean) aLovsSB.getAttribute("LOV_PROVIDER");
      aLov.setLovProvider(lovProviderSB.getCharacters());

      String inputTypeCd = (String) aLovsSB.getAttribute("inputTypeCd");
      SbiDomains domainInputType = findDomain(aSession, inputTypeCd, "INPUT_TYPE");
      aLov.setInputType(domainInputType);
      aLov.setInputTypeCd(inputTypeCd);

      logger.debug("Inserting Lov with label = [" + aLovsSB.getAttribute("label") + "] ...");

      aSession.save(aLov);
    }
View Full Code Here


      hibParuse.setDescr(aParameterUse.getDescription());
      hibParuse.setSelectionType(aParameterUse.getSelectionType());
      hibParuse.setMultivalue(aParameterUse.isMultivalue()? new Integer(1): new Integer(0));
      hibParuse.setManualInput(aParameterUse.getManualInput());

      SbiLov hibSbiLov = (SbiLov)aSession.load(SbiLov.class, aParameterUse.getIdLov());
      //if the lov id is 0 (-1) then the modality is manual input
      //insert into the DB a null lov_id
      //if the user selected modality is manual input,and before it was a
      //lov, we don't need a lov_id and so we can delete it
      if(hibSbiLov.getLovId().intValue()== -1 || aParameterUse.getManualInput().intValue() == 1){
        hibParuse.setSbiLov(null);
      }
      else{
        hibParuse.setSbiLov(hibSbiLov);}
View Full Code Here

      // Set the relation with parameter
      SbiParameters hibParameters = (SbiParameters)aSession.load(SbiParameters.class, aParameterUse.getId());
      hibParuse.setSbiParameters(hibParameters);

      // Set the relation with idLov
      SbiLov hibLov = (SbiLov)aSession.load(SbiLov.class, aParameterUse.getIdLov());
      //if the lov id is 0 (-1) then the modality is manual input
      //insert into the DB a null lov_id
      if(hibLov.getLovId().intValue()== -1)
      {hibParuse.setSbiLov(null);
      }
      else{
        hibParuse.setSbiLov(hibLov);}
View Full Code Here

      }
   
     
      if(parUseAssociated.size() == 1) {
        SbiParuse hibParuse = (SbiParuse)parUseAssociated.get(0);
        SbiLov sbiLov = hibParuse.getSbiLov();
       
        //if modval is null, then the parameter always has a man_in modality
        //force the man_in modality to the parameter
        Integer man_in = hibParuse.getManualInput();
        //Integer sbiLovId = sbiLov.getLovId();
View Full Code Here

   * @return the new hibernate lov object
   */
  public static SbiLov makeNewSbiLov(SbiLov lov,
      HashMap<String, String> dsExportUser){
    logger.debug("IN");
    SbiLov newlov = new SbiLov();
    newlov.setDefaultVal(lov.getDefaultVal());
    newlov.setDescr(lov.getDescr());
    newlov.setInputType(lov.getInputType());
    newlov.setInputTypeCd(lov.getInputTypeCd());
    newlov.setLabel(lov.getLabel());
    newlov.setLovProvider(lov.getLovProvider());
    newlov.setName(lov.getName());
    newlov.setProfileAttr(lov.getProfileAttr());

    try {
      // if user has associated another datasource then set the associated one, else put the same
      QueryDetail queryDetail=new QueryDetail(lov.getLovProvider());
      String dataSource=queryDetail.getDataSource();
      if(dsExportUser!=null && dsExportUser.get(dataSource)!=null){
        String newDs=dsExportUser.get(dataSource);
        queryDetail.setDataSource(newDs);
      } else {
        queryDetail.setDataSource(dataSource);
      }
      newlov.setLovProvider(queryDetail.toXML());       
    }
    catch (Exception e) {
      logger.error("error in reading the xml of lov provider; transcribe the original by default ");   
    }
    if(newlov.getLovProvider() == null){
      newlov.setLovProvider(lov.getLovProvider());
    }

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

   *
   * @return the new hibernate lov object
   */
  public static SbiLov makeNewSbiLov(SbiLov lov, Integer id, Map user){
    logger.debug("IN");
    SbiLov newlov = makeNewSbiLov(lov, null);
    newlov.setLovId(id);
    logger.debug("OUT");
    return newlov;
  }
View Full Code Here

   *
   * @throws EMFUserError    */
  public static SbiLov modifyExistingSbiLov(SbiLov exportedLov,
      Session sessionCurrDB, Integer existingId, HashMap<String, String> dsExportUser) {
    logger.debug("IN");
    SbiLov existingLov = null;
    try {
      existingLov = (SbiLov) sessionCurrDB.load(SbiLov.class, existingId);
      existingLov.setDefaultVal(exportedLov.getDefaultVal());
      existingLov.setDescr(exportedLov.getDescr());
      existingLov.setLabel(exportedLov.getLabel());

      try {
        // if user has associated another datasource then set the associated one, else put the same
        QueryDetail queryDetail=new QueryDetail(exportedLov.getLovProvider());
        String dataSource=queryDetail.getDataSource();
        if(dsExportUser!=null && dsExportUser.get(dataSource)!=null){
          String newDs=dsExportUser.get(dataSource);
          queryDetail.setDataSource(newDs);
        } else {
          queryDetail.setDataSource(dataSource);
        }

        existingLov.setLovProvider(queryDetail.toXML());       
      }
      catch (Exception e) {
        logger.error("error in reading the xml of lov provider; transcribe the original by default ");   
        existingLov.setLovProvider(exportedLov.getLovProvider());
      }

      existingLov.setName(exportedLov.getName());
      existingLov.setProfileAttr(exportedLov.getProfileAttr());
    } finally {
      logger.debug("OUT");
    }
    return existingLov;
  }
View Full Code Here

   *
   * @throws EMFUserError
   */
  private void importLovs(boolean overwrite) throws EMFUserError {
    logger.debug("IN");
    SbiLov exportedLov = null;
    try {
      List exportedLovs = importer.getAllExportedSbiObjects(sessionExpDB, "SbiLov", null);
      Iterator iterSbiLovs = exportedLovs.iterator();
      while (iterSbiLovs.hasNext()) {
        exportedLov = (SbiLov) iterSbiLovs.next();
        Integer oldId = exportedLov.getLovId();
        Integer existingLovId = null;
        Map lovIdAss = metaAss.getLovIDAssociation();
        Set lovIdAssSet = lovIdAss.keySet();
        if (lovIdAssSet.contains(oldId) && !overwrite) {
          metaLog.log("Exported lov " + exportedLov.getName() + " not inserted"
              + " because it has the same label of an existing lov");
          continue;
        } else {
          existingLovId = (Integer) lovIdAss.get(oldId);
        }
        if (existingLovId != null) {
          logger.info("The lov with label:[" + exportedLov.getLabel() + "] is just present. It will be updated.");
          metaLog.log("The lov with label = [" + exportedLov.getLabel() + "] will be updated.");
          SbiLov existinglov = ImportUtilities.modifyExistingSbiLov(exportedLov, sessionCurrDB, existingLovId, getUserAssociation().getDsExportedToUserLabel());
          ImportUtilities.associateWithExistingEntities(existinglov, exportedLov, sessionCurrDB, importer, metaAss);
          sessionCurrDB.update(existinglov);
        } else {
          SbiLov newlov = ImportUtilities.makeNewSbiLov(exportedLov, getUserAssociation().getDsExportedToUserLabel());
          ImportUtilities.associateWithExistingEntities(newlov, exportedLov, sessionCurrDB, importer, metaAss);
          sessionCurrDB.save(newlov);
          metaLog.log("Inserted new lov " + newlov.getName());
          Integer newId = newlov.getLovId();
          metaAss.insertCoupleLov(oldId, newId);
        }
      }
    } catch (Exception e) {
      if (exportedLov != null) {
View Full Code Here

        if (newParamId != null) {
          SbiParameters newParam = ImportUtilities.makeNewSbiParameter(param, newParamId);
          paruse.setSbiParameters(newParam);
        }

        SbiLov lov = paruse.getSbiLov();
        if (lov != null) {
          Integer oldLovId = lov.getLovId();
          Map assLovs = metaAss.getLovIDAssociation();
          Integer newLovId = (Integer) assLovs.get(oldLovId);
          if (newLovId != null) {
            SbiLov newlov = ImportUtilities.makeNewSbiLov(lov, newLovId, null);
            paruse.setSbiLov(newlov);
          }
        }

        Integer oldId = paruse.getUseId();
View Full Code Here

      }
    }
    List exportedLov = importer.getAllExportedSbiObjects(sessionExpDB, "SbiLov", null);
    Iterator iterSbiLov = exportedLov.iterator();
    while (iterSbiLov.hasNext()) {
      SbiLov lovExp = (SbiLov) iterSbiLov.next();
      String label = lovExp.getLabel();
      Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiLov());
      if (existObj != null) {
        SbiLov lovCurr = (SbiLov) existObj;
        metaAss.insertCoupleLov(lovExp.getLovId(), lovCurr.getLovId());
        metaAss.insertCoupleLov(lovExp, lovCurr);
        metaLog.log("Found an existing Lov " + lovCurr.getName() + " with "
            + "the same label of the exported lov " + lovExp.getName());
      }
    }
    List exportedFunct = importer.getAllExportedSbiObjects(sessionExpDB, "SbiFunctions", null);
    Iterator iterSbiFunct = exportedFunct.iterator();
View Full Code Here

TOP

Related Classes of it.eng.spagobi.behaviouralmodel.lov.metadata.SbiLov

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.