@Override public List<? extends Service> findServicesNonRemovedLinksOnly(Instance instance) { return create() .select(SERVICE.fields()) .from(SERVICE) .join(SERVICE_EXPOSE_MAP) .on(SERVICE_EXPOSE_MAP.SERVICE_ID.eq(SERVICE.ID)) .where( SERVICE_EXPOSE_MAP .INSTANCE_ID .eq(instance.getId()) .and(SERVICE_EXPOSE_MAP.REMOVED.isNull())) .fetchInto(ServiceRecord.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); }