Ejemplo n.º 1
0
 @Override
 public List<? extends Host> findHosts(long accountId, long instanceId) {
   return create()
       .select(HOST.fields())
       .from(INSTANCE)
       .join(INSTANCE_HOST_MAP)
       .on(INSTANCE.ID.eq(INSTANCE_HOST_MAP.INSTANCE_ID))
       .join(HOST)
       .on(HOST.ID.eq(INSTANCE_HOST_MAP.HOST_ID))
       .where(
           HOST.REMOVED
               .isNull()
               .and(INSTANCE_HOST_MAP.REMOVED.isNull())
               .and(INSTANCE.ID.eq(instanceId)))
       .fetchInto(HostRecord.class);
 }
Ejemplo n.º 2
0
 @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);
 }