Pacote | mx.data |
Classe | public class ConflictDetector |
Herança | ConflictDetector ![]() |
Versão da linguagem: | ActionScript 3.0 |
Versão de produto: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Versões de runtime: | Flash Player 9, AIR 1.1 |
It has three methods that are used to determine if a conflict exists when
processing a pushed operation, checkCreate()
, checkDelete()
, and
checkUpdate()
.
Each of these methods is called for the corresponding operation with two
parameters, the local and the remote change.
If you want to customize how conflicts are detected on the client, you can extend this class and augment the behavior as needed to match remote assembler logic.
The following code provides examples of how these methods can be used to indicate a conflict has occurred. Conflicts are always indicated on the remoteChange.
Propriedades públicas
Métodos públicos
Método | Definido por | ||
---|---|---|---|
![]() |
Indica se um objeto tem uma propriedade especificada definida. | Object | |
![]() |
Indica se uma ocorrência da classe Object está na cadeia de protótipos do objeto especificado como o parâmetro. | Object | |
![]() |
Indica se a propriedade especificada existe e é enumerável. | Object | |
![]() |
Define a disponibilidade de uma propriedade dinâmica para operações de repetição. | Object | |
![]() |
Retorna a representação da string deste objeto, formatado segundo as convenções específicas para a localidade. | Object | |
![]() |
Retorna a representação de string do objeto especificado. | Object | |
![]() |
Retorna o valor primitivo do objeto especificado. | Object |
Detalhes do construtor
Detalhes do método
Exemplos Como usar este exemplo
override public function checkCreate(remoteChange:IChangeObject, localChange:IChangeObject):void { // if we have created a local item that is the same item as the remote // change then we have a conflict if (localChange != null && ObjectUtil.compare(remoteChange.identity, localChange.identity) == 0) { remoteChange.conflict("Local created item is in conflict with remotely created item", localChange.changedPropertyNames); } } override public function checkDelete(remoteChange:IChangeObject, localChange:IChangeObject):void { // if we have an update locally for an item that was deleted remotely // that is considered a conflict. if (localChange != null) { if (localChange.isUpdate()) { remoteChange.conflict("Local item was updated and is in conflict with pushed delete.", localChange.changedPropertyNames); } } } override public function checkUpdate(remoteChange:IChangeObject, localChange:IChangeObject):void { // get a list of all of the changed properties var changes:Array = remoteChange.changedPropertyNames; // get the remote state of the item's properties var newVersion:Object = remoteChange.newVersion; var prevVersion:Object = localChange.previousVersion; // properties will be in conflict if the old value of a property on the // local item is different from the same property value of the new version // of the remote item. var conflictingProps:Array = []; for (var i:int=0; i<changes.length; i++) { var prop:Object = changes[i]; // could be a String or QName if (ObjectUtil.compare(prevVersion[prop], newVersion[prop]) != 0) { conflictingProps.push(prop); } } if (conflictingProps.length > 0) { remoteChange.conflict("Local item has changes to properties that conflict with remote change.", conflictingProps); } }
Wed Jun 13 2018, 11:10 AM Z