パッケージ | mx.data |
クラス | public class ConflictDetector |
継承 | ConflictDetector ![]() |
言語バージョン: | ActionScript 3.0 |
製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
ランタイムバージョン: | Flash Player 9, AIR 1.1 |
プッシュされた操作を処理するときに競合が発生したかどうかを判定するために使用されるメソッドには、checkCreate()
、checkDelete()
、および checkUpdate()
の 3 種類があります。各メソッドは対応する操作に関して呼び出され、ローカルとリモートの変更を 2 つのパラメーターとして使用します。
クライアントでの競合の検出方法をカスタマイズするには、このクラスを拡張し、リモートアセンブラーのロジックと一致するように必要に応じて動作を修正します。
次のコードは、これらのメソッドを使用して競合が発生したことを通知する方法の例を示しています。競合は常に remoteChange で示されます。
パブリックプロパティ
パブリックメソッド
メソッド | 定義元 | ||
---|---|---|---|
![]() |
オブジェクトに指定されたプロパティが定義されているかどうかを示します。 | Object | |
![]() |
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。 | Object | |
![]() |
指定されたプロパティが存在し、列挙できるかどうかを示します。 | Object | |
![]() |
ループ処理に対するダイナミックプロパティの可用性を設定します。 | Object | |
![]() |
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのプリミティブな値を返します。 | Object |
コンストラクターの詳細
メソッドの詳細
例 この例の使用方法
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); } }
Tue Jun 12 2018, 10:34 AM Z