use of net.jforum.exceptions.DatabaseException in project jforum2 by rafaelsteil.
the class GenericAttachmentDAO method selectQuotaLimitByGroup.
/**
* @see net.jforum.dao.AttachmentDAO#selectQuotaLimit()
*/
public QuotaLimit selectQuotaLimitByGroup(int groupId) {
QuotaLimit ql = null;
PreparedStatement p = null;
ResultSet rs = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("AttachmentModel.selectQuotaLimitByGroup"));
p.setInt(1, groupId);
rs = p.executeQuery();
if (rs.next()) {
ql = this.getQuotaLimit(rs);
}
return ql;
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(rs, p);
}
}
use of net.jforum.exceptions.DatabaseException in project jforum2 by rafaelsteil.
the class GenericAttachmentDAO method addExtensionGroup.
/**
* @see net.jforum.dao.AttachmentDAO#addExtensionGroup(net.jforum.entities.AttachmentExtensionGroup)
*/
public void addExtensionGroup(AttachmentExtensionGroup g) {
PreparedStatement p = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("AttachmentModel.addExtensionGroup"));
p.setString(1, g.getName());
p.setInt(2, g.isAllow() ? 1 : 0);
p.setString(3, g.getUploadIcon());
p.setInt(4, g.getDownloadMode());
p.executeUpdate();
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(p);
}
}
use of net.jforum.exceptions.DatabaseException in project jforum2 by rafaelsteil.
the class GenericAttachmentDAO method removeQuotaLimit.
/**
* @see net.jforum.dao.AttachmentDAO#removeQuotaLimit(java.lang.String[])
*/
public void removeQuotaLimit(String[] ids) {
PreparedStatement p = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("AttachmentModel.removeQuotaLimit"));
for (int i = 0; i < ids.length; i++) {
p.setInt(1, Integer.parseInt(ids[i]));
p.executeUpdate();
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(p);
}
}
use of net.jforum.exceptions.DatabaseException in project jforum2 by rafaelsteil.
the class GenericAttachmentDAO method isPhysicalDownloadMode.
public boolean isPhysicalDownloadMode(int extensionGroupId) {
boolean result = true;
PreparedStatement p = null;
ResultSet rs = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("AttachmentModel.isPhysicalDownloadMode"));
p.setInt(1, extensionGroupId);
rs = p.executeQuery();
if (rs.next()) {
result = (rs.getInt("download_mode") == 2);
}
return result;
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(rs, p);
}
}
use of net.jforum.exceptions.DatabaseException in project jforum2 by rafaelsteil.
the class GenericAttachmentDAO method selectQuotaLimit.
/**
* @see net.jforum.dao.AttachmentDAO#selectQuotaLimit()
*/
public List selectQuotaLimit() {
List l = new ArrayList();
PreparedStatement p = null;
ResultSet rs = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("AttachmentModel.selectQuotaLimit"));
rs = p.executeQuery();
while (rs.next()) {
l.add(this.getQuotaLimit(rs));
}
return l;
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(rs, p);
}
}
Aggregations