use of alien4cloud.exception.NotFoundException in project alien4cloud by alien4cloud.
the class SetSubstitutionCapabilityServiceRelationshipProcessor method process.
@Override
public void process(Csar csar, Topology topology, SetSubstitutionCapabilityServiceRelationshipOperation operation) {
if (topology.getSubstitutionMapping() == null) {
throw new NotFoundException("The substitution capability with id <" + operation.getSubstitutionCapabilityId() + "> cannot be found.");
}
SubstitutionTarget substitutionTarget = safe(topology.getSubstitutionMapping().getCapabilities()).get(operation.getSubstitutionCapabilityId());
if (substitutionTarget == null) {
throw new NotFoundException("The substitution capability with id <" + operation.getSubstitutionCapabilityId() + "> cannot be found.");
}
super.process(csar, topology, substitutionTarget, operation.getRelationshipType(), operation.getRelationshipVersion());
}
use of alien4cloud.exception.NotFoundException in project alien4cloud by alien4cloud.
the class SetSubstitutionRequirementServiceRelationshipProcessor method process.
@Override
public void process(Csar csar, Topology topology, SetSubstitutionRequirementServiceRelationshipOperation operation) {
if (topology.getSubstitutionMapping() == null) {
throw new NotFoundException("The substitution requirement with id <" + operation.getSubstitutionRequirementId() + "> cannot be found.");
}
SubstitutionTarget substitutionTarget = safe(topology.getSubstitutionMapping().getRequirements()).get(operation.getSubstitutionRequirementId());
if (substitutionTarget == null) {
throw new NotFoundException("The substitution requirement with id <" + operation.getSubstitutionRequirementId() + "> cannot be found.");
}
super.process(csar, topology, substitutionTarget, operation.getRelationshipType(), operation.getRelationshipVersion());
}
use of alien4cloud.exception.NotFoundException in project alien4cloud by alien4cloud.
the class AbstractRelationshipProcessor method processNodeOperation.
@Override
protected void processNodeOperation(Csar csar, Topology topology, T operation, NodeTemplate nodeTemplate) {
RelationshipTemplate relationshipTemplate = safe(nodeTemplate.getRelationships()).get(operation.getRelationshipName());
if (relationshipTemplate == null) {
throw new NotFoundException("The relationship with name [" + operation.getRelationshipName() + "] do not exist for the node [" + operation.getNodeName() + "] of the topology [" + topology.getId() + "]");
}
processRelationshipOperation(csar, topology, operation, nodeTemplate, relationshipTemplate);
}
use of alien4cloud.exception.NotFoundException in project alien4cloud by alien4cloud.
the class UpdateRequirementSubstitutionTypeProcessor method process.
@Override
public void process(Csar csar, Topology topology, UpdateRequirementSubstitutionTypeOperation operation) {
if (topology.getSubstitutionMapping() == null || topology.getSubstitutionMapping().getSubstitutionType() == null) {
throw new NotFoundException("No substitution type has been found");
}
Map<String, SubstitutionTarget> substitutionRequirements = topology.getSubstitutionMapping().getRequirements();
if (substitutionRequirements == null) {
throw new NotFoundException("No substitution requirement has been found");
}
SubstitutionTarget target = substitutionRequirements.remove(operation.getSubstitutionRequirementId());
if (target == null) {
throw new NotFoundException("No substitution requirement has been found for key " + operation.getSubstitutionRequirementId());
}
if (substitutionRequirements.containsKey(operation.getNewRequirementId())) {
throw new AlreadyExistException(String.format("Can not rename from <%s> to <%s> since requirement <%s> already exists", operation.getSubstitutionRequirementId(), operation.getNewRequirementId(), operation.getNewRequirementId()));
}
substitutionRequirements.put(operation.getNewRequirementId(), target);
}
use of alien4cloud.exception.NotFoundException in project alien4cloud by alien4cloud.
the class DeploymentEventHandler method checkEnvironmentAuthorization.
private void checkEnvironmentAuthorization(User a4cUser, String environmentId) {
ApplicationEnvironment environment = alienDAO.findById(ApplicationEnvironment.class, environmentId);
if (environment == null) {
log.error("Environment with id [{}] do not exist any more", environmentId);
throw new NotFoundException("Environment with id [" + environmentId + "] do not exist any more");
}
AuthorizationUtil.checkAuthorization(a4cUser, environment, ApplicationRole.APPLICATION_MANAGER, ApplicationEnvironmentRole.values());
}
Aggregations