@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); }
@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); }
@Override public List<? extends InstanceHostMap> findBadInstanceHostMaps(int count) { return create() .select(INSTANCE_HOST_MAP.fields()) .from(INSTANCE_HOST_MAP) .join(INSTANCE) .on(INSTANCE_HOST_MAP.INSTANCE_ID.eq(INSTANCE.ID)) .where( INSTANCE_HOST_MAP .REMOVED .isNull() .and(INSTANCE.STATE.eq(CommonStatesConstants.PURGED)) .and( INSTANCE_HOST_MAP.STATE.notIn( CommonStatesConstants.DEACTIVATING, CommonStatesConstants.REMOVING))) .limit(count) .fetchInto(InstanceHostMapRecord.class); }
@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); }