blob: 4b3ea781c9270ce179b3868eaead4a328ede0113 [file] [log] [blame]
// *****************************************************************************
// Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
// 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:
// Pierre Allard - initial API and implementation
// Regent L'Archeveque
// Olivier L. Larouche
//
// SPDX-License-Identifier: EPL-1.0
// *****************************************************************************
@GenModel(prefix="ApogyCommonTransaction",
copyrightText="*******************************************************************************
Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
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:
Pierre Allard - initial API and implementation
Regent L'Archeveque,
Olivier L. Larouche
SPDX-License-Identifier: EPL-1.0
*******************************************************************************",
childCreationExtenders="true",
modelName="ApogyCommonTransaction")
@GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates")
@GenModel(modelDirectory="/org.eclipse.apogy.common.emf.transaction/src-gen")
package org.eclipse.apogy.common.emf.transaction
import java.util.Collection
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EStructuralFeature
import org.eclipse.emf.edit.command.AbstractOverrideableCommand
import org.eclipse.emf.transaction.TransactionalEditingDomain
import org.eclipse.apogy.common.Apogy
// Tyoes
type TransactionalEditingDomain wraps TransactionalEditingDomain
type Collection wraps Collection<?>
type AbstractOverrideableCommand wraps AbstractOverrideableCommand
/**
* Facade for Transactions. This provides tools to process and manage EMF Transaction.
*/
@Apogy(isSingleton="true", hasCustomClass="true")
class ApogyCommonTransactionFacade
{
/**
* Returns the default Apogy {@link TransactionalEditingDomain).
* @return Reference to the Apogy {@link TransactionalEditingDomain).
*/
op TransactionalEditingDomain getDefaultEditingDomain()
/**
* Puts the specified {@link EObject} inside a {@link ResourceSet} that uses a {@link TransactionalEditingDomain}.
* It is important to remove the {@link EObject} from the temporary {@link TransactionalEditingDomain} with
* {@link #org.eclipse.apogy.common.emf.transaction.impl.ApogyCommonTransactionFacadeImpl.removeFromEditingDomain(EObject eObject) removeFromEditingDomain(EObject eObject)}
* when the temporary {@link TransactionalEditingDomain}
* is no longer needed to be able to save the modification made to the {@link EObject}.
* @param eObject The reference to the {@link EObject}.
*/
op void addInTempTransactionalEditingDomain(EObject eObject)
/**
* Removes the specified {@link EObject}'s {@link Resource} from it's {@link ResourceSet}.
* Then, disconnect the {@link Resource} from it's {@link TransactionalEditingDomain}.
* @param eObject The reference to the {@link EObject}.
*/
op void removeFromEditingDomain(EObject eObject)
/**
* Verifies if child can be set in parent. Intended for internal use.
* @param owner The owner of the feature.
* @param feature The feature. Used to determine if the feature is a containment or a reference.
* @param value The value to be assigned to the feature.
* @param fix True will attempt to remove the value from it current editing domain to make the set operation valid.
* @return true if a set or add can be executed, false otherwise.
*/
op int areEditingDomainsValid(EObject owner, EStructuralFeature feature, Object value, boolean fix)
/**
* Set an eObject's feature to a specified value through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to set.
* @param value The new value of the feature.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicSet(EObject owner, EStructuralFeature feature, Object value, boolean fix)
/**
* Set an eObject's feature to a specified value through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to set.
* @param value The new value of the feature.
*/
op void basicSet(EObject owner, EStructuralFeature feature, Object value)
/**
* Adds a value to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to add the value to. This feature needs to be a list.
* @param value The value to add.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicAdd(EObject owner, EStructuralFeature feature, Object value, boolean fix)
/**
* Adds a value to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to add the value to. This feature needs to be a list.
* @param value The value to add.
*/
op void basicAdd(EObject owner, EStructuralFeature feature, Object value)
/**
* Adds a collection of values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to add the values to. This feature needs to be a list.
* @param value The collection of values to add.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicAdd(EObject owner, EStructuralFeature feature, Collection collection, boolean fix)
/**
* Adds a collection of values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to add the values to. This feature needs to be a list.
* @param value The collection of values to add.
*/
op void basicAdd(EObject owner, EStructuralFeature feature, Collection collection)
/**
* Removes a value to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the value from. This feature needs to be a list.
* @param value The value to remove.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicRemove(EObject owner, EStructuralFeature feature, Object value, boolean fix)
/**
* Removes a value to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the value from. This feature needs to be a list.
* @param value The value to remove.
*/
op void basicRemove(EObject owner, EStructuralFeature feature, Object value)
/**
* Removes a collection of values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the values from. This feature needs to be a list.
* @param value The collection of values to remove.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicRemove(EObject owner, EStructuralFeature feature, Collection collection, boolean fix)
/**
* Removes a collection of values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the values from. This feature needs to be a list.
* @param value The collection of values to remove.
*/
op void basicRemove(EObject owner, EStructuralFeature feature, Collection collection)
/**
* Removes all values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the all the values from. This feature needs to be a list.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicClear(EObject owner, EStructuralFeature feature, boolean fix)
/**
* Removes all values to an eObject's feature through a transaction.
* @param owner The owner of the feature.
* @param feature The feature to remove the all the values from. This feature needs to be a list.
*/
op void basicClear(EObject owner, EStructuralFeature feature)
/**
* Delete an eObject's feature through a transaction. If the feature is a list, the value specified is remove from the
* list, if the feaure is a single value, it is set to null.
* @param owner The owner of the feature.
* @param feature The feature to delete the value from. This feature can be a single element or a list.
* @param value The value to remove if the feature is a list. Ignored if the feature is a single value.
* @param fix If true will ensure the value and owner editing domains are forced to make the transaction valid,
* false will attempt the transaction without forcing the editing domains.
*/
op void basicDelete(EObject owner, EStructuralFeature feature, Object value, boolean fix)
/**
* Delete an eObject's feature through a transaction. If the feature is a list, the value specified is remove from the
* list, if the feaure is a single value, it is set to null.
* @param owner The owner of the feature.
* @param feature The feature to delete the value from. This feature can be a single element or a list.
* @param value The value to remove if the feature is a list. Ignored if the feature is a single value.
*/
op void basicDelete(EObject owner, EStructuralFeature feature, Object value)
/**
* Execute a AbstractOverrideableCommand which implements a transaction on a TransactionalEditingDomain.
* @param The AbstractOverrideableCommand.
*/
op void executeCommand(AbstractOverrideableCommand command)
/**
* Gets the TransactionalEditingDomain associated with an EObject.
* @param eObject The EObject.
* @return The TransactionalEditingDomain, null if none is found.
*/
op TransactionalEditingDomain getTransactionalEditingDomain(EObject eObject)
}