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);
  }
 public static Status getErrorStatus(String error) {
   try {
     ErrorType errorType = EngineMessage.getErrorType(error);
     return getStatus(errorType);
   } catch (Exception e) {
     return null;
   }
 }
 private boolean verifyCanDoActionMessagesContainMessage(EngineMessage message) {
   return command.getReturnValue().getCanDoActionMessages().contains(message.toString());
 }
 private void failWith(EngineMessage failure) {
   getQueryReturnValue().setExceptionString(failure.name());
   getQueryReturnValue().setSucceeded(false);
 }
 /**
  * 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());
 }
Exemple #6
0
 private void validateFailedWithReason(final EngineMessage message) {
   assertFalse(cmd.validate());
   assertTrue(cmd.getReturnValue().getValidationMessages().contains(message.toString()));
 }