# LotRunCardStepRowMapper.java

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

    import com.mycim.framework.jdbc.mapper.RowMapper;
    import com.mycim.valueobject.wip.LotRunCardStep;

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

    public class LotRunCardStepRowMapper implements RowMapper<LotRunCardStep> {

        LotRunCardStep lotRunCardStep;

        private static String secsToTime(long secs) {
            StringBuffer time = new StringBuffer();
            long temp = 0;

            if (secs < 0) {
                time.append("-");
                secs = -secs;
            }
            if((secs / 3600)<10){
                time.append("0").append(secs / 3600);
            }else {
                time.append(secs / 3600);
            }

            time.append(":");
            temp = secs % 3600 / 60;

            if (temp < 10) {
                time.append("0");
            }
            time.append(temp);
            time.append(":");
            temp = secs % 3600 % 60;

            if (temp < 10) {
                time.append("0");
            }
            time.append(secs % 3600 % 60);
            return time.toString();
        }

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

            lotRunCardStep.setRunCardRrn(rs.getLong("RUN_CARD_RRN"));
            lotRunCardStep.setStepSerialNo(rs.getInt("STEP_SERIAL_NO"));
            lotRunCardStep.setStepType(rs.getString("STEP_TYPE"));

            lotRunCardStep.setFlowSeq(rs.getString("FLOW_SEQ"));
            lotRunCardStep.setStepPath(rs.getString("STEP_PATH"));
            lotRunCardStep.setOperationRrn(rs.getLong("OPERATION_RRN"));

            lotRunCardStep.setProcessLocation(rs.getString("PROCESS_LOCATION"));
            lotRunCardStep.setFlipType(rs.getString("FLIP_TYPE"));
            lotRunCardStep.setStageId(rs.getString("STAGE_ID"));

            lotRunCardStep.setAreaId(rs.getString("AREA_ID"));

            lotRunCardStep.setCheckWithRecipeFlag(rs.getString("CHECK_WITH_RECIPE_FLAG"));
            lotRunCardStep.setEquipmentRrn(rs.getLong("EQUIPMENT_RRN"));
            lotRunCardStep.setEquipmentGroupRrn(rs.getLong("EQUIPMENT_GROUP_RRN"));
            lotRunCardStep.setReticleRrn(rs.getLong("RETICLE_RRN"));
            lotRunCardStep.setReticleGroupRrn(rs.getLong("RETICLE_GROUP_RRN"));

            lotRunCardStep.setRecipeId(rs.getString("RECIPE_ID"));
            lotRunCardStep.setRecipeRrn(rs.getLong("RECIPE_RRN"));

            lotRunCardStep.setUnitRrns(rs.getString("UNIT_RRNS"));
            lotRunCardStep.setMeasurementUnitRrns(rs.getString("MEASUREMENT_UNIT_RRNS"));

            lotRunCardStep.setPollutionLevel(rs.getString("POLLUTION_LEVEL"));

            lotRunCardStep.setOutParameterSetRrn(rs.getLong("OUT_PARAMETER_SET_RRN"));
            lotRunCardStep.setInParameterSetRrn(rs.getLong("IN_PARAMETER_SET_RRN"));

            lotRunCardStep.setComments(rs.getString("COMMENTS"));
            lotRunCardStep.setOperatorComments(rs.getString("OPERATOR_COMMENTS"));

            lotRunCardStep.setStartOfMainQtime(rs.getString("START_OF_MAIN_QTIME"));
            lotRunCardStep.setEndOfMainQtime(rs.getString("END_OF_MAIN_QTIME"));
            lotRunCardStep.setStartOfRcQtime(rs.getString("START_OF_RC_QTIME"));
            lotRunCardStep.setEndOfRcQtime(rs.getString("END_OF_RC_QTIME"));
            lotRunCardStep.setRouteRrn(rs.getLong("ROUTE_RRN"));
            lotRunCardStep.setTimeLimit(secsToTime(rs.getLong("TIMELIMIT")));
            lotRunCardStep.setModule(rs.getString("MODULE"));

            return lotRunCardStep;
        }

    }