Package com.jfinal.plugin.activerecord

Examples of com.jfinal.plugin.activerecord.Record


            map = BeanUtils.describe(sysLog);
            map.remove("class");
        } catch (Exception e) {
            e.printStackTrace();
        }
        Record record = new Record();
        record.setColumns(map);
        System.out.println(record);
//        Db.save("syslog", record);
    }
View Full Code Here


        }
    }

    @SuppressWarnings("unchecked")
    public static Record toRecord(DBObject dbObject) {
        Record record = new Record();
        record.setColumns(dbObject.toMap());
        return record;
    }
View Full Code Here

        PageInfo pageInfo = new PageInfo();
        String modelName = StrKit.firstCharToLowerCase(modelClass.getSimpleName());
        pageInfo.setPageNumber(controller.getParaToInt("pageNumber", 1));
        pageInfo.setPageSize(controller.getParaToInt("pageSize", PageInfo.DEFAULT_PAGE_SIZE));
        modelNames.add(modelName);
        modelAttrs.put(modelName, new Record());
        for (RelationInfo relationInfo : relations) {
            String tableName = TableMapping.me().getTable(relationInfo.getModel()).getName();
            modelNames.add(tableName);
            modelAttrs.put(StrKit.firstCharToLowerCase(relationInfo.getModel().getSimpleName()), new Record());
        }

        Map<String, String[]> parasMap = controller.getRequest().getParameterMap();
        for (Entry<String, String[]> e : parasMap.entrySet()) {
            String paraKey = e.getKey();
View Full Code Here

    protected final static Logger logger = Logger.getLogger(ModelKit.class);

    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static Record toRecord(Model model) {
        Record record = new Record();
        Set<Entry<String, Object>> attrs = model.getAttrsEntrySet();
        for (Entry<String, Object> entry : attrs) {
            record.set(entry.getKey(), entry.getValue());
        }
        return record;
    }
View Full Code Here

        }
    }

    private static void processAsRecord(String[] columns, HSSFRow row, Object obj) {
        HSSFCell cell;
        Record record = (Record) obj;
        Map<String, Object> map = record.getColumns();
        if (columns.length == 0) {// 未设置显示列,默认全部
            record.getColumns();
            Set<String> keys = map.keySet();
            int columnIndex = 0;
            for (String key : keys) {
                cell = row.createCell(columnIndex);
                cell.setCellValue(record.get(key) + "");
                columnIndex++;
            }
        } else {
            for (int j = 0, lenJ = columns.length; j < lenJ; j++) {
                cell = row.createCell(j);
View Full Code Here

                    }
                    strOut = strOut.deleteCharAt(strOut.length() - 1);
                    strOut.append("\n");
                }
            } else if (obj instanceof Record) {
                Record objrecord = (Record) obj;
                Map<String, Object> map = objrecord.getColumns();
                if (null == columns || columns.isEmpty()) { // 如果没有限制,默认全部显示
                    Set<String> keys = map.keySet();
                    for (String key : keys) {
                        createCol(strOut, objrecord.get(key));
                        strOut.append(",");
                    }
                    strOut = strOut.deleteCharAt(strOut.length() - 1);
                    strOut.append("\n");
                } else {
                    for (int i = 0; i < columns.size(); i++) {
                        createCol(strOut, objrecord.get(columns.get(i) + ""));
                        strOut.append(",");
                    }
                    strOut = strOut.deleteCharAt(strOut.length() - 1);
                    strOut.append("\n");
                }
View Full Code Here

    }

    public void record() {
        List<Object> data = Lists.newArrayList();
        for (int i = 0; i < 5; i++) {
            Record record = new Record();
            Map<String, Object> map = getMap(i);
            record.setColumns(map);
            data.add(record);
        }
        render(PoiRender.me(data).headers(headers2));
    }
View Full Code Here

        render(JxlsRender.me(templateFileName));
    }
   

    public void record() {
        Record record = new Record();
        record.set("name", "Derek");
        record.set("age", 35);
        record.set("payment", 3000);
        record.set("bonus", 0.30);
        Record record2 = new Record();
        record2.set("name", "Oleg");
        record2.set("age", 32);
        record2.set("payment", 2300);
        record2.set("bonus", 0.25);
        List<Record> records  = new ArrayList<Record>();
        records.add(record);
        records.add(record2);
        Map<String, Object> beans = new HashMap<String, Object>();
        beans.put("employee", records);
View Full Code Here

    int columnCount = rsmd.getColumnCount();
    String[] labelNames = new String[columnCount + 1];
    int[] types = new int[columnCount + 1];
    buildLabelNamesAndTypes(rsmd, labelNames, types);
    for (int k=0; k<pageSize && rs.next(); k++) {
      Record record = new Record();
      Map<String, Object> columns = record.getColumns();
      for (int i=1; i<=columnCount; i++) {
        Object value;
        if (types[i] < Types.BLOB)
          value = rs.getObject(i);
        else if (types[i] == Types.CLOB)
View Full Code Here

    Controller ctrl=ai.getController();
    ctrl.setAttr("root","");
    ctrl.setAttr("StaticCfg", new StaticCfg());
//    Record po= (Record)ctrl.getSessionAttr("manager");
    String sid=ctrl.getSession().getId();
    Record po=(Record)MemcacheTool.mcc.get(sid);
    if(po==null){
      /*String ckey=ai.getControllerKey();
      if(ckey.contains("webadmin")){
        ctrl.redirect(ctrl.getRequest().getContextPath()+"/webadmin");
      }else*/
 
View Full Code Here

TOP

Related Classes of com.jfinal.plugin.activerecord.Record

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.