@Override public List<? extends Host> getNonPurgedHosts(long accountId) { return create() .select(HOST.fields()) .from(HOST) .where(HOST.ACCOUNT_ID.eq(accountId).and(HOST.STATE.notEqual(CommonStatesConstants.PURGED))) .fetchInto(Host.class); }
@Override public List<? extends Host> getActiveHosts(long accountId) { return create() .select(HOST.fields()) .from(HOST) .leftOuterJoin(AGENT) .on(AGENT.ID.eq(HOST.AGENT_ID)) .where( AGENT .ID .isNull() .or(AGENT.STATE.eq(CommonStatesConstants.ACTIVE)) .and(HOST.REMOVED.isNull()) .and(HOST.ACCOUNT_ID.eq(accountId)) .and( HOST.STATE.in( CommonStatesConstants.ACTIVE, CommonStatesConstants.UPDATING_ACTIVE))) .fetchInto(Host.class); }