Tabnine Logo
ValidationException
Code IndexAdd Tabnine to your IDE (free)

How to use
ValidationException
in
ch.puzzle.itc.mobiliar.business.utils

Best Java code snippets using ch.puzzle.itc.mobiliar.business.utils.ValidationException (Showing top 10 results out of 315)

origin: liimaorg/liima

/**
 * Validate all arguments. If at least one argument is either null or empty an exception is thrown
 */
public static void validateNotNullOrEmptyChecked(String... arguments) throws ValidationException {
  for (String argument : arguments) {
    if (argument == null || argument.isEmpty()) {
      throw new ValidationException("Argument must not be null or empty");
    }
  }
}
origin: liimaorg/liima

@Test
public void deleteFunctionWhenOverwrittenByFunctionShouldAddOverwritingFunctionToException() throws NotFoundException {
  // given
  functionA_ID_4.overwrite(functionA_ID_3);
  functionA_ID_3.setResource(resource);
  assertTrue(functionA_ID_3.isOverwrittenBySubTypeOrResourceFunction());
  when(functionRepositoryMock.find(ID_3)).thenReturn(functionA_ID_3);
  // when
  try {
    functionsBoundary.deleteFunction(functionA_ID_3.getId());
  } catch (ValidationException e) {
    assertTrue(e.hasCausingObject());
    assertEquals(functionA_ID_4, e.getCausingObject());
  }
}
origin: liimaorg/liima

  @HasPermission(permission = Permission.MANAGE_DEPLOYMENT_PARAMETER, action = CREATE)
  public void createDeployParameterKey(String deployParameterKeyName) throws ValidationException {
    if (deployParameterKeyName != null && !deployParameterKeyName.trim().isEmpty()) {
      Key newKey = new Key(deployParameterKeyName.trim());
      if (keyRepository.findFirstKeyByName(newKey.getName()) != null) {
        throw new ValidationException("a key with same name exists", deployParameterKeyName);
      }
      keyRepository.createDeployParameterKey(newKey);
    } else {
      throw new ValidationException("invalid empty name", deployParameterKeyName);
    }
  }
}
origin: liimaorg/liima

@HasPermission(permission = Permission.MANAGE_DEPLOYMENT_PARAMETER, action = UPDATE)
public void changeDeployParameterKey(Integer keyToDeleteId, String changedName) throws ValidationException {
  if (changedName != null && !changedName.trim().isEmpty()) {
    Key attachedKeyToChange = keyRepository.find(Objects.requireNonNull(keyToDeleteId, "Must not be null"));
    attachedKeyToChange.setName(changedName);
    keyRepository.merge(attachedKeyToChange);
  } else {
    throw new ValidationException("invalid empty name", changedName);
  }
}
origin: liimaorg/liima

protected void verifyDefaultPropertyCanBeSet(ResourceEditProperty property, ContextEntity context) throws ValidationException {
  if (isSameValue(property.getDefaultValue(), property.getPropertyValue())) {
    if (context.isGlobal()) {
      // do not overwrite property value
      throw new ValidationException("The default value of property \"" + property.getPropertyDisplayName() + "\" can not be set on global context");
    }
    if (property.getParent() == null && property.getOriginalValue() == null) {
      throw new ValidationException("The default value of property \"" + property.getPropertyDisplayName() + "\" can not be set unless it overwrites a value defined on a parent context");
    }
  }
}
origin: liimaorg/liima

/**
 * Creates a new Function for a ResourceType with miks
 */
public AmwFunctionEntity createNewResourceTypeFunction(AmwFunctionEntity amwFunction, Integer resourceTypeId,
                            Set<String> functionMikNames) throws ValidationException, AMWException {
  ResourceTypeEntity resourceType = resourceTypeRepository.find(resourceTypeId);
  permissionBoundary.checkPermissionAndFireException(Permission.RESOURCETYPE_AMWFUNCTION, null, Action.CREATE,
      null, resourceType, "missing Permission to create ResourceType functions");
  // search for already existing functions with this name on functiontree
  List<AmwFunctionEntity> allFunctionsWithName = functionService.findFunctionsByNameInNamespace(resourceType, amwFunction.getName());
  if (allFunctionsWithName.isEmpty()) {
    amwFunction.setResourceType(resourceType);
    freemarkerValidator.validateFreemarkerSyntax(amwFunction.getDecoratedImplementation());
    functionService.saveFunctionWithMiks(amwFunction, functionMikNames);
  } else {
    throw new ValidationException("Function name already in use", allFunctionsWithName.get(0));
  }
  return amwFunction;
}
origin: liimaorg/liima

