当前位置: 首页>>代码示例>>Java>>正文


Java RowCallbackHandler类代码示例

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


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

示例1: getDomainDetails

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public DomainEntity getDomainDetails(String domainId) {
    DomainEntity domainEntity = new DomainEntity();
    jdbcTemplate.query(SqlDefine.sys_rdbms_084, new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet resultSet) throws SQLException {
            domainEntity.setDomain_id(domainId);
            domainEntity.setDomain_desc(resultSet.getString("domain_desc"));
            domainEntity.setDomain_status_desc(resultSet.getString("domain_status_desc"));
            domainEntity.setMaintance_date(resultSet.getString("maintance_date"));
            domainEntity.setCreate_user_id(resultSet.getString("create_user_id"));
            domainEntity.setDomain_modify_user(resultSet.getString("domain_modify_user"));
            domainEntity.setDomain_modify_date(resultSet.getString("domain_modify_date"));
        }
    }, domainId);
    return domainEntity;
}
 
开发者ID:hzwy23,项目名称:hauth-java,代码行数:18,代码来源:DomainDaoImpl.java

示例2: getInformationForUsers

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public Map<String, UserBean> getInformationForUsers(final Collection<String> userIds)
{
	String sql = config.getUserInfo();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Map<String, UserBean> users = new HashMap<String, UserBean>();
	handleIn(sql, userIds, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String username = set.getString(2);
			String fname = set.getString(3);
			String lname = set.getString(4);
			String email = set.getString(5);
			DefaultUserBean user = new DefaultUserBean(id, username, fname, lname, email);
			users.put(id, user);
		}
	});
	return users;
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:ReplicatedUserPlugin.java

示例3: getRolesForUser

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public Pair<ChainResult, Collection<RoleBean>> getRolesForUser(final String userID)
{
	String sql = config.getUserRoles();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Collection<RoleBean> roles = new ArrayList<RoleBean>();
	executeSql(sql, getParamValues(sql, userID), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.add(new DefaultRoleBean(id, name));
		}
	});
	return new Pair<ChainResult, Collection<RoleBean>>(ChainResult.CONTINUE, roles);
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:ReplicatedUserPlugin.java

示例4: searchRoles

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public Collection<RoleBean> searchRoles(final String query)
{
	String sql = config.getSearchRoles();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Collection<RoleBean> roles = new ArrayList<RoleBean>();
	executeSql(sql, getParamValues(sql, query.replace('*', '%')), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.add(new DefaultRoleBean(id, name));
		}
	});
	return roles;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:ReplicatedUserPlugin.java

示例5: getInformationForRoles

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public Map<String, RoleBean> getInformationForRoles(final Collection<String> roleIds)
{
	String sql = config.getRoleInfo();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Map<String, RoleBean> roles = Maps.newHashMapWithExpectedSize(roleIds.size());
	handleIn(sql, roleIds, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.put(id, new DefaultRoleBean(id, name));
		}
	});
	return roles;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:ReplicatedUserPlugin.java

示例6: authenticate

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
private UserInfo authenticate(String username)
{
	String sql = config.getAuthenticate();

	final UserInfo user = new UserInfo();
	executeSql(sql, getParamValues(sql, username), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			boolean suspended = set.getInt(3) > 0;
			if( suspended )
			{
				throw new DisabledException("User suspended");
			}
			String id = set.getString(1);
			String password = set.getString(2);

			user.setId(id);
			user.setPassword(password);
		}
	});
	return user;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:ReplicatedUserPlugin.java

示例7: getGroupInfo

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
private Map<String, GroupBean> getGroupInfo(Collection<String> ids)
{
	final Map<String, GroupBean> groupMap = new HashMap<String, GroupBean>();
	String sql = config.getGroupInfo();
	if( Check.isEmpty(sql) || Check.isEmpty(ids) )
	{
		return groupMap;
	}

	handleIn(sql, ids, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			GroupBean group = new DefaultGroupBean(id, name);
			groupMap.put(id, group);
		}
	});
	return groupMap;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:ReplicatedUserPlugin.java

