Beispiel #1
0
 public Condition getInstanceHostConstraint(Instance instance) {
   if (StringUtils.isEmpty(instance.getDeploymentUnitUuid())) {
     return INSTANCE_HOST_MAP.INSTANCE_ID.eq(instance.getId());
   } else {
     return INSTANCE.DEPLOYMENT_UNIT_UUID.eq(instance.getDeploymentUnitUuid());
   }
 }
Beispiel #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;
  }