Remove commented code

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 2f0f47fe92
commit 017aa7af11

@ -908,63 +908,37 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public List<Integer> getTagIdsForTagNames(List<String> tagNames, int tenantId) throws ApplicationManagementDAOException {
public List<Integer> getTagIdsForTagNames(List<String> tagNames, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get tag ids for given tag names");
}
// Connection conn;
// PreparedStatement stmt = null;
// ResultSet rs = null;
try {
Connection conn = this.getDBConnection();
int index = 1;
List<Integer> tagIds = new ArrayList<>();
// String sql = "SELECT "
// + "AP_APP_TAG.ID AS ID "
// + "FROM AP_APP_TAG "
// + "WHERE AP_APP_TAG..NAME IN ( ? ) AND TENANT_ID = ?";
// conn = this.getDBConnection();
//
StringJoiner joiner = new StringJoiner(",", "SELECT AP_APP_TAG.ID AS ID FROM AP_APP_TAG "
+ "WHERE AP_APP_TAG.TAG IN (", ") AND TENANT_ID = ?");
StringJoiner joiner = new StringJoiner(",",
"SELECT AP_APP_TAG.ID AS ID FROM AP_APP_TAG WHERE AP_APP_TAG.TAG IN (", ") AND TENANT_ID = ?");
tagNames.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString();
try (PreparedStatement ps = conn.prepareStatement(query)) {
// for (int c = 0; c < tagNames.size(); c++) {
// ps.setObject(c + 1, tagNames.get(c));
// }
for (String tagName : tagNames) {
ps.setObject(index++, tagName);
}
ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) {
while(rs.next()){
while (rs.next()) {
tagIds.add(rs.getInt("ID"));
}
}
}
//
// Array array = conn.createArrayOf("VARCHAR", new List[] { tagNames });
//
// stmt = conn.prepareStatement(sql);
// stmt.setArray(1, array);
// stmt.setInt(2, tenantId);
// rs = stmt.executeQuery();
// while(rs.next()){
// tagIds.add(rs.getInt("ID"));
// }
return tagIds;
}
catch (DBConnectionException e) {
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding tags", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding tags", e);
}
// finally {
// Util.cleanupResources(stmt, rs);
// }
}
public void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException {

Loading…
Cancel
Save