示例8: loadBeanDefinitions

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
/**
 * Load bean definitions from the database via the given SQL string.
 * @param sql SQL query to use for loading bean definitions.
 * The first three columns must be bean name, property name and value.
 * Any join and any other columns are permitted: e.g.
 * {@code SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1}
 * It's also possible to perform a join. Column names are not significant --
 * only the ordering of these first three columns.
 */
public void loadBeanDefinitions(String sql) {
	Assert.notNull(this.jdbcTemplate, "Not fully configured - specify DataSource or JdbcTemplate");
	final Properties props = new Properties();
	this.jdbcTemplate.query(sql, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			String beanName = rs.getString(1);
			String property = rs.getString(2);
			String value = rs.getString(3);
			// Make a properties entry by combining bean name and property.
			props.setProperty(beanName + "." + property, value);
		}
	});
	this.propReader.registerBeanDefinitions(props);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JdbcBeanDefinitionReader.java

示例9: getJobList

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public List<GroupTaskEntity> getJobList(String groupId) {
    List<GroupTaskEntity> list = new ArrayList<>();
    jdbcTemplate.query(batchSqlText.getSql("sys_rdbms_133"), new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet resultSet) throws SQLException {
            GroupTaskEntity one = new GroupTaskEntity();
            one.setCodeNumber(resultSet.getString("code_number"));
            one.setDomainId(resultSet.getString("domain_id"));
            one.setGroupId(resultSet.getString("group_id"));
            one.setJobKey(resultSet.getString("job_key"));
            one.setPosTop(resultSet.getInt("pos_top"));
            one.setTaskId(resultSet.getString("task_id"));
            one.setTaskType(resultSet.getString("task_type"));
            one.setTaskTypeDesc(resultSet.getString("task_type_desc"));
            one.setTaskDesc(resultSet.getString("task_type_desc"));
            one.setPosLeft(resultSet.getInt("pos_left"));
            list.add(one);
        }
    }, groupId);
    logger.debug("group id is:{},result is:{}", groupId, list);
    return list;
}
 
开发者ID:hzwy23,项目名称:batch-scheduler,代码行数:24,代码来源:GroupTaskDaoImpl.java

示例10: testQueryWithRowCallbackHandlerNoParameters

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Test
public void testQueryWithRowCallbackHandlerNoParameters() throws SQLException {
	given(resultSet.next()).willReturn(true, false);
	given(resultSet.getInt("id")).willReturn(1);
	given(resultSet.getString("forename")).willReturn("rod");

	final List<Customer> customers = new LinkedList<Customer>();
	namedParameterTemplate.query(SELECT_NO_PARAMETERS, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			Customer cust = new Customer();
			cust.setId(rs.getInt(COLUMN_NAMES[0]));
			cust.setForename(rs.getString(COLUMN_NAMES[1]));
			customers.add(cust);
		}
	});

	assertEquals(1, customers.size());
	assertTrue("Customer id was assigned correctly", customers.get(0).getId() == 1);
	assertTrue("Customer forename was assigned correctly", customers.get(0).getForename().equals("rod"));
	verify(connection).prepareStatement(SELECT_NO_PARAMETERS);
	verify(preparedStatement).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:25,代码来源:NamedParameterJdbcTemplateTests.java

