3

特定の必須ディメンションが選択されていない場合に、ポストプロセッサを実行しないようにします。たとえば、リスクタイプ、センシカーブ、満期、通貨1、表示通貨と呼ばれるディメンションがあります。また、Rate.Moveと呼ばれる後処理メジャーもあります。これはdoLeafEvaluationを実装します。

私たちのクライアントでは、

  1. センシカーブが選択されていない場合、レートを表示したくありません。リスクタイプがRateRiskの場合に移動します。
  2. 通貨1が選択されていない場合、Rateを表示したくありません。リスクタイプがBasisSwapRiskの場合に移動します。
4

1 に答える 1

2

ポスト プロセッサの内部から、ユーザーが最初に選択したディメンションとレベルを検出する方法は 1 つしかありません (ほとんどの場合、MDX クエリで) 。ポスト プロセッサによって評価された場所を調べます。

これは小さなポスト プロセッサの例です (ActivePivot サンドボックス アプリケーションで実行するように設計されています)。ポスト プロセッサは、コンテキストディメンション (この例では時間ディメンション) を定義します。ユーザーが時間ディメンションを拡張した場合、評価された場所の深さは少なくとも 2 になります (深さ 1 は、そのディメンションに対して AllMember のみが選択されていることを意味します)。次に、その知識に基づいて別のメジャーまたは計算を返すことを決定できます。

/*
 * (C) Quartet FS 2010
 * ALL RIGHTS RESERVED. This material is the CONFIDENTIAL and PROPRIETARY
 * property of Quartet Financial Systems Limited. Any unauthorized use,
 * reproduction or transfer of this material is strictly prohibited
 */
package com.quartetfs.pivot.sandbox.postprocessor.impl;

import java.util.Properties;

import com.quartetfs.biz.pivot.IActivePivot;
import com.quartetfs.biz.pivot.ILocation;
import com.quartetfs.biz.pivot.impl.Util;
import com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor;
import com.quartetfs.fwk.QuartetException;
import com.quartetfs.fwk.QuartetExtendedPluginValue;

/**
 * 
 * @author Quartet FS
 *
 */
@QuartetExtendedPluginValue(
    interfaceName = "com.quartetfs.biz.pivot.postprocessing.IPostProcessor",
    key = ContextualPostProcessor.PLUGIN_TYPE
)
public class ContextualPostProcessor extends ABasicPostProcessor<Double> {

    /** serialVersionUID */
    private static final long serialVersionUID = 4484708084267009957L;

    /** Plugin key */
    static final String PLUGIN_TYPE = "CTX";

    /** Ordinal of the time dimension */
    protected int timeDimensionOrdinal = -1;

    /** Constructor */
    public ContextualPostProcessor(String name, IActivePivot pivot) {
        super(name, pivot);
    }

    @Override
    public String getType() { return PLUGIN_TYPE; }

    @Override
    public void init(Properties properties) throws QuartetException {
        super.init(properties);

        // Store the ordinal of the time dimension
        timeDimensionOrdinal = Util.findDimension(pivot.getDimensions(), "TimeBucket");
    }

    @Override
    protected Double doEvaluation(ILocation location, Object[] underlyingMeasures) throws QuartetException {
        if(location.getLevelDepth(timeDimensionOrdinal - 1) > 1) {
            return (Double) underlyingMeasures[0];
        } else {
            return (Double) underlyingMeasures[1];
        }
    }

}

キューブの説明でポスト プロセッサを宣言する方法は次のとおりです。

    <measure name="ctx" isIntrospectionMeasure="false">

        <!-- This post processor dynamically buckets an underlying measure -->
        <!-- It works together with a dynamic bucket dimension.            -->
        <postProcessor pluginKey="CTX">
            <properties>
                <entry key="id" value="SUM" />
                <entry key="underlyingMeasures" value="pv.SUM,pnl.SUM" />
            </properties>
        </postProcessor>
    </measure>
于 2012-11-14T09:18:08.440 に答える