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.ExpenseClaimDAOImpl.java

/**
 * Load expense claim.//from  ww w  . jav a2s. c o  m
 *
 * @param rs the rs
 * @return the expense claim bean
 * @throws SQLException the sQL exception
 */
private ExpenseClaimBean loadExpenseClaim(final ResultSet rs) throws SQLException {

    ExpenseClaimBean expenseClaim = new ExpenseClaimBean();

    expenseClaim.setId(rs.getInt("ExpenseClaimId"));
    expenseClaim.setGUID(rs.getInt("GUID"));
    expenseClaim.setReferenceGUID(rs.getInt("ReferenceGUID"));
    expenseClaim.setExpenseClass(rs.getString("ExpenseClass"));
    expenseClaim.setExpenseType(rs.getString("ExpenseType"));
    expenseClaim.setCurrencyAbbreviation(rs.getString("CurrencyAbbreviation"));
    try {
        expenseClaim.setExpenseDate(rs.getDate("ExpenseDate"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error loading ExpenseDate: " + sqe.getMessage());
    }
    expenseClaim.setExchangeRate(rs.getDouble("ExchangeRate"));
    expenseClaim.setDescription(rs.getString("Description"));
    expenseClaim.setRate(rs.getDouble("Rate"));
    expenseClaim.setQuantity(rs.getInt("Quantity"));
    expenseClaim.setGSTRate(rs.getDouble("GSTRate"));
    expenseClaim.setValue(rs.getDouble("Value"));
    expenseClaim.setNetValue(rs.getDouble("NetValue"));

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

    return expenseClaim;
}

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

/**
 * @see eionet.meta.dao.ISchemaDAO#searchSchemas(eionet.meta.service.data.SchemaFilter)
 *///from  w  ww . ja  va2 s.com
@Override
public SchemasResult searchSchemas(SchemaFilter searchFilter) {

    int nameAttrId = getNameAttributeId();

    StringBuilder sql = new StringBuilder().append("select ")
            .append("S.*, SS.*, ATR1.VALUE as NAME_ATTR, atr2.VALUE as SS_NAME_ATTR, ")
            .append("if(SS.SCHEMA_SET_ID is null, S.WORKING_COPY, SS.WORKING_COPY) as WCOPY, ")
            .append("if(SS.SCHEMA_SET_ID is null, S.WORKING_USER, SS.WORKING_USER) as WUSER, ")
            .append("if(SS.SCHEMA_SET_ID is null, S.REG_STATUS, SS.REG_STATUS) as REGSTAT ").append("from ")
            .append("T_SCHEMA as S left outer join T_SCHEMA_SET as SS on (S.SCHEMA_SET_ID=SS.SCHEMA_SET_ID) ")
            .append("left outer join ATTRIBUTE as ATR1 on ")
            .append("(S.SCHEMA_ID=ATR1.DATAELEM_ID and ATR1.PARENT_TYPE=:attrParentType1 ")
            .append("and ATR1.M_ATTRIBUTE_ID=:nameAttrId) ").append("left outer join ATTRIBUTE as atr2 on ")
            .append("(S.SCHEMA_SET_ID=atr2.DATAELEM_ID and atr2.PARENT_TYPE=:attrParentType2 ")
            .append("and atr2.M_ATTRIBUTE_ID=:nameAttrId) ").append("where 1=1 ");

    String searchingUser = searchFilter.getSearchingUser();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("attrParentType1", DElemAttribute.ParentType.SCHEMA.toString());
    params.put("attrParentType2", DElemAttribute.ParentType.SCHEMA_SET.toString());
    params.put("nameAttrId", nameAttrId);

    // Where clause
    if (searchFilter.isValued()) {
        if (StringUtils.isNotEmpty(searchFilter.getFileName())) {
            sql.append("and S.FILENAME like :fileName ");
            params.put("fileName", "%" + searchFilter.getFileName() + "%");
        }
        if (StringUtils.isNotEmpty(searchFilter.getSchemaSetIdentifier())) {
            sql.append("and SS.IDENTIFIER like :schemaSetIdentifier ");
            params.put("schemaSetIdentifier", "%" + searchFilter.getSchemaSetIdentifier() + "%");
        }
        if (searchFilter.isAttributesValued()) {
            for (int i = 0; i < searchFilter.getAttributes().size(); i++) {
                Attribute a = searchFilter.getAttributes().get(i);
                String idKey = "attrId" + i;
                String valueKey = "attrValue" + i;
                if (StringUtils.isNotEmpty(a.getValue())) {
                    sql.append("and ");
                    sql.append("S.SCHEMA_ID IN ( ");
                    sql.append("select A.DATAELEM_ID from ATTRIBUTE A where ");
                    sql.append("A.M_ATTRIBUTE_ID = :" + idKey + " and A.VALUE like :" + valueKey
                            + " and A.PARENT_TYPE = :parentType ");
                    sql.append(") ");
                }
                params.put(idKey, a.getId());
                String value = "%" + a.getValue() + "%";
                params.put(valueKey, value);
                params.put("parentType", DElemAttribute.ParentType.SCHEMA.toString());
            }
        }
    }

    // Having.
    if (StringUtils.isBlank(searchingUser)) {
        sql.append("having (WCOPY=false ");
        if (StringUtils.isEmpty(searchFilter.getRegStatus())) {
            sql.append("AND REGSTAT IN ( :regStatusPublic ) ");
            params.put("regStatusPublic", RegStatus.getPublicStatuses());
        }
        sql.append(") ");
    } else {
        sql.append("having ((WCOPY=false or WUSER=:workingUser)");
        params.put("workingUser", searchingUser);
        if (StringUtils.isNotEmpty(searchFilter.getRegStatus())) {
            sql.append(" and REGSTAT=:regStatus");
            params.put("regStatus", searchFilter.getRegStatus().toString());
        }
        sql.append(") ");
    }

    // Sorting
    if (StringUtils.isNotEmpty(searchFilter.getSortProperty())) {
        sql.append("order by ").append(searchFilter.getSortProperty());
        if (SortOrderEnum.ASCENDING.equals(searchFilter.getSortOrder())) {
            sql.append(" asc ");
        } else {
            sql.append(" desc ");
        }
    }

    if (searchFilter.isUsePaging()) {
        sql.append(" LIMIT ").append(searchFilter.getOffset()).append(",").append(searchFilter.getPageSize());
    }

    // LOGGER.debug("SQL: " + sql.toString());

    List<Schema> resultList = getNamedParameterJdbcTemplate().query(sql.toString(), params,
            new RowMapper<Schema>() {
                @Override
                public Schema mapRow(ResultSet rs, int rowNum) throws SQLException {
                    Schema schema = new Schema();
                    schema.setId(rs.getInt("S.SCHEMA_ID"));
                    schema.setSchemaSetId(rs.getInt("SS.SCHEMA_SET_ID"));
                    schema.setFileName(rs.getString("S.FILENAME"));
                    schema.setContinuityId(rs.getString("S.CONTINUITY_ID"));
                    schema.setRegStatus(RegStatus.fromString(rs.getString("S.REG_STATUS")));
                    schema.setWorkingCopy(rs.getBoolean("S.WORKING_COPY"));
                    schema.setWorkingUser(rs.getString("S.WORKING_USER"));
                    schema.setDateModified(rs.getTimestamp("S.DATE_MODIFIED"));
                    schema.setUserModified(rs.getString("S.USER_MODIFIED"));
                    schema.setComment(rs.getString("S.COMMENT"));
                    schema.setCheckedOutCopyId(rs.getInt("S.CHECKEDOUT_COPY_ID"));
                    schema.setSchemaSetIdentifier(rs.getString("SS.IDENTIFIER"));
                    schema.setSchemaSetWorkingCopy(rs.getBoolean("SS.WORKING_COPY"));
                    schema.setSchemaSetWorkingUser(rs.getString("SS.WORKING_USER"));
                    schema.setNameAttribute(rs.getString("NAME_ATTR"));
                    schema.setSchemaSetNameAttribute(rs.getString("SS_NAME_ATTR"));
                    schema.setOtherDocument(rs.getBoolean("S.OTHER_DOCUMENT"));
                    return schema;
                }
            });

    String totalSql = "SELECT FOUND_ROWS()";
    int totalItems = getJdbcTemplate().queryForInt(totalSql);

    SchemasResult result = new SchemasResult(resultList, totalItems, searchFilter);
    return result;
}

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

/**
 * {@inheritDoc}//from   w ww  .j a  va  2 s  . c  om
 */
@Override
public VocabularyFolder getVocabularyFolder(int vocabularyFolderId) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("id", vocabularyFolderId);

    StringBuilder sql = new StringBuilder();
    sql.append(
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, ");
    sql.append("f.ID, f.IDENTIFIER, f.LABEL, v.NOTATIONS_EQUAL_IDENTIFIERS ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append("where VOCABULARY_ID=:id");

    VocabularyFolder result = getNamedParameterJdbcTemplate().queryForObject(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return result;
}

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

/**
 * {@inheritDoc}/*from w  w  w  .  j av a 2 s  . co m*/
 */
@Override
public VocabularyFolder getVocabularyWorkingCopy(int checkedOutCopyId) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("checkedOutCopyId", checkedOutCopyId);

    StringBuilder sql = new StringBuilder();
    sql.append(
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, ");
    sql.append("f.ID, f.IDENTIFIER, f.LABEL, v.NOTATIONS_EQUAL_IDENTIFIERS ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append("where v.CHECKEDOUT_COPY_ID=:checkedOutCopyId");

    VocabularyFolder result = getNamedParameterJdbcTemplate().queryForObject(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return result;
}

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

@Override
public VocabularyFolder getVocabularyFolderOfConcept(int conceptId) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("conceptId", conceptId);

    StringBuilder sql = new StringBuilder();
    sql.append(/*from   w  ww.  ja  v  a 2  s .  co m*/
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, ");
    sql.append("f.ID, f.IDENTIFIER, f.LABEL, v.NOTATIONS_EQUAL_IDENTIFIERS ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append("where VOCABULARY_ID=");
    sql.append("(select VOCABULARY_ID from VOCABULARY_CONCEPT where VOCABULARY_CONCEPT_ID=:conceptId)");

    VocabularyFolder result = getNamedParameterJdbcTemplate().queryForObject(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return result;
}

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

/**
 * {@inheritDoc}//from   w  w w  .  j a va 2s  . co m
 */
@Override
public VocabularyFolder getVocabularyFolder(String folderName, String identifier, boolean workingCopy) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("identifier", identifier);
    params.put("workingCopy", workingCopy);
    params.put("folderIdentifier", folderName);

    StringBuilder sql = new StringBuilder();
    sql.append(
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, ");
    sql.append("f.ID, f.IDENTIFIER, f.LABEL, v.NOTATIONS_EQUAL_IDENTIFIERS ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append(
            "where v.IDENTIFIER=:identifier and v.WORKING_COPY=:workingCopy and f.IDENTIFIER=:folderIdentifier");

    VocabularyFolder result = getNamedParameterJdbcTemplate().queryForObject(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return result;
}

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

@Override
public List<VocabularyFolder> getRecentlyReleasedVocabularyFolders(int limit) {

    StringBuilder sql = new StringBuilder();
    sql.append(//from  w  w  w  .  j a  v a  2 s  .c o  m
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, v.NOTATIONS_EQUAL_IDENTIFIERS, f.ID, f.IDENTIFIER, f.LABEL ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append("where v.WORKING_COPY=FALSE and v.REG_STATUS like :releasedStatus ");
    sql.append("order by v.DATE_MODIFIED desc, v.IDENTIFIER asc ");
    sql.append("limit :limit");

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("releasedStatus", RegStatus.RELEASED.toString());
    params.put("limit", limit);

    List<VocabularyFolder> items = getNamedParameterJdbcTemplate().query(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return items;

}

From source file:com.l2jfree.gameserver.datatables.NpcTable.java

private boolean fillNpcTable(ResultSet NpcData) throws Exception {
    boolean loaded = false;
    while (NpcData.next()) {
        StatsSet npcDat = new StatsSet();
        int id = NpcData.getInt("id");

        if (Config.ASSERT)
            assert id < 1000000;

        npcDat.set("npcId", id);
        npcDat.set("idTemplate", NpcData.getInt("idTemplate"));
        int level = NpcData.getInt("level");
        npcDat.set("level", level);
        npcDat.set("jClass", NpcData.getString("class"));

        npcDat.set("baseShldDef", 0);
        npcDat.set("baseShldRate", 0);
        npcDat.set("baseCritRate", 38);

        npcDat.set("name", NpcData.getString("name"));
        npcDat.set("serverSideName", NpcData.getBoolean("serverSideName"));
        npcDat.set("title", NpcData.getString("title"));
        npcDat.set("serverSideTitle", NpcData.getBoolean("serverSideTitle"));
        npcDat.set("collision_radius", NpcData.getDouble("collision_radius"));
        npcDat.set("collision_height", NpcData.getDouble("collision_height"));
        npcDat.set("fcollision_radius", NpcData.getDouble("collision_radius"));
        npcDat.set("fcollision_height", NpcData.getDouble("collision_height"));
        npcDat.set("sex", NpcData.getString("sex"));
        if (!Config.ALLOW_NPC_WALKERS && NpcData.getString("type").equalsIgnoreCase("L2NpcWalker"))
            npcDat.set("type", "L2Npc");
        else// www  .  j  a  v a  2s  . c  o  m
            npcDat.set("type", NpcData.getString("type"));
        npcDat.set("baseAtkRange", NpcData.getInt("attackrange"));
        npcDat.set("rewardExp", NpcData.getInt("exp"));
        npcDat.set("rewardSp", NpcData.getInt("sp"));
        npcDat.set("basePAtkSpd", NpcData.getInt("atkspd"));
        npcDat.set("baseMAtkSpd", NpcData.getInt("matkspd"));
        npcDat.set("aggroRange", NpcData.getInt("aggro"));
        npcDat.set("rhand", NpcData.getInt("rhand"));
        npcDat.set("lhand", NpcData.getInt("lhand"));
        npcDat.set("armor", NpcData.getInt("armor"));
        npcDat.set("baseWalkSpd", NpcData.getInt("walkspd"));
        npcDat.set("baseRunSpd", NpcData.getInt("runspd"));

        npcDat.safeSet("baseSTR", NpcData.getInt("str"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));
        npcDat.safeSet("baseCON", NpcData.getInt("con"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));
        npcDat.safeSet("baseDEX", NpcData.getInt("dex"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));
        npcDat.safeSet("baseINT", NpcData.getInt("int"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));
        npcDat.safeSet("baseWIT", NpcData.getInt("wit"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));
        npcDat.safeSet("baseMEN", NpcData.getInt("men"), 0, Formulas.MAX_STAT_VALUE,
                "Loading NPC template; ID: " + npcDat.getString("idTemplate"));

        npcDat.set("baseHpMax", NpcData.getInt("hp"));
        npcDat.set("baseCpMax", 0);
        npcDat.set("baseMpMax", NpcData.getInt("mp"));
        npcDat.set("baseHpReg",
                NpcData.getFloat("hpreg") > 0 ? NpcData.getFloat("hpreg") : 1.5 + ((level - 1) / 10.0));
        npcDat.set("baseMpReg",
                NpcData.getFloat("mpreg") > 0 ? NpcData.getFloat("mpreg") : 0.9 + 0.3 * ((level - 1) / 10.0));
        npcDat.set("basePAtk", NpcData.getInt("patk"));
        npcDat.set("basePDef", NpcData.getInt("pdef"));
        npcDat.set("baseMAtk", NpcData.getInt("matk"));
        npcDat.set("baseMDef", NpcData.getInt("mdef"));

        npcDat.set("factionId", NpcData.getString("faction_id"));
        npcDat.set("factionRange", NpcData.getInt("faction_range"));

        npcDat.set("isUndead", NpcData.getString("isUndead"));

        npcDat.set("absorb_level", NpcData.getString("absorb_level"));
        npcDat.set("absorb_type", NpcData.getString("absorb_type"));

        npcDat.set("ss", NpcData.getInt("ss"));
        npcDat.set("bss", NpcData.getInt("bss"));
        npcDat.set("ssRate", NpcData.getInt("ss_rate"));

        npcDat.set("AI", NpcData.getString("AI"));
        npcDat.set("drop_herbs", Boolean.valueOf(NpcData.getString("drop_herbs")));

        if (Config.FACTION_ENABLED) {
            Faction faction;
            for (int i = 0; i < FactionManager.getInstance().getFactions().size(); i++) {
                faction = FactionManager.getInstance().getFactions().get(i);
                if (faction.getNpcList().contains(id)) {
                    npcDat.set("NPCFaction", faction.getId());
                    npcDat.set("NPCFactionName", faction.getName());
                }
            }
        }

        L2NpcTemplate template = new L2NpcTemplate(npcDat);
        template.addVulnerability(Stats.BOW_WPN_VULN, 1);
        template.addVulnerability(Stats.CROSSBOW_WPN_VULN, 1);
        template.addVulnerability(Stats.BLUNT_WPN_VULN, 1);
        template.addVulnerability(Stats.DAGGER_WPN_VULN, 1);

        _npcs.set(id, template);

        loaded = true;
    }
    return loaded;
}

From source file:com.sfs.whichdoctor.analysis.FinancialSummaryAnalysisDAOImpl.java

/**
 * Load transaction.//from   w  w  w  .  j  av a2s  . c o  m
 *
 * @param rs the rs
 * @param loadDetails the load details
 *
 * @return the transaction summary bean
 *
 * @throws SQLException the SQL exception
 */
private TransactionSummaryBean loadTransaction(final ResultSet rs, final BuilderBean loadDetails)
        throws SQLException {

    TransactionSummaryBean transaction = new TransactionSummaryBean();

    transaction.setSummaryId(rs.getInt("SummaryId"));
    transaction.setId(rs.getInt("Id"));
    transaction.setType(rs.getString("Name"));
    transaction.setFinancialType(rs.getString("Class"));
    transaction.setSecurity(rs.getString("Security"));
    transaction.setCategory(rs.getString("Object"));
    transaction.setAbbreviation(rs.getString("Abbreviation"));
    transaction.setNumber(rs.getString("Number"));
    transaction.setDescription(rs.getString("Description"));
    transaction.setValue(rs.getDouble("Value"));
    transaction.setNetValue(rs.getDouble("NetValue"));
    transaction.setCancelled(rs.getBoolean("Cancelled"));
    transaction.setPersonId(rs.getInt("PersonId"));
    transaction.setOrganisationId(rs.getInt("OrganisationId"));
    try {
        transaction.setIssued(rs.getDate("Issued"));
    } catch (SQLException sqe) {
        dataLogger.debug("Error parsing Issued: " + sqe.getMessage());
    }

    if (loadDetails.getBoolean("LOAD_OBJECTS")) {
        if (transaction.getPersonId() > 0) {
            try {
                transaction.setPerson(this.personDAO.loadGUID(transaction.getPersonId()));
            } catch (Exception e) {
                dataLogger.error("Error loading person: " + e.getMessage());
            }
        }
        if (transaction.getOrganisationId() > 0) {
            try {
                transaction.setOrganisation(this.organisationDAO.loadGUID(transaction.getOrganisationId()));
            } catch (Exception e) {
                dataLogger.error("Error loading organisation: " + e.getMessage());
            }
        }
    }
    return transaction;
}

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

@Override
public List<VocabularyFolder> getReleasedVocabularyFolders(int folderId) {
    List<String> statuses = new ArrayList<String>();
    statuses.add(RegStatus.RELEASED.toString());
    statuses.add(RegStatus.PUBLIC_DRAFT.toString());

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("folderId", folderId);
    params.put("statuses", statuses);

    StringBuilder sql = new StringBuilder();
    sql.append(/*w w  w. ja v  a 2 s  .  c om*/
            "select v.VOCABULARY_ID, v.IDENTIFIER, v.LABEL, v.REG_STATUS, v.WORKING_COPY, v.BASE_URI, v.VOCABULARY_TYPE, ");
    sql.append("v.WORKING_USER, v.DATE_MODIFIED, v.USER_MODIFIED, v.CHECKEDOUT_COPY_ID, v.CONTINUITY_ID, ");
    sql.append("v.CONCEPT_IDENTIFIER_NUMERIC, ");
    sql.append("f.ID, f.IDENTIFIER, f.LABEL, v.NOTATIONS_EQUAL_IDENTIFIERS ");
    sql.append("from VOCABULARY v ");
    sql.append("left join VOCABULARY_SET f on f.ID=v.FOLDER_ID ");
    sql.append("where v.WORKING_COPY=FALSE and v.FOLDER_ID=:folderId and v.REG_STATUS in (:statuses) ");
    sql.append("order by f.IDENTIFIER, v.IDENTIFIER ");

    List<VocabularyFolder> items = getNamedParameterJdbcTemplate().query(sql.toString(), params,
            new RowMapper<VocabularyFolder>() {
                @Override
                public VocabularyFolder mapRow(ResultSet rs, int rowNum) throws SQLException {
                    VocabularyFolder vf = new VocabularyFolder();
                    vf.setId(rs.getInt("v.VOCABULARY_ID"));
                    vf.setIdentifier(rs.getString("v.IDENTIFIER"));
                    vf.setLabel(rs.getString("v.LABEL"));
                    vf.setRegStatus(RegStatus.fromString(rs.getString("v.REG_STATUS")));
                    vf.setType(VocabularyType.valueOf(rs.getString("v.VOCABULARY_TYPE")));
                    vf.setWorkingCopy(rs.getBoolean("v.WORKING_COPY"));
                    vf.setWorkingUser(rs.getString("v.WORKING_USER"));
                    vf.setDateModified(rs.getTimestamp("v.DATE_MODIFIED"));
                    vf.setUserModified(rs.getString("v.USER_MODIFIED"));
                    vf.setCheckedOutCopyId(rs.getInt("v.CHECKEDOUT_COPY_ID"));
                    vf.setContinuityId(rs.getString("v.CONTINUITY_ID"));
                    vf.setNumericConceptIdentifiers(rs.getBoolean("v.CONCEPT_IDENTIFIER_NUMERIC"));
                    vf.setNotationsEqualIdentifiers(rs.getBoolean("NOTATIONS_EQUAL_IDENTIFIERS"));
                    vf.setBaseUri(rs.getString("v.BASE_URI"));
                    vf.setFolderId(rs.getShort("f.ID"));
                    vf.setFolderName(rs.getString("f.IDENTIFIER"));
                    vf.setFolderLabel(rs.getString("f.LABEL"));
                    return vf;
                }
            });

    return items;
}