blob: 11db070a36ab751d1c9523084872ba3207367c0d [file] [log] [blame]
/**
* Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource Munich - initial API and implementation
*/
package org.eclipse.emf.ecp.makeithappen.model.task.util;
import java.util.Map;
import javax.xml.datatype.XMLGregorianCalendar;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EObjectValidator;
import org.eclipse.emf.ecp.makeithappen.model.task.Gender;
import org.eclipse.emf.ecp.makeithappen.model.task.Nationality;
import org.eclipse.emf.ecp.makeithappen.model.task.Task;
import org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage;
import org.eclipse.emf.ecp.makeithappen.model.task.User;
import org.eclipse.emf.ecp.makeithappen.model.task.UserGroup;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage
* @generated
*/
public class TaskValidator extends EObjectValidator {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public static final TaskValidator INSTANCE = new TaskValidator();
/**
* A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic
* {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see org.eclipse.emf.common.util.Diagnostic#getSource()
* @see org.eclipse.emf.common.util.Diagnostic#getCode()
* @generated
*/
public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.ecp.makeithappen.model.task"; //$NON-NLS-1$
/**
* The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Has Name' of 'Task'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public static final int TASK__HAS_NAME = 1;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants in a
* derived class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public TaskValidator() {
super();
}
/**
* Returns the package of this validator switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EPackage getEPackage() {
return TaskPackage.eINSTANCE;
}
/**
* Calls <code>validateXXX</code> for the corresponding classifier of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
switch (classifierID)
{
case TaskPackage.TASK:
return validateTask((Task) value, diagnostics, context);
case TaskPackage.USER:
return validateUser((User) value, diagnostics, context);
case TaskPackage.USER_GROUP:
return validateUserGroup((UserGroup) value, diagnostics, context);
case TaskPackage.GENDER:
return validateGender((Gender) value, diagnostics, context);
case TaskPackage.NATIONALITY:
return validateNationality((Nationality) value, diagnostics, context);
case TaskPackage.DATE_OF_BIRTH:
return validateDateOfBirth((XMLGregorianCalendar) value, diagnostics, context);
default:
return true;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateTask(Task task, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (!validate_NoCircularContainment(task, diagnostics, context)) {
return false;
}
boolean result = validate_EveryMultiplicityConforms(task, diagnostics, context);
if (result || diagnostics != null) {
result &= validate_EveryDataValueConforms(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_EveryReferenceIsContained(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_EveryBidirectionalReferenceIsPaired(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_EveryProxyResolves(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_UniqueID(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_EveryKeyUnique(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validate_EveryMapEntryUnique(task, diagnostics, context);
}
if (result || diagnostics != null) {
result &= validateTask_hasName(task, diagnostics, context);
}
return result;
}
/**
* Validates the hasName constraint of '<em>Task</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateTask_hasName(Task task, DiagnosticChain diagnostics, Map<Object, Object> context) {
return task.hasName(diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateUser(User user, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(user, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateUserGroup(UserGroup userGroup, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(userGroup, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateGender(Gender gender, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateNationality(Nationality nationality, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean validateDateOfBirth(XMLGregorianCalendar dateOfBirth, DiagnosticChain diagnostics,
Map<Object, Object> context) {
return true;
}
/**
* Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
// TODO
// Specialize this to return a resource locator for messages specific to this validator.
// Ensure that you remove @generated or mark it @generated NOT
return super.getResourceLocator();
}
} // TaskValidator