Exemplo n.º 1
0
 @Override
 public List<? extends Instance> findUnallocatedInstanceByDeploymentUnitUuid(
     long accountId, String deploymentUnitUuid) {
   return create()
       .select(INSTANCE.fields())
       .from(INSTANCE)
       .leftOuterJoin(INSTANCE_HOST_MAP)
       .on(INSTANCE_HOST_MAP.INSTANCE_ID.eq(INSTANCE.ID))
       .where(
           INSTANCE
               .REMOVED
               .isNull()
               .and(INSTANCE_HOST_MAP.ID.isNull())
               .and(INSTANCE.DEPLOYMENT_UNIT_UUID.eq(deploymentUnitUuid))
               .and(INSTANCE.ALLOCATION_STATE.eq(CommonStatesConstants.INACTIVE)))
       .fetchInto(InstanceRecord.class);
 }
Exemplo n.º 2
0
  public List<Instance> getUnmappedDeploymentUnitInstances(String deploymentUnitUuid) {
    List<? extends Instance> instanceRecords =
        create()
            .select(INSTANCE.fields())
            .from(INSTANCE)
            .leftOuterJoin(INSTANCE_HOST_MAP)
            .on(
                INSTANCE_HOST_MAP
                    .INSTANCE_ID
                    .eq(INSTANCE.ID)
                    .and(INSTANCE_HOST_MAP.REMOVED.isNull()))
            .where(INSTANCE.REMOVED.isNull())
            .and(INSTANCE.DEPLOYMENT_UNIT_UUID.eq(deploymentUnitUuid))
            .and(INSTANCE_HOST_MAP.ID.isNull())
            .fetchInto(InstanceRecord.class);

    List<Instance> instances = new ArrayList<Instance>();
    for (Instance i : instanceRecords) {
      instances.add(i);
    }
    return instances;
  }