| パッケージ | mx.data |
| クラス | public class ConflictDetector |
| 継承 | ConflictDetector Object |
| 言語バージョン: | 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 で示されます。
パブリックプロパティ
パブリックメソッド
| メソッド | 定義元 | ||
|---|---|---|---|
ConflictDetector(dataService:ConcreteDataService)
デフォルトの競合検出メカニズムのインスタンスを作成します。 | ConflictDetector | ||
リモート宛先から create 操作がプッシュされて処理されると、DataService によって呼び出されます。 | ConflictDetector | ||
リモート宛先から delete 操作がプッシュされて処理されると、DataService によって呼び出されます。 | ConflictDetector | ||
リモート宛先から remove from fill 操作がプッシュされて処理されると、DataService によって呼び出されます。 | ConflictDetector | ||
リモート宛先から update 操作がプッシュされて処理されると、DataService によって呼び出されます。 | ConflictDetector | ||
![]() |
オブジェクトに指定されたプロパティが定義されているかどうかを示します。 | Object | |
![]() |
Object クラスのインスタンスが、パラメーターとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。 | Object | |
![]() |
指定されたプロパティが存在し、列挙できるかどうかを示します。 | Object | |
![]() |
ループ処理に対するダイナミックプロパティの可用性を設定します。 | Object | |
![]() |
ロケール固有の規則に従って書式設定された、このオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのストリング表現を返します。 | Object | |
![]() |
指定されたオブジェクトのプリミティブな値を返します。 | Object | |
コンストラクターの詳細
ConflictDetector | () | コンストラクター |
public function ConflictDetector(dataService:ConcreteDataService)| 言語バージョン: | ActionScript 3.0 |
| 製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
| ランタイムバージョン: | Flash Player 9, AIR 1.1 |
デフォルトの競合検出メカニズムのインスタンスを作成します。
パラメーターdataService:ConcreteDataService — この競合検出メカニズムを使用するデータサービスへの ConcreteDataService 参照です。
|
メソッドの詳細
checkCreate | () | メソッド |
public function checkCreate(remoteChange:IChangeObject, localChange:IChangeObject):void| 言語バージョン: | ActionScript 3.0 |
| 製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
| ランタイムバージョン: | Flash Player 9, AIR 1.1 |
リモート宛先から create 操作がプッシュされて処理されると、DataService によって呼び出されます。
パラメーター
remoteChange:IChangeObject — 現在処理されているリモート変更を表す IChangeObject です。
| |
localChange:IChangeObject — remoteChange パラメーターで参照されているものと同じオブジェクトに対するローカル変更を表す IChangeObject です。remoteChange パラメーターで指定されたアイテムに対してローカルでの変更が加えられていない場合は、この値を null にできます。
|
checkDelete | () | メソッド |
public function checkDelete(remoteChange:IChangeObject, localChange:IChangeObject):void| 言語バージョン: | ActionScript 3.0 |
| 製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
| ランタイムバージョン: | Flash Player 9, AIR 1.1 |
リモート宛先から delete 操作がプッシュされて処理されると、DataService によって呼び出されます。
パラメーター
remoteChange:IChangeObject — 現在処理されているリモート変更を表す IChangeObject です。
| |
localChange:IChangeObject — remoteChange パラメーターで参照されているものと同じオブジェクトに対するローカル変更を表す IChangeObject です。remoteChange パラメーターで指定されたアイテムに対してローカルでの変更が加えられていない場合は、この値を null にできます。
|
checkRemoveFromFill | () | メソッド |
public function checkRemoveFromFill(localChange:IChangeObject, fillParameters:Object):void| 言語バージョン: | ActionScript 3.0 |
| 製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
| ランタイムバージョン: | Flash Player 9, AIR 1.1 |
リモート宛先から remove from fill 操作がプッシュされて処理されると、DataService によって呼び出されます。
パラメーター
localChange:IChangeObject — 指定した fill 操作から削除するようにサーバーが示しているアイテムのローカルバージョンを表す IChangeObject です。
| |
fillParameters:Object — アイテムを削除する fill 操作を示す fill パラメーターです。
|
checkUpdate | () | メソッド |
public function checkUpdate(remoteChange:IChangeObject, localChange:IChangeObject):void| 言語バージョン: | ActionScript 3.0 |
| 製品バージョン: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
| ランタイムバージョン: | Flash Player 9, AIR 1.1 |
リモート宛先から update 操作がプッシュされて処理されると、DataService によって呼び出されます。
パラメーター
remoteChange:IChangeObject — 現在処理されているリモート変更を表す IChangeObject です。
| |
localChange:IChangeObject — remoteChange パラメーターで参照されているものと同じオブジェクトに対するローカル変更を表す IChangeObject です。remoteChange パラメーターで指定されたアイテムに対してローカルでの変更が加えられていない場合は、この値を null にできます。
|
例 この例の使用方法
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
継承されるパブリックプロパティを隠す
継承されるパブリックプロパティを表示