示例11: findOne

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public RegressionModel findOne(String id) {
  final List<RegressionModel> models = new ArrayList<>();
  jdbcTemplate.query(SELECT_MODEL.replaceFirst("@", id), new RowCallbackHandler() {
    
    @Override
    public void processRow(ResultSet rs) throws SQLException {
      RegressionModel m = new RegressionModel();
      try {
        m.deserializeClassifierFromJson(rs.getString(1));
        //m.setLongId(rs.getLong(2));
        m.setStringId(rs.getString(2));
        m.setGeneratedOn(rs.getDate(3).getTime());
        models.add(m);
      } catch (IOException e) {
        throw new SQLException("Unable to deserialze model from string", e);
      }
      
    }
  });
  return models.isEmpty() ? null : models.get(0);
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:23,代码来源:ModelJdbcRepository.java

示例12: findUserByUserName

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public UserInfo findUserByUserName(String userName) {
	// TODO Auto-generated method stub
	String sql = "select * from user_info where user_name = ?";
	final UserInfo user = new UserInfo();
	jdbcTemplate.query(sql, new Object[]{userName}, new RowCallbackHandler() {
		
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			// TODO Auto-generated method stub
			if (rs.next()) {
				user.setUserId(rs.getLong("user_id"));
				user.setUserName(rs.getString("user_name"));
			}
		}
	});
	
	if (user.getUserId() == 0) {
		return null;
	}
	
	return user;
}
 
开发者ID:hanwwh,项目名称:xqres,代码行数:24,代码来源:UserInfoDAOImpl.java

示例13: queryOrderItems

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public List<OrderItem> queryOrderItems() {
	// TODO Auto-generated method stub
	String sql = "SELECT * FROM ORDER_ITEM";
	final List<OrderItem> list = new ArrayList<OrderItem>();
	jdbcTemplate.query(sql, new RowCallbackHandler() {
		
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			// TODO Auto-generated method stub
			OrderItem item = new OrderItem();
			item.setItemId(rs.getLong("ITEM_ID"));
			item.setGroupId(rs.getLong("GROUP_ID"));
			item.setStatus(rs.getInt("STATUS"));
			item.setItemCode(rs.getString("ITEM_CODE"));
			item.setItemName(rs.getString("ITEM_NAME"));
			item.setItemPrice(rs.getFloat("ITEM_PRICE"));
			item.setCreateDate(rs.getTimestamp("CREATE_DATE"));
			item.setItemPicurl(rs.getString("ITEM_PICURL"));
			item.setItemDetails(rs.getString("ITEM_DETAILS"));
			list.add(item);
		}
	});
	
	return list;
}
 
开发者ID:hanwwh,项目名称:xqres,代码行数:27,代码来源:OrderItemDAOImpl.java

示例14: selectFoods

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public List<FoodInfo> selectFoods() {
	String sql = "select food_id, food_name, food_price from food_info";
	final List<FoodInfo> list = new ArrayList<FoodInfo>();
	jdbcTemplate.query(sql, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			FoodInfo info = new FoodInfo();
			info.setFoodId(rs.getLong("food_id"));
			info.setFoodName(rs.getString("food_name"));
			info.setFoodPrice(rs.getFloat("food_price"));
			list.add(info);
		}
	});

	return list;
}
 
开发者ID:hanwwh,项目名称:xqres,代码行数:18,代码来源:OrderItemDAOImpl.java

示例15: getOrganisationUnitDataSetAssocationMap

import org.springframework.jdbc.core.RowCallbackHandler; //导入依赖的package包/类
@Override
public Map<String, Set<String>> getOrganisationUnitDataSetAssocationMap()
{
    final String sql = "select ds.uid as ds_uid, ou.uid as ou_uid from datasetsource d " +
        "left join organisationunit ou on ou.organisationunitid=d.sourceid " +
        "left join dataset ds on ds.datasetid=d.datasetid";

    final SetMap<String, String> map = new SetMap<>();

    jdbcTemplate.query( sql, new RowCallbackHandler()
    {
        @Override
        public void processRow( ResultSet rs ) throws SQLException
        {
            String dataSetId = rs.getString( "ds_uid" );
            String organisationUnitId = rs.getString( "ou_uid" );
            map.putValue( organisationUnitId, dataSetId );
        }
    } );

    return map;
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:23,代码来源:HibernateOrganisationUnitStore.java


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