/**
 * Creates a new Function for a Resource with miks
 */
public AmwFunctionEntity createNewResourceFunction(AmwFunctionEntity amwFunction, Integer resourceId,
                          Set<String> functionMikNames) throws ValidationException, AMWException {
  ResourceEntity resource = resourceRepository.find(resourceId);
  permissionBoundary.checkPermissionAndFireException(Permission.RESOURCE_AMWFUNCTION, null, Action.CREATE,
      resource.getResourceGroup(), resource.getResourceType(), "missing Permission to create Resource functions");
  // search for already existing functions with this name on functiontree
  List<AmwFunctionEntity> allFunctionsWithName = functionService.findFunctionsByNameInNamespace(resource, amwFunction.getName());
  if (allFunctionsWithName.isEmpty()) {
    amwFunction.setResource(resource);
    freemarkerValidator.validateFreemarkerSyntax(amwFunction.getDecoratedImplementation());
    functionService.saveFunctionWithMiks(amwFunction, functionMikNames);
  } else {
    throw new ValidationException("Function name already in use", allFunctionsWithName.get(0));
  }
  return amwFunction;
}
origin: liimaorg/liima

public void deleteFunction(Integer selectedFunctionIdToBeRemoved) throws ValidationException, NotFoundException {
  Objects.requireNonNull(selectedFunctionIdToBeRemoved, "Resource Type Entity must not be null");
  AmwFunctionEntity functionToDelete = functionRepository.find(selectedFunctionIdToBeRemoved);
  if (functionToDelete == null) {
    throw new NotFoundException("No function entity found for id " + selectedFunctionIdToBeRemoved);
  }
  if (functionToDelete.getResource() == null && functionToDelete.getResourceType() != null) {
    permissionBoundary.checkPermissionAndFireException(Permission.RESOURCETYPE_AMWFUNCTION, null, Action.DELETE,
        null, functionToDelete.getResourceType(), "missing Permission to delete ResourceType functions");
  } else {
    permissionBoundary.checkPermissionAndFireException(Permission.RESOURCE_AMWFUNCTION, null, Action.DELETE,
        functionToDelete.getResource().getResourceGroup(), null,
        "missing Permission to delete Resource functions");
  }
  if (!functionToDelete.isOverwrittenBySubTypeOrResourceFunction()) {
    functionService.deleteFunction(functionToDelete);
  } else {
    throw new ValidationException("Can not delete function because it is overwritten by at least one sub resource type or resource function", functionToDelete.getOverwritingChildFunction().iterator().next());
  }
}
origin: liimaorg/liima

throw new ValidationException("Resource '" + slaveGroupName + "' is already provided by another ResourceGroup");
origin: liimaorg/liima

public void setPropertyValue(ContextDependency<?> resourceContext, Integer propertyDescriptorId, String unobfuscatedValue) throws ValidationException {
  PropertyEntity p = resourceContext.getPropertyForDescriptor(propertyDescriptorId);
  if (p == null) {
    PropertyDescriptorEntity propertyDescriptor = entityManager.find(PropertyDescriptorEntity.class, propertyDescriptorId);
    p = new PropertyEntity();
    p.setDescriptor(propertyDescriptor);
    p.setOwningResource(resourceContext);
    resourceContext.addProperty(p);
  }
  if (!propertyValidationService.canPropertyValueBeSetOnContext(p.getDescriptor(), resourceContext)) {
    throw new ValidationException("The property " + p.getDescriptor() + " can not be set on context " + resourceContext.getContext());
  }
  p.setValue(unobfuscatedValue);
}
ch.puzzle.itc.mobiliar.business.utilsValidationException

Most used methods

  • <init>
  • getCausingObject
  • hasCausingObject

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now