Package it.eng.spagobi.commons.bo

Examples of it.eng.spagobi.commons.bo.Config


    IConfigDAO configDao = DAOFactory.getSbiConfigDAO();
    List lstConfigChecks = configDao.loadConfigParametersByProperties(PROP_NODE);
    logger.debug("checks found on db: " + lstConfigChecks.size());

    for(int i=0; i<lstConfigChecks.size(); i++){
      Config check = (Config)lstConfigChecks.get(i);
      if ((SpagoBIConstants.CHANGEPWD_CHANGE_FIRST).equals(check.getLabel()) && user.getDtLastAccess() == null){
        //if dtLastAccess isn't enhanced it represents the first login, so is necessary change the pwd
        logger.info("The pwd needs to activate!");
        toReturn = true;
        break;
      }

      if ((SpagoBIConstants.CHANGEPWD_EXPIRED_TIME).equals(check.getLabel()) &&
          user.getDtPwdEnd() != null && currentDate.compareTo(user.getDtPwdEnd()) >= 0){
        //check if the pwd is expiring, in this case it's locked.
        logger.info("The pwd is expiring... it should be changed");
        toReturn = true;
        break;
      }
      if ((SpagoBIConstants.CHANGEPWD_DISACTIVE_TIME).equals(check.getLabel())){
        //defines the end date for uselessness
        Date tmpEndForUnused = null;
        if (user.getDtLastAccess() != null){
          SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
          Calendar cal = Calendar.getInstance();
View Full Code Here


      throw new SerializationException("ConfigJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      Domain domain = null;
      Config config = (Config)o;
      DomainDAOHibImpl domainImpl = new DomainDAOHibImpl();
      if(config.getValueTypeId() != null){
        domain = domainImpl.loadDomainById(config.getValueTypeId());
      }
      result = new JSONObject();
      result.put(CONFIG_CODE, config.getLabel()); // BIOBJ_TYPE
      result.put(CONFIG_NAME, config.getName()); // BI Object types
     
      result.put(VALUE_ID, config.getId()); // ex. 1
      result.put(VALUE_CODE, config.getLabel()); // REPORT
      result.put(VALUE_NAME, config.getName()); // ex. Report
      result.put(VALUE_DECRIPTION, config.getDescription()); // Basic business intelligence objects type
      result.put(IS_ACTIVE, config.isActive());
      result.put(VALUE_CHECK, config.getValueCheck());
      result.put(VALUE_TYPE, domain != null ? domain.getValueCd() : "");
      result.put(CATEGORY, config.getCategory());
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
     
    }
View Full Code Here

   *
   * @return the corrispondent output <code>Config</code>
   */
  public Config toConfig(){

    Config config = new Config();
    config.setId(getId());
    config.setLabel(getLabel());
    config.setName(getName());
    config.setDescription(getDescription());
    config.setActive(isActive);
    config.setValueCheck(getValueCheck());
    config.setCategory(getCategory());
    SbiDomains tmpDom = getSbiDomains();
    if (tmpDom != null) {
      config.setValueTypeId(tmpDom.getValueId().intValue());
    }
    return config;
  }
View Full Code Here

  }

  public void doSave() {

    logger.debug("IN");
    Config config = null;
    Config configTemp = null;

    try {
      config = readConfig();
      configTemp = configDao.loadConfigParametersByLabel(config
          .getLabel());
    } catch (Throwable e) {
      logger.error("Exception occurred while saving config data", e);
      throw new SpagoBIServiceException(SERVICE_NAME,
          "Impossible to save config", e);
    }
    if (configTemp != null && !configTemp.getId().equals(config.getId())) {
      throw new SpagoBIServiceException(SERVICE_NAME,
          "Label already in use");
    }
    try {
      configDao.saveConfig(config);
View Full Code Here

    }
  }

  private Config readConfig() throws EMFUserError {
    logger.debug("IN");
    Config config = new Config();
    if (this.requestContainsAttribute("ID")) {
      config.setId(this.getAttributeAsInteger("ID"));
    }
    config.setLabel(this.getAttributeAsString("LABEL"));
    config.setName(this.getAttributeAsString("NAME"));
    config.setDescription(this.getAttributeAsString("DESCRIPTION"));
    config.setActive(this.getAttributeAsBoolean("IS_ACTIVE"));
    config.setValueCheck(this.getAttributeAsString("VALUE_CHECK"));
    config.setCategory(this.getAttributeAsString("CATEGORY"));
    if (this.requestContainsAttribute("VALUE_TYPE")) {
      DomainDAOHibImpl domain = new DomainDAOHibImpl();
      Domain dom = domain.loadDomainByCodeAndValue("PAR_TYPE", this
          .getAttributeAsString("VALUE_TYPE"));
      config.setValueTypeId(dom.getValueId());
    }

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

      List hibList = hibQuery.list();
      Iterator it = hibList.iterator();     
      while (it.hasNext()) {     
        SbiConfig hibMap = (SbiConfig) it.next()
        if (hibMap != null) {
          Config biMap = hibMap.toConfig()
          toReturn.add(biMap);
        }
      }
      tx.commit();
    }catch(HibernateException he){
View Full Code Here

   *
   * @see it.eng.spagobi.common.bo.dao.ISbiConfigDAO#loadConfigParametersById(integer)
   */
    public Config loadConfigParametersById(String id) throws Exception {
      logger.debug("IN");
      Config toReturn = null;
    Session tmpSession = null;
    Transaction tx = null;

    try {
      tmpSession = getSession();
View Full Code Here

   *
   * @see it.eng.spagobi.common.bo.dao.ISbiConfigDAO#loadConfigParametersById(string)
   */
    public Config loadConfigParametersByLabel(String label) throws Exception{
      logger.debug("IN");
      Config toReturn = null;
    Session tmpSession = null;
    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
View Full Code Here

    ArrayList toReturn = new ArrayList();
    List allConfig = loadAllConfigParameters();
    //filter with the 'prop' parameter
    Iterator it = allConfig.iterator();     
    while (it.hasNext()) {     
      Config tmpConf = (Config) it.next()
      if (tmpConf.isActive() && tmpConf.getLabel().startsWith(prop))
        toReturn.add(tmpConf);
    }
   
    return toReturn;
    }
View Full Code Here

          //getting days number for calculate new expiration date
          IConfigDAO configDao = DAOFactory.getSbiConfigDAO();
          List lstConfigChecks = configDao.loadConfigParametersByProperties("changepwd.expired_time");
          Date beginDate = new Date();
          if (lstConfigChecks.size() > 0){
            Config check = (Config)lstConfigChecks.get(0);           
            if (check.isActive()){
              //define the new expired date             
              Date endDate = null;
              SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
              Calendar cal = Calendar.getInstance();
              cal.set(beginDate.getYear()+1900, beginDate.getMonth(), beginDate.getDate());
              //adds n days (getted from db)
              cal.add(Calendar.DATE, Integer.parseInt(check.getValueCheck()));
              try{
                endDate = StringUtilities.stringToDate(sdf.format(cal.getTime()), DATE_FORMAT);
                logger.debug ("End Date for expiration calculeted: " + endDate);
                tmpUser.setDtPwdBegin(beginDate);
                tmpUser.setDtPwdEnd(endDate);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.commons.bo.Config

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.