Example usage for java.sql ResultSet getBoolean

List of usage examples for java.sql ResultSet getBoolean

Introduction

In this page you can find the example usage for java.sql ResultSet getBoolean.

Prototype

boolean getBoolean(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

Usage

From source file:com.sfs.whichdoctor.dao.QualificationDAOImpl.java

/**
 * Load the qualification bean from the result set.
 *
 * @param rs the rs// w  w  w  . j  a va2  s  . co m
 * @return the qualification bean
 * @throws SQLException the sQL exception
 */
private QualificationBean loadQualification(final ResultSet rs) throws SQLException {

    QualificationBean qualification = new QualificationBean();

    qualification.setId(rs.getInt("QualificationId"));
    qualification.setGUID(rs.getInt("GUID"));
    qualification.setReferenceGUID(rs.getInt("ReferenceGUID"));
    qualification.setQualification(rs.getString("Qualification"));
    qualification.setQualificationType(rs.getString("QualificationType"));
    qualification.setQualificationSubType(rs.getString("QualificationSubType"));
    qualification.setInstitution(rs.getString("Institution"));
    qualification.setHonor(rs.getString("Honor"));
    qualification.setYear(rs.getInt("Year"));
    qualification.setCountry(rs.getString("Country"));

    qualification.setActive(rs.getBoolean("Active"));
    try {
        qualification.setCreatedDate(rs.getTimestamp("CreatedDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error loading CreatedDate: " + sqe.getMessage());
    }
    qualification.setCreatedBy(rs.getString("CreatedBy"));
    try {
        qualification.setModifiedDate(rs.getTimestamp("ModifiedDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error loading ModifiedDate: " + sqe.getMessage());
    }
    qualification.setModifiedBy(rs.getString("ModifiedBy"));

    return qualification;
}

From source file:com.alfaariss.oa.authentication.remote.saml2.idp.storage.jdbc.IDPJDBCStorage.java

private SAML2IDP retrieveByID(String id) throws OAException {
    Connection connection = null;
    PreparedStatement pSelect = null;
    ResultSet resultSet = null;
    SAML2IDP saml2IDP = null;// w  w w  . j a  va 2s . com

    IMetadataProviderManager oMPM = MdMgrManager.getInstance().getMetadataProviderManager(_sId);

    try {
        connection = _dataSource.getConnection();

        pSelect = connection.prepareStatement(_sQuerySelectOnID);
        pSelect.setBoolean(1, true);
        pSelect.setString(2, id);
        resultSet = pSelect.executeQuery();
        if (resultSet.next()) {
            boolean bACSIndex = resultSet.getBoolean(COLUMN_ACS_INDEX);

            Boolean boolAllowCreate = null;
            String sAllowCreate = resultSet.getString(COLUMN_ALLOW_CREATE);
            if (sAllowCreate != null) {
                boolean bAllowCreate = resultSet.getBoolean(COLUMN_ALLOW_CREATE);
                boolAllowCreate = new Boolean(bAllowCreate);
            }

            boolean bScoping = resultSet.getBoolean(COLUMN_SCOPING);
            boolean bNameIDPolicy = resultSet.getBoolean(COLUMN_NAMEIDPOLICY);
            boolean bAvoidSubjectConfirmation = resultSet.getBoolean(COLUMN_AVOID_SUBJCONF);
            boolean bDisableSSOForIDP = resultSet.getBoolean(COLUMN_DISABLE_SSO);

            Date dLastModified = null;
            try {
                dLastModified = resultSet.getTimestamp(COLUMN_DATELASTMODIFIED);
            } catch (Exception e) {
                _oLogger.info(
                        "No " + COLUMN_DATELASTMODIFIED + " column found for SAML2IDP '" + id + "'; ignoring.");
            }

            saml2IDP = new SAML2IDP(id, resultSet.getBytes(COLUMN_SOURCEID),
                    resultSet.getString(COLUMN_FRIENDLYNAME), resultSet.getString(COLUMN_METADATA_FILE),
                    resultSet.getString(COLUMN_METADATA_URL), resultSet.getInt(COLUMN_METADATA_TIMEOUT),
                    bACSIndex, boolAllowCreate, bScoping, bNameIDPolicy,
                    resultSet.getString(COLUMN_NAMEIDFORMAT), bAvoidSubjectConfirmation, bDisableSSOForIDP,
                    dLastModified, oMPM.getId());
        }
    } catch (OAException e) {
        throw e;
    } catch (Exception e) {
        _oLogger.fatal("Internal error during retrieval of organization with ID: " + id, e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    } finally {
        try {
            if (pSelect != null)
                pSelect.close();
        } catch (Exception e) {
            _oLogger.error("Could not close select statement", e);
        }

        try {
            if (connection != null)
                connection.close();
        } catch (Exception e) {
            _oLogger.error("Could not close connection", e);
        }
    }
    return saml2IDP;
}

From source file:com.mirth.connect.donkey.test.util.TestUtils.java

public static boolean isMessageProcessed(String channelId, long messageId) throws SQLException {
    long localChannelId = ChannelController.getInstance().getLocalChannelId(channelId);
    Connection connection = null;
    PreparedStatement statement = null;
    ResultSet result = null;

    try {/*from  w ww  .  j a  v a 2 s.  c o  m*/
        connection = getConnection();
        statement = connection.prepareStatement("SELECT processed FROM d_m" + localChannelId + " WHERE id = ?");
        statement.setLong(1, messageId);
        result = statement.executeQuery();
        result.next();
        return result.getBoolean("processed");
    } finally {
        close(result);
        close(statement);
        close(connection);
    }
}

From source file:com.sfs.whichdoctor.dao.ProjectDAOImpl.java

/**
 * Load the project bean from the result set.
 *
 * @param rs the rs//from w  w w  . jav a  2  s  .  c  o m
 * @return the project bean
 * @throws SQLException the sQL exception
 */
private ProjectBean loadProject(final ResultSet rs) throws SQLException {

    ProjectBean project = new ProjectBean();

    project.setId(rs.getInt("ProjectId"));
    project.setGUID(rs.getInt("GUID"));
    project.setReferenceGUID(rs.getInt("ReferenceGUID"));
    project.setAssessmentType(rs.getString("AssessmentType"));
    project.setAssessmentTypeAbbr(rs.getString("AssessmentTypeAbbr"));
    project.setProjectType(rs.getString("ProjectType"));
    project.setProjectTypeAbbr(rs.getString("ProjectTypeAbbr"));
    project.setStatus(rs.getString("Status"));
    project.setYear(rs.getInt("Year"));
    project.setAllOfProgram(rs.getBoolean("AllOfProgram"));
    project.setTitle(rs.getString("Title"));
    project.setMemo(rs.getString("Memo"));
    try {
        project.setSubmitted(rs.getDate("Submitted"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error reading Submitted: " + sqe.getMessage());
    }
    try {
        project.setResubmitted(rs.getDate("Resubmitted"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error reading Resubmitted: " + sqe.getMessage());
    }
    int assessorId1 = rs.getInt("AssessorId1");
    if (assessorId1 > 0) {
        try {
            /* Load person related to assessorId 1 */
            PersonBean person = this.personDAO.loadGUID(assessorId1);
            project.setAssessor1(person);
        } catch (Exception e) {
            dataLogger.error("Could not load PersonBean for Project");
        }
    }
    int assessorId2 = rs.getInt("AssessorId2");
    if (assessorId2 > 0) {
        try {
            /* Load person related to assessorId 2 */
            PersonBean person = this.personDAO.loadGUID(assessorId2);
            project.setAssessor2(person);
        } catch (Exception e) {
            dataLogger.error("Could not load PersonBean for Project");
        }
    }
    int assessorId3 = rs.getInt("AssessorId3");
    if (assessorId3 > 0) {
        try {
            /* Load person related to assessorId 3 */
            PersonBean person = this.personDAO.loadGUID(assessorId3);
            project.setAssessor3(person);
        } catch (Exception e) {
            dataLogger.error("Could not load PersonBean for Project");
        }
    }

    project.setTrainingOrganisation(rs.getString("TrainingOrganisation"));
    project.setTrainingProgram(rs.getString("TrainingProgram"));
    project.setTrainingProgramISBMapping(rs.getString("TrainingProgramISBMapping"));

    project.setActive(rs.getBoolean("Active"));
    try {
        project.setCreatedDate(rs.getTimestamp("CreatedDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error reading CreatedDate: " + sqe.getMessage());
    }
    project.setCreatedBy(rs.getString("CreatedBy"));
    try {
        project.setModifiedDate(rs.getTimestamp("ModifiedDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error reading ModifiedDate: " + sqe.getMessage());
    }
    project.setModifiedBy(rs.getString("ModifiedBy"));
    try {
        project.setExportedDate(rs.getTimestamp("ExportedDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error reading ExportedDate: " + sqe.getMessage());
    }
    project.setExportedBy(rs.getString("ExportedBy"));

    // Load user details from DB
    UserBean user = new UserBean();
    user.setDN(rs.getString("CreatedBy"));
    user.setPreferredName(rs.getString("CreatedFirstName"));
    user.setLastName(rs.getString("CreatedLastName"));
    project.setCreatedUser(user);

    UserBean modified = new UserBean();
    modified.setDN(rs.getString("ModifiedBy"));
    modified.setPreferredName(rs.getString("ModifiedFirstName"));
    modified.setLastName(rs.getString("ModifiedLastName"));
    project.setModifiedUser(modified);

    UserBean export = new UserBean();
    export.setDN(rs.getString("ExportedBy"));
    export.setPreferredName(rs.getString("ExportedFirstName"));
    export.setLastName(rs.getString("ExportedLastName"));
    project.setExportedUser(export);

    return project;
}

From source file:com.alfaariss.oa.authentication.remote.saml2.idp.storage.jdbc.IDPJDBCStorage.java

private SAML2IDP retrieveBySourceID(byte[] baSourceID) throws OAException {
    Connection connection = null;
    PreparedStatement pSelect = null;
    ResultSet resultSet = null;
    SAML2IDP saml2IDP = null;/*from   www  .j a  v a 2 s .  c o  m*/

    IMetadataProviderManager oMPM = MdMgrManager.getInstance().getMetadataProviderManager(_sId);

    try {
        connection = _dataSource.getConnection();

        pSelect = connection.prepareStatement(_sQuerySelectOnSourceID);
        pSelect.setBoolean(1, true);
        pSelect.setBytes(2, baSourceID);
        resultSet = pSelect.executeQuery();
        if (resultSet.next()) {
            boolean bACSIndex = resultSet.getBoolean(COLUMN_ACS_INDEX);

            Boolean boolAllowCreate = null;
            String sAllowCreate = resultSet.getString(COLUMN_ALLOW_CREATE);
            if (sAllowCreate != null) {
                boolean bAllowCreate = resultSet.getBoolean(COLUMN_ALLOW_CREATE);
                boolAllowCreate = new Boolean(bAllowCreate);
            }

            boolean bScoping = resultSet.getBoolean(COLUMN_SCOPING);
            boolean bNameIDPolicy = resultSet.getBoolean(COLUMN_NAMEIDPOLICY);
            boolean bAvoidSubjectConfirmation = resultSet.getBoolean(COLUMN_AVOID_SUBJCONF);
            boolean bDisableSSOForIDP = resultSet.getBoolean(COLUMN_DISABLE_SSO);

            Date dLastModified = null;
            try {
                dLastModified = resultSet.getTimestamp(COLUMN_DATELASTMODIFIED);
            } catch (Exception e) {
                _oLogger.info("No " + COLUMN_DATELASTMODIFIED + " column found for SAML2IDP with sourceid '"
                        + baSourceID + "'; ignoring.");
            }

            saml2IDP = new SAML2IDP(resultSet.getString(COLUMN_ID), baSourceID,
                    resultSet.getString(COLUMN_FRIENDLYNAME), resultSet.getString(COLUMN_METADATA_FILE),
                    resultSet.getString(COLUMN_METADATA_URL), resultSet.getInt(COLUMN_METADATA_TIMEOUT),
                    bACSIndex, boolAllowCreate, bScoping, bNameIDPolicy,
                    resultSet.getString(COLUMN_NAMEIDFORMAT), bAvoidSubjectConfirmation, bDisableSSOForIDP,
                    dLastModified, oMPM.getId());
        }
    } catch (OAException e) {
        throw e;
    } catch (Exception e) {
        _oLogger.fatal("Internal error during retrieval of organization with SourceID: " + baSourceID, e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    } finally {
        try {
            if (pSelect != null)
                pSelect.close();
        } catch (Exception e) {
            _oLogger.error("Could not close select statement", e);
        }

        try {
            if (connection != null)
                connection.close();
        } catch (Exception e) {
            _oLogger.error("Could not close connection", e);
        }
    }
    return saml2IDP;
}

From source file:com.greatmancode.craftconomy3.utils.OldFormatConverter.java

public void run() throws SQLException, IOException, ParseException {
    String dbType = Common.getInstance().getMainConfig().getString("System.Database.Type");
    HikariConfig config = new HikariConfig();
    if (dbType.equalsIgnoreCase("mysql")) {
        config.setMaximumPoolSize(10);//  ww w .java  2s  . c  om
        config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
        config.addDataSourceProperty("serverName",
                Common.getInstance().getMainConfig().getString("System.Database.Address"));
        config.addDataSourceProperty("port",
                Common.getInstance().getMainConfig().getString("System.Database.Port"));
        config.addDataSourceProperty("databaseName",
                Common.getInstance().getMainConfig().getString("System.Database.Db"));
        config.addDataSourceProperty("user",
                Common.getInstance().getMainConfig().getString("System.Database.Username"));
        config.addDataSourceProperty("password",
                Common.getInstance().getMainConfig().getString("System.Database.Password"));
        config.addDataSourceProperty("autoDeserialize", true);
        config.setConnectionTimeout(5000);
        db = new HikariDataSource(config);

    } else if (dbType.equalsIgnoreCase("sqlite")) {
        config.setDriverClassName("org.sqlite.JDBC");
        config.setJdbcUrl("jdbc:sqlite:" + Common.getInstance().getServerCaller().getDataFolder()
                + File.separator + "database.db");
        db = new HikariDataSource(config);
    } else {
        Common.getInstance().sendConsoleMessage(Level.SEVERE,
                "Unknown database type for old format converter!");
        return;
    }
    Connection connection = db.getConnection();
    this.tablePrefix = Common.getInstance().getMainConfig().getString("System.Database.Prefix");

    File accountFile = new File(Common.getInstance().getServerCaller().getDataFolder(), "accounts.json");

    Common.getInstance().sendConsoleMessage(Level.INFO,
            "Doing a backup in a xml file before doing the conversion.");
    //Document setup
    JSONObject mainObject = new JSONObject();

    Common.getInstance().sendConsoleMessage(Level.INFO, "Saving currency table");
    //Currencies
    PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + tablePrefix + "currency");
    ResultSet set = statement.executeQuery();
    JSONArray array = new JSONArray();
    while (set.next()) {
        JSONObject entry = new JSONObject();
        entry.put("id", set.getInt("id"));
        entry.put("name", set.getString("name"));
        entry.put("plural", set.getString("plural"));
        entry.put("minor", set.getString("minor"));
        entry.put("minorPlural", set.getString("minorPlural"));
        entry.put("sign", set.getString("sign"));
        entry.put("status", set.getBoolean("status"));
        array.add(entry);
    }
    statement.close();
    mainObject.put("currencies", array);

    //World groups
    Common.getInstance().sendConsoleMessage(Level.INFO, "Saving world group table");
    array = new JSONArray();
    statement = connection.prepareStatement("SELECT * FROM " + tablePrefix + "worldgroup");
    set = statement.executeQuery();
    while (set.next()) {
        JSONObject entry = new JSONObject();
        entry.put("groupName", set.getString("groupName"));
        entry.put("worldList", set.getString("worldList"));
        array.add(entry);
    }
    statement.close();
    mainObject.put("worldgroups", array);

    //Exchange table
    Common.getInstance().sendConsoleMessage(Level.INFO, "Saving exchange table");
    array = new JSONArray();
    statement = connection.prepareStatement("SELECT * FROM " + tablePrefix + "exchange");
    set = statement.executeQuery();
    while (set.next()) {
        JSONObject entry = new JSONObject();
        entry.put("from_currency_id", set.getInt("from_currency_id"));
        entry.put("to_currency_id", set.getInt("to_currency_id"));
        entry.put("amount", set.getDouble("amount"));
        array.add(entry);
    }
    statement.close();
    mainObject.put("exchanges", array);

    //config table
    Common.getInstance().sendConsoleMessage(Level.INFO, "Saving config table");
    array = new JSONArray();
    statement = connection.prepareStatement("SELECT * FROM " + tablePrefix + "config");
    set = statement.executeQuery();
    while (set.next()) {
        JSONObject entry = new JSONObject();
        entry.put("name", set.getString("name"));
        entry.put("value", set.getString("value"));
        array.add(entry);
    }
    statement.close();
    mainObject.put("configs", array);

    //account table
    Common.getInstance().sendConsoleMessage(Level.INFO, "Saving account table");
    array = new JSONArray();
    statement = connection.prepareStatement("SELECT * FROM " + tablePrefix + "account");
    set = statement.executeQuery();
    while (set.next()) {
        JSONObject entry = new JSONObject();
        entry.put("name", set.getString("name"));
        entry.put("infiniteMoney", set.getBoolean("infiniteMoney"));
        entry.put("ignoreACL", set.getBoolean("ignoreACL"));
        entry.put("uuid", set.getString("uuid"));

        JSONArray balanceArray = new JSONArray();
        PreparedStatement internalStatement = connection
                .prepareStatement("SELECT * FROM " + tablePrefix + "balance WHERE username_id=?");
        internalStatement.setInt(1, set.getInt("id"));
        ResultSet internalSet = internalStatement.executeQuery();
        while (internalSet.next()) {
            JSONObject object = new JSONObject();
            object.put("currency_id", internalSet.getInt("currency_id"));
            object.put("worldName", internalSet.getString("worldName"));
            object.put("balance", internalSet.getDouble("balance"));
            balanceArray.add(object);
        }
        internalStatement.close();
        entry.put("balances", balanceArray);

        internalStatement = connection
                .prepareStatement("SELECT * FROM " + tablePrefix + "log WHERE username_id=?");
        internalStatement.setInt(1, set.getInt("id"));
        internalSet = internalStatement.executeQuery();
        JSONArray logArray = new JSONArray();
        while (internalSet.next()) {
            JSONObject object = new JSONObject();
            object.put("type", internalSet.getObject("type"));
            object.put("cause", internalSet.getObject("cause"));
            object.put("timestamp", internalSet.getTimestamp("timestamp"));
            object.put("causeReason", internalSet.getString("causeReason"));
            object.put("currencyName", internalSet.getString("currencyName"));
            object.put("worldName", internalSet.getString("worldName"));
            object.put("amount", internalSet.getDouble("amount"));
            logArray.add(object);
        }
        internalStatement.close();
        entry.put("logs", logArray);

        internalStatement = connection
                .prepareStatement("SELECT * FROM " + tablePrefix + "acl WHERE account_id=?");
        internalStatement.setInt(1, set.getInt("id"));
        internalSet = internalStatement.executeQuery();
        JSONArray aclArray = new JSONArray();
        while (internalSet.next()) {
            JSONObject object = new JSONObject();
            object.put("playerName", internalSet.getString("playerName"));
            object.put("deposit", internalSet.getBoolean("deposit"));
            object.put("withdraw", internalSet.getBoolean("withdraw"));
            object.put("acl", internalSet.getBoolean("acl"));
            object.put("balance", internalSet.getBoolean("balance"));
            object.put("owner", internalSet.getBoolean("owner"));
            aclArray.add(object);

        }
        internalStatement.close();
        entry.put("acls", aclArray);
        array.add(entry);
    }
    statement.close();
    mainObject.put("accounts", array);
    Common.getInstance().sendConsoleMessage(Level.INFO, "Writing json file");
    FileWriter writer = new FileWriter(accountFile);
    writer.write(mainObject.toJSONString());
    writer.flush();
    writer.close();
    Common.getInstance().sendConsoleMessage(Level.INFO, "File written! Dropping all tables");
    //The backup is now saved. Let's drop everything
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "config");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "acl");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "balance");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "log");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "worldgroup");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "exchange");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "account");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "currency");
    statement.execute();
    statement.close();
    statement = connection.prepareStatement("DROP TABLE " + tablePrefix + "payday");
    statement.execute();
    statement.close();

    connection.close();
    step2();

}

From source file:eionet.meta.dao.mysql.SchemaSetDAOImpl.java

@Override
public SchemaSet getSchemaSet(int id) {
    String sql = "select * from T_SCHEMA_SET where SCHEMA_SET_ID = :id";
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("id", id);

    SchemaSet result = getNamedParameterJdbcTemplate().queryForObject(sql, parameters,
            new RowMapper<SchemaSet>() {
                @Override/*from   ww w  .j  a v a 2  s . co  m*/
                public SchemaSet mapRow(ResultSet rs, int rowNum) throws SQLException {
                    SchemaSet ss = new SchemaSet();
                    ss.setId(rs.getInt("SCHEMA_SET_ID"));
                    ss.setIdentifier(rs.getString("IDENTIFIER"));
                    ss.setContinuityId(rs.getString("CONTINUITY_ID"));
                    ss.setRegStatus(RegStatus.fromString(rs.getString("REG_STATUS")));
                    ss.setWorkingCopy(rs.getBoolean("WORKING_COPY"));
                    ss.setWorkingUser(rs.getString("WORKING_USER"));
                    ss.setDateModified(rs.getTimestamp("DATE_MODIFIED"));
                    ss.setUserModified(rs.getString("USER_MODIFIED"));
                    ss.setComment(rs.getString("COMMENT"));
                    ss.setCheckedOutCopyId(rs.getInt("CHECKEDOUT_COPY_ID"));
                    ss.setStatusModified(rs.getTimestamp("STATUS_MODIFIED"));
                    return ss;
                }
            });
    return result;
}

From source file:eionet.meta.dao.mysql.SchemaSetDAOImpl.java

@Override
public SchemaSet getSchemaSet(String identifier, boolean workingCopy) {
    String sql = "select * from T_SCHEMA_SET where IDENTIFIER = :identifier and WORKING_COPY = :workingCopy";
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("identifier", identifier);
    parameters.put("workingCopy", workingCopy);

    SchemaSet result = getNamedParameterJdbcTemplate().queryForObject(sql, parameters,
            new RowMapper<SchemaSet>() {
                @Override//  w ww  .j av  a2s .c  om
                public SchemaSet mapRow(ResultSet rs, int rowNum) throws SQLException {
                    SchemaSet ss = new SchemaSet();
                    ss.setId(rs.getInt("SCHEMA_SET_ID"));
                    ss.setIdentifier(rs.getString("IDENTIFIER"));
                    ss.setContinuityId(rs.getString("CONTINUITY_ID"));
                    ss.setRegStatus(RegStatus.fromString(rs.getString("REG_STATUS")));
                    ss.setWorkingCopy(rs.getBoolean("WORKING_COPY"));
                    ss.setWorkingUser(rs.getString("WORKING_USER"));
                    ss.setDateModified(rs.getTimestamp("DATE_MODIFIED"));
                    ss.setUserModified(rs.getString("USER_MODIFIED"));
                    ss.setComment(rs.getString("COMMENT"));
                    ss.setCheckedOutCopyId(rs.getInt("CHECKEDOUT_COPY_ID"));
                    ss.setStatusModified(rs.getTimestamp("STATUS_MODIFIED"));
                    return ss;
                }
            });
    return result;
}

From source file:eionet.meta.dao.mysql.SchemaSetDAOImpl.java

/**
 * @see eionet.meta.dao.ISchemaSetDAO#getWorkingCopyOfSchemaSet(int)
 *//*from   ww  w  .  j ava 2s.c  o  m*/
@Override
public SchemaSet getWorkingCopyOfSchemaSet(int checkedOutCopyId) {

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("checkedOutCopyId", checkedOutCopyId);

    SchemaSet result = getNamedParameterJdbcTemplate().queryForObject(GET_WORKING_COPY_OF_SQL, parameters,
            new RowMapper<SchemaSet>() {
                @Override
                public SchemaSet mapRow(ResultSet rs, int rowNum) throws SQLException {
                    SchemaSet ss = new SchemaSet();
                    ss.setId(rs.getInt("SCHEMA_SET_ID"));
                    ss.setIdentifier(rs.getString("IDENTIFIER"));
                    ss.setContinuityId(rs.getString("CONTINUITY_ID"));
                    ss.setRegStatus(RegStatus.fromString(rs.getString("REG_STATUS")));
                    ss.setWorkingCopy(rs.getBoolean("WORKING_COPY"));
                    ss.setWorkingUser(rs.getString("WORKING_USER"));
                    ss.setDateModified(rs.getTimestamp("DATE_MODIFIED"));
                    ss.setUserModified(rs.getString("USER_MODIFIED"));
                    ss.setComment(rs.getString("COMMENT"));
                    ss.setCheckedOutCopyId(rs.getInt("CHECKEDOUT_COPY_ID"));
                    ss.setStatusModified(rs.getTimestamp("STATUS_MODIFIED"));
                    return ss;
                }
            });
    return result;
}

From source file:eionet.meta.dao.mysql.SchemaSetDAOImpl.java

/**
 * @see eionet.meta.dao.ISchemaSetDAO#getWorkingCopiesOf(java.lang.String)
 *///  w w w. j ava2 s .c o  m
@Override
public List<SchemaSet> getWorkingCopiesOf(String userName) {

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("userName", userName);

    List<SchemaSet> resultList = getNamedParameterJdbcTemplate().query(GET_WORKING_COPIES_SQL, parameters,
            new RowMapper<SchemaSet>() {
                @Override
                public SchemaSet mapRow(ResultSet rs, int rowNum) throws SQLException {
                    SchemaSet ss = new SchemaSet();
                    ss.setId(rs.getInt("SCHEMA_SET_ID"));
                    ss.setIdentifier(rs.getString("IDENTIFIER"));
                    ss.setContinuityId(rs.getString("CONTINUITY_ID"));
                    ss.setRegStatus(RegStatus.fromString(rs.getString("REG_STATUS")));
                    ss.setWorkingCopy(rs.getBoolean("WORKING_COPY"));
                    ss.setWorkingUser(rs.getString("WORKING_USER"));
                    ss.setDateModified(rs.getTimestamp("DATE_MODIFIED"));
                    ss.setUserModified(rs.getString("USER_MODIFIED"));
                    ss.setComment(rs.getString("COMMENT"));
                    ss.setCheckedOutCopyId(rs.getInt("CHECKEDOUT_COPY_ID"));
                    ss.setStatusModified(rs.getTimestamp("STATUS_MODIFIED"));
                    return ss;
                }
            });

    return resultList;
}