• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TableMetaData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.management.TableMetaData的典型用法代码示例。如果您正苦于以下问题:Java TableMetaData类的具体用法?Java TableMetaData怎么用?Java TableMetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TableMetaData类属于org.activiti.engine.management包,在下文中一共展示了TableMetaData类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: index

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@RequestMapping("")
public ModelAndView index(@RequestParam(value = "tableName", required = false) String tableName, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("chapter14/database");

    // 读取表
    Map<String, Long> tableCount = managementService.getTableCount();
    mav.addObject("tableCount", tableCount);

    // 读取表记录
    if (StringUtils.isNotBlank(tableName)) {
        TableMetaData tableMetaData = managementService.getTableMetaData(tableName);
        mav.addObject("tableMetaData", tableMetaData);
        Page<Map<String, Object>> page = new Page<Map<String, Object>>(10);
        int[] pageParams = PageUtil.init(page, request);
        TablePage tablePages = managementService.createTablePageQuery().tableName(tableName).listPage(pageParams[0], pageParams[1]);

        page.setResult(tablePages.getRows());
        page.setTotalCount(tableCount.get(tableName));
        mav.addObject("page", page);
    }
    return mav;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:23,代码来源:DatabaseController.java


示例2: testGetTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public void testGetTableMetaData() {
  
  String tablePrefix = processEngineConfiguration.getDatabaseTablePrefix();
  
  TableMetaData tableMetaData = managementService.getTableMetaData(tablePrefix+"ACT_RU_TASK");
  assertEquals(tableMetaData.getColumnNames().size(), tableMetaData.getColumnTypes().size());
  assertEquals(16, tableMetaData.getColumnNames().size());

  int assigneeIndex = tableMetaData.getColumnNames().indexOf("ASSIGNEE_");
  int createTimeIndex = tableMetaData.getColumnNames().indexOf("CREATE_TIME_");

  assertTrue(assigneeIndex >= 0);
  assertTrue(createTimeIndex >= 0);
  
  assertOneOf(new String [] {"VARCHAR", "NVARCHAR2", "nvarchar", "NVARCHAR"}, tableMetaData.getColumnTypes().get(assigneeIndex));
  assertOneOf(new String [] {"TIMESTAMP", "TIMESTAMP(6)", "datetime", "DATETIME"}, tableMetaData.getColumnTypes().get(createTimeIndex));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:18,代码来源:ManagementServiceTest.java


示例3: execute

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@Override
public TableMetaData execute(CommandContext commandContext) {
    if (tableName == null) {
        throw new ActivitiIllegalArgumentException("tableName is null");
    }
    return commandContext
            .getTableDataManager()
            .getTableMetaData(tableName);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:10,代码来源:GetTableMetaDataCmd.java


示例4: index

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@RequestMapping("")
public ModelAndView index(@RequestParam(value = "tableName", required = false) String tableName, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("chapter14/database");

    // 读取表
    Map<String, Long> tableCountUnSort = managementService.getTableCount();
    Map<String, Long> tableCount = new TreeMap<String, Long>(tableCountUnSort);

    /*
    添加自定义的表
     */
    tableCount.put("AIA_C17_LEAVE", activitiDao.countTableRows("AIA_C17_LEAVE"));

    mav.addObject("tableCount", tableCount);

    // 读取表记录
    if (StringUtils.isNotBlank(tableName)) {
        TableMetaData tableMetaData = managementService.getTableMetaData(tableName);
        mav.addObject("tableMetaData", tableMetaData);
        Page<Map<String, Object>> page = new Page<Map<String, Object>>(10);
        int[] pageParams = PageUtil.init(page, request);
        TablePage tablePages = managementService.createTablePageQuery().tableName(tableName).listPage(pageParams[0], pageParams[1]);

        page.setResult(tablePages.getRows());
        page.setTotalCount(tableCount.get(tableName));
        mav.addObject("page", page);
    }
    return mav;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:30,代码来源:DatabaseController.java


示例5: addTableData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
protected void addTableData() {
  LazyLoadingQuery lazyLoadingQuery = new TableDataQuery(tableName, managementService);
  LazyLoadingContainer lazyLoadingContainer = new LazyLoadingContainer(lazyLoadingQuery, 10);
  
  if (lazyLoadingContainer.size() > 0) {
    
    Table data = new Table();
    data.setContainerDataSource(lazyLoadingContainer);
    data.setEditable(false);
    data.setSelectable(true);
    data.setColumnReorderingAllowed(true);
    if (lazyLoadingQuery.size() < 10) {
      data.setPageLength(0);
    } else {
      data.setPageLength(10);
    }
    addDetailComponent(data);
    
    data.setWidth(100, UNITS_PERCENTAGE);
    data.setHeight(100, UNITS_PERCENTAGE);
    data.addStyleName(ExplorerLayout.STYLE_DATABASE_TABLE);
    setDetailExpandRatio(data, 1.0f);
    
    // Create column headers
    TableMetaData metaData = managementService.getTableMetaData(tableName);
    for (String columnName : metaData.getColumnNames()) {
      data.addContainerProperty(columnName, String.class, null);
    }
    
  } else {
    Label noDataLabel = new Label(i18nManager.getMessage(Messages.DATABASE_NO_ROWS));
    noDataLabel.addStyleName(Reindeer.LABEL_SMALL);
    addDetailComponent(noDataLabel);
    setDetailExpandRatio(noDataLabel, 1.0f);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:DatabaseDetailPanel.java


示例6: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public TableMetaData getTableMetaData(String tableName) {
  TableMetaData result = new TableMetaData();
  try {
    result.setTableName(tableName);
    DatabaseMetaData metaData = getDbSqlSession()
      .getSqlSession()
      .getConnection()
      .getMetaData();

    if ("postgres".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType())) {
      tableName = tableName.toLowerCase();
    }

    ResultSet resultSet = metaData.getColumns(null, null, tableName, null);
    while(resultSet.next()) {
      String name = resultSet.getString("COLUMN_NAME").toUpperCase();
      String type = resultSet.getString("TYPE_NAME").toUpperCase();
      result.addColumnMetaData(name, type);
    }
    
  } catch (SQLException e) {
    throw new ActivitiException("Could not retrieve database metadata: " + e.getMessage());
  }

  if(result.getColumnNames().size() == 0) {
    // According to API, when a table doesn't exist, null should be returned
    result = null;
  }
  return result;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:TableDataManager.java


示例7: execute

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public TableMetaData execute(CommandContext commandContext) {
  if(tableName == null) {
    throw new ActivitiException("tableName is null");
  }
  return commandContext
    .getTableDataManager()
    .getTableMetaData(tableName);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:9,代码来源:GetTableMetaDataCmd.java


示例8: testGetTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public void testGetTableMetaData() {
  TableMetaData tableMetaData = managementService.getTableMetaData("ACT_RU_TASK");
  assertEquals(tableMetaData.getColumnNames().size(), tableMetaData.getColumnTypes().size());
  assertEquals(15, tableMetaData.getColumnNames().size());

  int assigneeIndex = tableMetaData.getColumnNames().indexOf("ASSIGNEE_");
  int createTimeIndex = tableMetaData.getColumnNames().indexOf("CREATE_TIME_");

  assertTrue(assigneeIndex >= 0);
  assertTrue(createTimeIndex >= 0);
  
  assertOneOf(new String [] {"VARCHAR", "NVARCHAR2", "nvarchar", "NVARCHAR"}, tableMetaData.getColumnTypes().get(assigneeIndex));
  assertOneOf(new String [] {"TIMESTAMP", "TIMESTAMP(6)", "datetime", "DATETIME"}, tableMetaData.getColumnTypes().get(createTimeIndex));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:ManagementServiceTest.java


示例9: getTableData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@Get
public ObjectNode getTableData() {
  if(authenticate(SecuredResource.ADMIN) == false) return null;
  
  String tableName = (String) getRequest().getAttributes().get("tableName");
  int start = RequestUtil.getInteger(getQuery(), "start", 0);
  int size = RequestUtil.getInteger(getQuery(), "size", 10);
  String order = getQuery().getValues("order");
  if(order == null) {
    order = "asc";
  }
  String sort = getQuery().getValues("sort");

  if (sort == null) {
    TableMetaData tmd = ActivitiUtil.getManagementService().getTableMetaData(tableName);
    List<String> columnNames = tmd.getColumnNames();
    if (columnNames.size() > 0) {
      sort = columnNames.get(0);
    }
    else {
      sort = null;
    }
  }

  TablePageQuery query = ActivitiUtil.getManagementService()
    .createTablePageQuery()
    .tableName(tableName);
  if (sort != null) {
    if (order.equals("asc")) {
      query.orderAsc(sort);
    }
    else {
      query.orderDesc(sort);
    }
  }

  TablePage tablePage = query.listPage(start, size);
  
  ObjectNode responseJSON = new ObjectMapper().createObjectNode();
  responseJSON.put("sort", sort);
  responseJSON.put("order", order);
  responseJSON.put("start", tablePage.getFirstResult());
  responseJSON.put("size", tablePage.getSize());
  responseJSON.put("total", tablePage.getTotal());
  
  ArrayNode tableArray = new ObjectMapper().createArrayNode();
  
  for (Map<String, Object> row : tablePage.getRows()) {
    ObjectNode columnJSON = new ObjectMapper().createObjectNode();
    for (String name : row.keySet()) {
      if(row.get(name) instanceof byte[]) {
        columnJSON.put(name, ((byte[]) row.get(name)).length);
      } else if(row.get(name) instanceof Date) {
        columnJSON.put(name, RequestUtil.dateToString((Date) row.get(name)));
      } else {
        columnJSON.put(name, row.get(name).toString());
      }
    }
    tableArray.add(columnJSON);
  }
  
  responseJSON.put("data", tableArray);
  
  return responseJSON;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:66,代码来源:TableDataResource.java


示例10: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@Get
public TableMetaData getTableMetaData() {
  if(authenticate(SecuredResource.ADMIN) == false) return null;
  
  String tableName = (String) getRequest().getAttributes().get("tableName");
  if(tableName == null) {
    throw new ActivitiException("table name is required");
  }
  return ActivitiUtil.getManagementService().getTableMetaData(tableName);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:11,代码来源:TableResource.java


示例11: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@GET
@Path("/tables/{tableName}/columns")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public TableMetaData getTableMetaData(@PathParam("tableName") String tableName) {
    TableMetaData response = managementService.getTableMetaData(tableName);

    if (response == null) {
        throw new ActivitiObjectNotFoundException("Could not find a table with name '" + tableName + "'.", String.class);
    }
    return response;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:12,代码来源:ManagementService.java


示例12: execute

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public TableMetaData execute(CommandContext commandContext) {
  if(tableName == null) {
    throw new ActivitiIllegalArgumentException("tableName is null");
  }
  return commandContext
    .getTableDataManager()
    .getTableMetaData(tableName);
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:9,代码来源:GetTableMetaDataCmd.java


示例13: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public TableMetaData getTableMetaData(String tableName) {
    TableMetaData result = new TableMetaData();
    try {
        result.setTableName(tableName);
        DatabaseMetaData metaData = getDbSqlSession()
                .getSqlSession()
                .getConnection()
                .getMetaData();

        if ("postgres".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType())) {
            tableName = tableName.toLowerCase();
        }

        String catalog = null;
        if (getProcessEngineConfiguration().getDatabaseCatalog() != null && getProcessEngineConfiguration().getDatabaseCatalog().length() > 0) {
            catalog = getProcessEngineConfiguration().getDatabaseCatalog();
        }

        String schema = null;
        if (getProcessEngineConfiguration().getDatabaseSchema() != null && getProcessEngineConfiguration().getDatabaseSchema().length() > 0) {
            schema = getProcessEngineConfiguration().getDatabaseSchema();
        }

        ResultSet resultSet = metaData.getColumns(catalog, schema, tableName, null);
        while (resultSet.next()) {
            boolean wrongSchema = false;
            if (schema != null && schema.length() > 0) {
                for (int i = 0; i < resultSet.getMetaData().getColumnCount(); i++) {
                    String columnName = resultSet.getMetaData().getColumnName(i + 1);
                    if ("TABLE_SCHEM".equalsIgnoreCase(columnName) || "TABLE_SCHEMA".equalsIgnoreCase(columnName)) {
                        if (!schema.equalsIgnoreCase(resultSet.getString(resultSet.getMetaData().getColumnName(i + 1)))) {
                            wrongSchema = true;
                        }
                        break;
                    }
                }
            }

            if (!wrongSchema) {
                String name = resultSet.getString("COLUMN_NAME").toUpperCase();
                String type = resultSet.getString("TYPE_NAME").toUpperCase();
                result.addColumnMetaData(name, type);
            }
        }

    } catch (SQLException e) {
        throw new ActivitiException("Could not retrieve database metadata: " + e.getMessage());
    }

    if (result.getColumnNames().isEmpty()) {
        // According to API, when a table doesn't exist, null should be returned
        result = null;
    }
    return result;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:56,代码来源:TableDataManager.java


示例14: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
@Override
public TableMetaData getTableMetaData(String tableName) {
    return commandExecutor.execute(new GetTableMetaDataCmd(tableName));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ManagementServiceImpl.java


示例15: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public TableMetaData getTableMetaData(String tableName) {
  return commandExecutor.execute(new GetTableMetaDataCmd(tableName));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:4,代码来源:ManagementServiceImpl.java


示例16: testGetMetaDataForUnexistingTable

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
public void testGetMetaDataForUnexistingTable() {
  TableMetaData metaData = managementService.getTableMetaData("unexistingtable");
  assertNull(metaData);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:5,代码来源:ManagementServiceTest.java


示例17: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
/**
 * Gets the metadata (column names, column types, etc.) of a certain table. Returns null when no table exists with the given name.
 */
TableMetaData getTableMetaData(String tableName);
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ManagementService.java


示例18: getTableMetaData

import org.activiti.engine.management.TableMetaData; //导入依赖的package包/类
/**
 * Gets the metadata (column names, column types, etc.) of a certain table. 
 * Returns null when no table exists with the given name.
 */
TableMetaData getTableMetaData(String tableName);
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:6,代码来源:ManagementService.java



注:本文中的org.activiti.engine.management.TableMetaData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InternalAccessorFactory类代码示例发布时间:2022-05-23
下一篇:
Java IClassCoverage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap