Example #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);
 }
Example #2
0
 @Override
 public List<? extends InstanceLink> findBadInstanceLinks(int count) {
   return create()
       .select(INSTANCE_LINK.fields())
       .from(INSTANCE_LINK)
       .join(INSTANCE)
       .on(INSTANCE.ID.eq(INSTANCE_LINK.TARGET_INSTANCE_ID))
       .where(INSTANCE.STATE.eq(CommonStatesConstants.PURGED))
       .limit(count)
       .fetchInto(InstanceLinkRecord.class);
 }
Example #3
0
 @Override
 public List<? extends Nic> findBadNics(int count) {
   return create()
       .select(NIC.fields())
       .from(NIC)
       .join(INSTANCE)
       .on(INSTANCE.ID.eq(NIC.INSTANCE_ID))
       .where(
           NIC.REMOVED
               .isNull()
               .and(INSTANCE.STATE.eq(CommonStatesConstants.PURGED))
               .and(
                   NIC.STATE.notIn(
                       CommonStatesConstants.DEACTIVATING, CommonStatesConstants.REMOVING)))
       .limit(count)
       .fetchInto(NicRecord.class);
 }
Example #4
0
 @Override
 public List<? extends Instance> findInstanceByServiceName(long accountId, String serviceName) {
   return create()
       .select(INSTANCE.fields())
       .from(INSTANCE)
       .join(SERVICE_EXPOSE_MAP)
       .on(INSTANCE.ID.eq(SERVICE_EXPOSE_MAP.INSTANCE_ID))
       .join(SERVICE)
       .on(SERVICE.ID.eq(SERVICE_EXPOSE_MAP.SERVICE_ID))
       .where(
           INSTANCE
               .STATE
               .eq(InstanceConstants.STATE_RUNNING)
               .and(INSTANCE.ACCOUNT_ID.eq(accountId))
               .and(SERVICE_EXPOSE_MAP.REMOVED.isNull())
               .and(SERVICE.REMOVED.isNull())
               .and(SERVICE.NAME.eq(serviceName)))
       .fetchInto(InstanceRecord.class);
 }