コード例 #1
0
  protected ValidationResult vnicProfileNotUsed(
      List<? extends Nameable> entities,
      EngineMessage entitiesReplacementPlural,
      EngineMessage entitiesReplacementSingular) {
    if (entities.isEmpty()) {
      return ValidationResult.VALID;
    }

    Collection<String> replacements =
        ReplacementUtils.replaceWithNameable("ENTITIES_USING_VNIC_PROFILE", entities);
    EngineMessage replacementMessageToUse =
        entities.size() == 1 ? entitiesReplacementSingular : entitiesReplacementPlural;
    replacements.add(replacementMessageToUse.name());
    return new ValidationResult(
        getVNicProfileInUseValidationMessage(entities.size()), replacements);
  }
コード例 #2
0
 private void failWith(EngineMessage failure) {
   getQueryReturnValue().setExceptionString(failure.name());
   getQueryReturnValue().setSucceeded(false);
 }
コード例 #3
0
 /**
  * Helper factory method that creates a pair of locking group and error message that would be
  * displayed when lock cannot be acquired
  *
  * @param group locking group
  * @param message message to be shown when the lock cannot be acquired
  * @return {@link Pair} of the given locking group and error message as Strings
  */
 public static Pair<String, String> makeLockingPair(LockingGroup group, EngineMessage message) {
   return makeLockingPair(group, message.name());
 }