com.pactera.edg.am.metamanager.extractor.dao.helper.MetaModelMapper.java Source code

Java tutorial

Introduction

Here is the source code for com.pactera.edg.am.metamanager.extractor.dao.helper.MetaModelMapper.java

Source

/*
 * Copyright 2009 by pactera.edg.am Corporation. Address:HePingLi East Street No.11
 * 5-5, BeiJing,
 * 
 * All rights reserved.
 * 
 * This software is the confidential and proprietary information of pactera.edg.am
 * Corporation ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with pactera.edg.am.
 */

package com.pactera.edg.am.metamanager.extractor.dao.helper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;

import org.springframework.jdbc.core.RowMapper;

import com.pactera.edg.am.metamanager.extractor.bo.composite.MAttribute;

/**
 * ??
 * 
 * @author user
 * @version 1.0 Date: Jul 9, 2009
 * 
 */
public class MetaModelMapper implements RowMapper {

    private List<MAttribute> attrs;

    public MetaModelMapper(List<MAttribute> attrs) {
        this.attrs = attrs;
    }

    public Object mapRow(ResultSet arg0, int arg1) throws SQLException {
        // ???
        String attrName = arg0.getString("ATT_NAME");

        Iterator<MAttribute> attrsIter = attrs.iterator();
        while (attrsIter.hasNext()) {
            MAttribute mAttribute = attrsIter.next();
            if (mAttribute.getName().equals(attrName)) {
                // ?
                mAttribute.setStorePosition(arg0.getString("ATT_STORE"));
                // ???
                mAttribute.setDataType(arg0.getInt("DATATYPE"));
            }
        }
        return null;
    }

}