Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.LazyDynaBean


  /**
   * 得到wincc的最终查询时间
   * */
  public static LazyDynaBean getHisQueryDate(String timeVar, Date queryDatePar)
  {
    LazyDynaBean bean = null;
    Calendar cal = Calendar.getInstance();
    cal.setTime(queryDatePar);
   
    int year = cal.get(Calendar.YEAR);
    int month = cal.get(Calendar.MONTH)+1;//month
    int day = cal.get(Calendar.DATE);
    int hour = cal.get(Calendar.HOUR_OF_DAY);//直接用Calendar.HOUR得到的是不正确,下午时间为2:00,而不是14:00
   
    cal.clear();//清空,最主要将分、秒都清空,因为查询不会涉及到分钟级
   
    Hashtable<String,Object> vars = new Hashtable<String,Object>();
    vars.put("year1", year);
    vars.put("month1", month);
    vars.put("day1", day);
    vars.put("hour1", hour);
   
    try{
      ScriptEvaluator.evalWithMVEL(timeVar,vars);
//      timeVar中设置时间范围[year1/month1/day1/hour1,year2/month2/day2/hour2]
      cal.set(Calendar.YEAR, (Integer)vars.get("year1"));
      cal.set(Calendar.MONTH, (Integer)vars.get("month1")-1);
      cal.set(Calendar.DATE, (Integer)vars.get("day1"));
      cal.set(Calendar.HOUR_OF_DAY, (Integer)vars.get("hour1"));
      Date start = cal.getTime();

      bean = new LazyDynaBean();
      bean.set("startTime", start);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
View Full Code Here


    }else{
      try {
        List<LazyDynaBean> beans = new ArrayList<LazyDynaBean>();
        List<String> groupNames = SchedulerProvider.scheduler.getJobGroupNames();
        for(String groupName:groupNames){
          LazyDynaBean bean = new LazyDynaBean();
          bean.set("groupName", groupName);
          bean.set("id", groupName);
          bean.set("text", groupName);
          Set<JobKey> jobKeys = SchedulerProvider.scheduler.getJobKeys(GroupMatcher.groupEquals(groupName));
          List<LazyDynaBean> jobs = new ArrayList<LazyDynaBean>();
          for(JobKey jobKey:jobKeys){
            LazyDynaBean job = new LazyDynaBean();
            job.set("id", jobKey.toString());
            job.set("text", jobKey.getName());
            job.set("group", jobKey.getGroup());
            job.set("leaf", true);
            JobDetail jobDetail = SchedulerProvider.scheduler.getJobDetail(jobKey);
            if(jobDetail!=null){
              job.set("description", jobDetail.getDescription());
            }else{
              job.set("description", "");
            }
            jobs.add(job);
          }
          bean.set("children", jobs);
          beans.add(bean);
View Full Code Here

      }else{
        try {
          List<LazyDynaBean> beans = new ArrayList<LazyDynaBean>();
          for(Trigger trigger:SchedulerProvider.scheduler.getTriggersOfJob(GetObjectString.string2JobKey(taskinfo.getId()))){
            TriggerKey triggerKey = trigger.getKey();
            LazyDynaBean bean = new LazyDynaBean();
            bean.set("triggerKey", triggerKey.toString());
            bean.set("name", triggerKey.getName());
            bean.set("group", triggerKey.getGroup());
            bean.set("description", trigger.getDescription());
            bean.set("previousFireTime", trigger.getPreviousFireTime());
            bean.set("nextFireTime", trigger.getNextFireTime());
            TriggerState trigState = SchedulerProvider.scheduler.getTriggerState(triggerKey);
            bean.set("trigState", trigState);
            beans.add(bean);
          }
          result.setSucceed();
          result.setData(beans);
        } catch (SchedulerException e) {
View Full Code Here

    if(collector==null){
      result.setFailed(POINTS_QUERY_ERROR);
    }else{
      result.setSucceed();
      int total = collector.getTotalHits();
      LazyDynaBean bean = new LazyDynaBean();
      bean.set("total", total);
      result.setData(bean);
      if (total > offsetno) {
        collector = LuceneSupport.firstSearch(offsetno+countno, null,q);
        if(collector!=null){
          ScoreDoc[] sds = collector.topDocs().scoreDocs;
          List<LazyDynaBean> queryResult = new ArrayList<LazyDynaBean>();
          for (int i = 0; i < countno && (offsetno + i) < total; i++) {
            int index = offsetno + i;
            ScoreDoc sd = sds[index];
            Document document = LuceneSupport.findDoc(sd.doc);
            LazyDynaBean rbean = new LazyDynaBean();
            LuceneSupport.convertDocument2Bean(rbean,document,true);
            queryResult.add(rbean);
          }
          bean.set("rows", queryResult);
        }
View Full Code Here

        public LazyDynaBean mapRow(ResultSet rs, int rowNum)
            throws SQLException {
          // TODO Auto-generated method stub
          String tableName = rs.getString(1);
          String colName = rs.getString(2);
          LazyDynaBean bean = new LazyDynaBean();
          bean.set("tableName", tableName);
          bean.set("colName", colName);
          return bean;
        }     
      });
      return beans;
    }
View Full Code Here

      e.printStackTrace();
    }
  }
 
  public static LazyDynaBean convert(Object obj){
    LazyDynaBean bean = new LazyDynaBean();
    convert(bean,obj);
    return bean;
  }
View Full Code Here

      return null;
    }
    List<LazyDynaBean> result = new ArrayList<LazyDynaBean>();
    for(Object obj:source){
      if(obj!=null){
        LazyDynaBean bean = new LazyDynaBean();
        convert(bean,obj);
        result.add(bean);
      }
    }
    return result;
View Full Code Here

            List<LazyDynaBean> result = new ArrayList<LazyDynaBean>();
              for(Object obj:objList){
                try {
            Map map = BeanUtils.describe(obj);
            Set keySet = map.keySet();
            LazyDynaBean bean = new LazyDynaBean();
            for (Iterator iter = keySet.iterator(); iter.hasNext();) {
                Object element = (Object) iter.next();
                bean.set(element.toString(),map.get(element));
            }
            result.add(bean);
          } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

//            sheetNames.add(table.attr("title"));
//          }else{
//            sheetNames.add("");
//          }
//        }
        LazyDynaBean bean = new LazyDynaBean();
//        bean.set("sheetNames", sheetNames);
        try {
          BeanUtils.populate(bean, parameterMap);
        } catch (IllegalAccessException e) {
          // TODO Auto-generated catch block
View Full Code Here

        ReportTemplate reportTemplate = new ReportTemplate();
        try {
          BeanUtils.populate(reportTemplate, properties);
          reportTemplate.setId(MyUUIDGen.getUUID());
          reportTemplateDAO.merge(reportTemplate);
          LazyDynaBean bean = new LazyDynaBean();
          bean.set("id", reportTemplate.getId());
          bean.set("name", reportTemplate.getName());
          result.setData(bean);
          result.setSucceed();
        } catch (IllegalAccessException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          result.setFailed(e.getMessage());
        } catch (InvocationTargetException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          result.setFailed(e.getMessage());
        }
      }else if("file.save".equals(action)){
        if(id!=null){
          ReportTemplate reportTemplate = reportTemplateDAO.findById(id);
          if(reportTemplate!=null){
            try {
              BeanUtils.populate(reportTemplate, properties);
              reportTemplateDAO.merge(reportTemplate);
              LazyDynaBean bean = new LazyDynaBean();
              bean.set("id", reportTemplate.getId());
              bean.set("name", reportTemplate.getName());
              result.setData(bean);
              result.setSucceed();
            } catch (IllegalAccessException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.LazyDynaBean

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.