# MaterialDORowMapper.java

    package com.mycim.server.asm.dao.mapper;

    import com.mycim.framework.jdbc.mapper.RowMapper;
    import com.mycim.valueobject.inv.MaterialDO;

    import java.sql.ResultSet;
    import java.sql.SQLException;

    public class MaterialDORowMapper implements RowMapper<MaterialDO> {

        @Override
        public MaterialDO mapRow(ResultSet rs, int rowNum) throws SQLException {
            MaterialDO material = new MaterialDO();

            long longTemp;
            double doubleTemp;
            int intTemp;

            material.setItemRrn(rs.getLong("ITEM_RRN"));
            material.setItemExtendNumber(rs.getString("ITEM_EXTEND_NUMBER"));
            material.setItemClass(rs.getString("ITEM_CLASS"));

            longTemp = rs.getLong("DEFAULT_WAREHOUSE_RRN");
            material.setDefaultWarehouseRrn((longTemp == 0) ? null : new Long(longTemp));

            longTemp = rs.getLong("DEFAULT_LOCATION_RRN");
            material.setDefaultLocationRrn((longTemp == 0) ? null : new Long(longTemp));

            doubleTemp = rs.getDouble("OPENING_BALANCE");
            material.setOpeningBalance(new Double(doubleTemp));

            doubleTemp = rs.getDouble("RECEIPT_QTY");
            material.setReceiptQty(new Double(doubleTemp));

            doubleTemp = rs.getDouble("ISSUE_QTY");
            material.setIssueQty(new Double(doubleTemp));

            doubleTemp = rs.getDouble("ADJUST_QTY");
            material.setAdjustQty(new Double(doubleTemp));

            material.setStoreUom(rs.getString("STORE_UOM"));
            material.setPurchaseUom(rs.getString("PURCHASE_UOM"));
            material.setSalesUom(rs.getString("SALES_UOM"));

            material.setLotTrackingFlag(rs.getString("LOT_TRACKING_FLAG"));

            longTemp = rs.getLong("PRODUCT_FAMILY_RRN");
            material.setProductFamilyRrn((longTemp == 0) ? null : new Long(longTemp));

            material.setSubproductFlag(rs.getString("SUBPRODUCT_FLAG"));

            longTemp = rs.getLong("PRODUCT_ENGINEER_RRN");
            material.setProductEngineerRrn((longTemp == 0) ? null : new Long(longTemp));

            doubleTemp = rs.getDouble("HOLD_ON_LOW_YIELD");
            material.setHoldOnLowYield(new Double(doubleTemp));

            intTemp = rs.getInt("EXPIRATION_LENGTH");
            material.setExpirationLength(new Integer(intTemp));
            material.setExpirationAlarmId(rs.getString("EXPIRATION_ALARM_ID"));

            material.setWaferSize(rs.getString("WAFER_SIZE"));
            material.setMaskId(rs.getString("MASK_ID"));
            material.setItemOwner(rs.getString("ITEM_OWNER"));

            material.setQuantityOfWarning(rs.getDouble("QUANTITY_OF_WARNING"));

            return material;
        }

    }