/* * (c) Copyright 2010-2011 AgileBirds * * This file is part of OpenFlexo. * * OpenFlexo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenFlexo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenFlexo. If not, see <http://www.gnu.org/licenses/>. * */ package org.openflexo.foundation.viewpoint; import org.openflexo.foundation.TemporaryFlexoModelObject; import org.openflexo.foundation.ontology.OntologyLibrary; import org.openflexo.foundation.validation.Validable; import org.openflexo.foundation.validation.ValidationModel; import org.openflexo.foundation.validation.ValidationReport; import org.openflexo.inspector.InspectableObject; import org.openflexo.xmlcode.XMLMapping; public abstract class ViewPointLibraryObject extends TemporaryFlexoModelObject implements InspectableObject, Validable { public static final ViewPointValidationModel VALIDATION_MODEL = new ViewPointValidationModel(); public abstract ViewPointLibrary getViewPointLibrary(); public OntologyLibrary getOntologyLibrary() { if (getViewPointLibrary() != null) { return getViewPointLibrary().getOntologyLibrary(); } return null; } @Override public XMLMapping getXMLMapping() { if (getViewPointLibrary() != null) { return getViewPointLibrary().get_VIEW_POINT_MODEL(); } return super.getXMLMapping(); } /** * Returns a flag indicating if this object is valid according to default validation model * * @return boolean */ @Override public boolean isValid() { return isValid(getDefaultValidationModel()); } /** * Returns a flag indicating if this object is valid according to specified validation model * * @return boolean */ @Override public boolean isValid(ValidationModel validationModel) { return validationModel.isValid(this); } /** * Validates this object by building new ValidationReport object Default validation model is used to perform this validation. */ @Override public ValidationReport validate() { return validate(getDefaultValidationModel()); } /** * Validates this object by building new ValidationReport object Supplied validation model is used to perform this validation. */ @Override public ValidationReport validate(ValidationModel validationModel) { return validationModel.validate(this); } /** * Validates this object by appending eventual issues to supplied ValidationReport. Default validation model is used to perform this * validation. * * @param report * , a ValidationReport object on which found issues are appened */ @Override public void validate(ValidationReport report) { validate(report, getDefaultValidationModel()); } /** * Validates this object by appending eventual issues to supplied ValidationReport. Supplied validation model is used to perform this * validation. * * @param report * , a ValidationReport object on which found issues are appened */ @Override public void validate(ValidationReport report, ValidationModel validationModel) { validationModel.validate(this, report); } @Override public ValidationModel getDefaultValidationModel() { return VALIDATION_MODEL; } }