working on project list: introducing task list
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
package de.srsoftware.umbrella.project;
|
||||
|
||||
import static de.srsoftware.tools.jdbc.Condition.*;
|
||||
import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
|
||||
import static de.srsoftware.tools.jdbc.Query.insertInto;
|
||||
import static de.srsoftware.tools.jdbc.Query.select;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
@@ -37,7 +38,7 @@ public class SqliteDb implements ProjectDb {
|
||||
|
||||
private Map<Long, Project> addMembers(Map<Long, Project> projects) throws SQLException, UmbrellaException {
|
||||
Object[] ids = projects.keySet().toArray();
|
||||
var rs = select("*").from(TABLE_PROJECT_USERS).where(PROJECT_ID,in(ids)).exec(db);
|
||||
var rs = select(ALL).from(TABLE_PROJECT_USERS).where(PROJECT_ID,in(ids)).exec(db);
|
||||
while (rs.next()){
|
||||
var userId = rs.getLong(USER_ID);
|
||||
var projectId = rs.getLong(PROJECT_ID);
|
||||
@@ -136,7 +137,7 @@ CREATE TABLE IF NOT EXISTS {0} ( {1} VARCHAR(255) PRIMARY KEY, {2} VARCHAR(255)
|
||||
@Override
|
||||
public Project load(long projectId) throws UmbrellaException {
|
||||
try {
|
||||
var rs = select("*").from(TABLE_PROJECTS).where(ID, equal(projectId)).exec(db);
|
||||
var rs = select(ALL).from(TABLE_PROJECTS).where(ID, equal(projectId)).exec(db);
|
||||
Project result = null;
|
||||
if (rs.next()) result = Project.of(rs);
|
||||
rs.close();
|
||||
@@ -152,7 +153,7 @@ CREATE TABLE IF NOT EXISTS {0} ( {1} VARCHAR(255) PRIMARY KEY, {2} VARCHAR(255)
|
||||
public Map<Long, Project> ofCompany(long companyId, boolean includeClosed) throws UmbrellaException {
|
||||
try {
|
||||
var projects = new HashMap<Long,Project>();
|
||||
var query = select("*").from(TABLE_PROJECTS).where(COMPANY_ID, equal(companyId));
|
||||
var query = select(ALL).from(TABLE_PROJECTS).where(COMPANY_ID, equal(companyId));
|
||||
if (!includeClosed) query = query.where(STATUS,lessThan(Project.Status.Complete.code()));
|
||||
var rs = query.exec(db);
|
||||
while (rs.next()){
|
||||
@@ -172,7 +173,7 @@ CREATE TABLE IF NOT EXISTS {0} ( {1} VARCHAR(255) PRIMARY KEY, {2} VARCHAR(255)
|
||||
public Map<Long, Project> ofUser(long userId, boolean includeClosed) throws UmbrellaException {
|
||||
try {
|
||||
var projects = new HashMap<Long,Project>();
|
||||
var query = select("*").from(TABLE_PROJECTS).leftJoin(ID,TABLE_PROJECT_USERS,PROJECT_ID).where(USER_ID, equal(userId));
|
||||
var query = select(ALL).from(TABLE_PROJECTS).leftJoin(ID,TABLE_PROJECT_USERS,PROJECT_ID).where(USER_ID, equal(userId));
|
||||
if (!includeClosed) query = query.where(STATUS,lessThan(Project.Status.Complete.code()));
|
||||
var rs = query.exec(db);
|
||||
while (rs.next()){
|
||||
|
||||
Reference in New Issue
Block a user