| /******************************************************************************* |
| * Copyright (c) 2008-2011 Chair for Applied Software Engineering, |
| * Technische Universitaet Muenchen. |
| * 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: |
| ******************************************************************************/ |
| package org.eclipse.emf.emfstore.server.conflictDetection; |
| |
| import org.eclipse.emf.emfstore.server.model.versioning.operations.AbstractOperation; |
| |
| /** |
| * Very basic conflict detection strategy. Will only check if same model element is touched. |
| * |
| * @author koegel |
| */ |
| public class BasicConflictDetectionStrategy implements ConflictDetectionStrategy { |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.emfstore.server.conflictDetection.ConflictDetectionStrategy#doConflict(org.eclipse.emf.emfstore.server.model.versioning.operations.AbstractOperation, |
| * org.eclipse.emf.emfstore.server.model.versioning.operations.AbstractOperation) |
| */ |
| public boolean doConflict(AbstractOperation operationA, AbstractOperation operationB) { |
| return operationA.getModelElementId().equals(operationB.getModelElementId()); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.emfstore.server.conflictDetection.ConflictDetectionStrategy#isRequired(org.eclipse.emf.emfstore.server.model.versioning.operations.AbstractOperation, |
| * org.eclipse.emf.emfstore.server.model.versioning.operations.AbstractOperation) |
| */ |
| public boolean isRequired(AbstractOperation requiredOperation, AbstractOperation operation) { |
| return doConflict(requiredOperation, operation); |
| } |
| } |