機械翻訳について

拡張機能を使用したメッセージの管理

拡張機能のメッセージを使用して、データの取得と表示を行います。

検証例外の管理

検証エラーを表示するために、Order Managementは検証例外を作成し、失敗した拡張の実行を停止してから、設定した拡張ポイントに対して後続の拡張を実行します。

オーダー管理では、拡張ポイントで実行されるすべての拡張機能の検証例外から作成される各メッセージが蓄積され、オーダー入力スペシャリストに一緒に表示されます。ソース・システムからのソース・オーダーの場合は、webサービス・コールを介してコール元にレスポンスして返されます。

オーダー管理で検証例外が作成された場合、拡張コードは失敗の原因を説明するメッセージを送信する必要があります。 次のいずれかを実行する必要があります:

  • 「拡張機能へのメッセージ・テキストの追加」. 分散オーダー・オーケストレーションをメッセージのアプリケーションとして指定する必要があります。 オーダー管理では、このテキストが変更なしでオーダー管理作業領域に表示されます。

  • 「拡張にOracleメッセージおよびメッセージ・パラメータの名前を追加」. オーダー管理は、Oracleメッセージ・リポジトリからメッセージを取得し、メッセージが参照するメッセージ・トークンを移入し、オーダー管理作業領域にメッセージを表示し、メッセージ・ログに追加します。 「メッセージの管理」ページを使用してメッセージを作成できます。 詳細は、「オーダー管理でのメッセージの設定」を参照してください。

このトピックでは、ValidationExceptionについてよく説明します。 詳細は、「Order Managementの拡張機能で使用できるメソッド」を参照してください。

このコードを使用して、検証例外を作成します。

コード

説明

import oracle.apps.scm.doo.common.extensions.ValidationException;

ValidationExceptionクラスをインポートします。

def salesCredits = header.getAttribute("SalesCredits");

オーダー・ヘッダーが参照する販売実績の行セットを取得します。

while( salesCredits.hasNext() )

追加の販売実績行が存在するかどうかを決定します。

def salesCredit = salesCredits.next();

次の販売実績行を取得します。

if( "1".equals(salesCredit.getAttribute("SalesCreditTypeCode")) )

販売実績が収益率かどうかを決定します。

def percent = salesCredit.getAttribute("Percent");

販売実績の割当率を取得します。

if( percent < 30 ) {

パーセントが30未満の場合は、検証エラーを作成します。

def tokens = [SALESPERSON: salesCredit.getAttribute("Salesperson"), PERCENT: percent];

ValidationExceptionに送信するトークン値を指定します。

throw new ValidationException("SALES_CREDIT_TOO_LOW_MSG", tokens);

例外を作成し、実行を停止します。

これはコメントなしで同じコードです。

import oracle.apps.scm.doo.common.extensions.ValidationException;
def salesCredits = header.getAttribute("SalesCredits");                                          
while( salesCredits.hasNext() ) {                                                                
def salesCredit = salesCredits.next();                                                         
if( "1".equals(salesCredit.getAttribute("SalesCreditTypeCode")) ) {                            
  def percent = salesCredit.getAttribute("Percent");                                           
  if( percent < 30 ) {                                                                        
def tokens = [SALESPERSON: salesCredit.getAttribute("Salesperson"), PERCENT: percent];     
    throw new ValidationException("SALES_CREDIT_TOO_LOW_MSG", tokens);   
    }
  } 
}

メッセージのハード・コーディング

次に、メッセージ・テキストをハード・コードする検証例外を作成するバリエーションを示します。 def tokensおよびthrow newをこのコードに置き換えます。

String messageText = "The " + percent  + "% sales credit for salesperson " + salesperson + " is less than the required minimum, which is 30%.";
throw new ValidationException(messageText);

たとえば、percentが20で、salespersonがDiane Choと等しい場合、実行時に表示されるテキストを次に示します。

The 20% sales credit for salesperson Diane Cho is less than the required minimum, which is 30%.

リファレンス・リクエスト関数

オーダー管理に事前定義されているデフォルト機能ではなく、定義したリクエスト機能を参照する検証例外を作成するバリエーションを次に示します。 def tokensおよびthrow newをこのコードに置き換えます。

def tokens = [SALESPERSON: salesCredit.getAttribute("Salesperson"), PERCENT: percent];
throw new ValidationException("ORA_CUSTOM_REQ_FUNCTION", "SALES_CREDIT_TOO_LOW_MSG", tokens);

予期しない例外の処理

保存時拡張ポイントで予期しない例外を処理します。

import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;
import oracle.apps.scm.doo.common.extensions.Person;

String poNumber = header.getAttribute("CustomerPONumber");
if (poNumber == null) return;
if (!poNumber.startsWith("UnexpectedExceptionOnSave_run_extension")) return;

List < Message > messages = new ArrayList < Message > ();

//Test DOO:::DOO_CX_EXECUTION_ERROR for NoDataFoundException when setAttribute on header
//An error occurred when running extension **, during event **: JBO-25002: Definition ** of type Attribute is not found..
//header.setAttribute("NonExistAttribute", "anyvalue");  //An error occurred when running extension UnexpectedExceptionOnSave, during event On Save: JBO-25058: Definition NonExistAttribute of type Attribute is not found in Header..
//header.getAttribute("HeaderAddresses");  //HeaderEffCategories

//Test DOO:::DOO_CX_ATTRIB_NO_DATA
//Expected message: A value could not be assigned to attribute {ATTRIBUTE}, while running extension {EXTENSION}, during event {EVENT}, because no data was found.
//Acutally got: An error occurred when running extension UnexpectedExceptionOnSave, during event On Save: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.apps.scm.doo.common.extensions.NoDataFoundException, msg=No data was found using the provided parameters.
def person = new Person("First Name", "Last Name");
header.setBillToAccount(person);

//header.setAttribute("FreezePriceFlag", "1231");   //Error message: Value 100 for field FreezePriceFlag exceeds the maximum length allowed.

//def lines = header.getAttribute("Lines");
//if (lines.hasNext()) {
//def line = lines.next();
//Test DOO:::DOO_CX_ATTRIB_NO_DATA for NoDataFoundException when setAttribute on line 
//line.setAttribute("NonExistAttribute", "anyvalue");

//Test DOO:::DOO_CX_CONN_NOT_FOUND for ServiceDetailNotFound when invokeSoapService
//def itemNumber = line.getAttribute("ProductNumber");
//String payLoad = "<ns1:GetSalesCreditAllocation xmlns:ns1=\"http://www.yourCompany.com/SalesCreditWS/\">" +
//"<ns1:poNumber>" + poNumber + "</ns1:poNumber>" + 
//"<ns1:itemNumber>" + itemNumber + "</ns1:itemNumber>" +
//"</ns1:GetSalesCreditAllocation>";
//Correct integration name is SalesCreditAllocationService
//def responseBody = (context.invokeSoapService("SalesCreditAllocationService", payLoad)).getSoapBody(); 
////def serviceInvoker = context.getServiceInvoker();
////def responseBody = (serviceInvoker.invokeSoapService("SalesCreditAllocationService", payLoad)).getSoapBody(); 
//messages.add(responseBody);


//}

//ValidationException ex = new ValidationException(messages);
//throw ex;

請求アプリケーションがすでに支払を承認している場合は、この拡張を実行して、ユーザーが販売オーダーの改訂時に支払属性を編集できないようにします。 発行リクエスト終了時拡張ポイントで実行します。

import oracle.apps.scm.doo.common.extensions.ValidationException;

import oracle.apps.scm.doo.common.extensions.Message;

if (!"PreAuthExtension".equals(header.getAttribute("CustomerPONumber"))) return;

String messageText = "The request to revise the sales order failed because the billing application already authorizedpayment for the order. ";

List < Message > messages = new ArrayList < Message > ();

if (header.getAttribute("ChangeVersionNumber") == null || header.getAttribute("ChangeVersionNumber") <= 1) return;

def paymentRows = header.getAttribute("Payments");
def isPreAuth = false;

if (paymentRows.hasNext()) {
  def paymentRow = paymentRows.next();
  isPreAuth = ("Y".equals(paymentRow.getAttribute("AuthorizedInSourceFlag")));
}
if (isPreAuth) {
   //Check OrderTotal
   if(null != header.getAttribute("ReferenceHeaderId")) {
      def origTotal = getPayNowTotalByHeaderId(header.getAttribute("ReferenceHeaderId"));
      def newTotal = getPayNowTotalByHeaderRow(header);
      if(newTotal > origTotal ) {
         messages.add(new Message(Message.MessageType.ERROR, messageText + "The total for the sales total is greater than the original order. The original total is :" + origTotal));
         ValidationException ex = new ValidationException(messages);
         throw ex;
      }
   }
def lines = header.getAttribute("Lines");       
  while (lines.hasNext()) {
    def line = lines.next();
    def refFulfillLineId = line.getAttribute("ReferenceFulfillmentLineIdentifier");
     if (line.getAttribute("ModifiedFlag").equals("Y")) {
      //Line is modified - compare the bill to with that of the base row.
      def refLine = getRefLine(refFulfillLineId);      
     if (null != refLine && !refLine.getAttribute("FulfillLineBillToCustomerId").equals(line.getAttribute("BillToCustomerIdentifier")) || 
     !refLine.getAttribute("FulfillLineBillToSiteUseId").equals(line.getAttribute("BillToAccountSiteUseIdentifier"))) {
        messages.add(new Message(Message.MessageType.ERROR, "You can't modify billing details for source transaction SourceTransactionLineNumber " + line.getAttribute("SourceTransactionLineNumber")". Discard your revision, create a new one, don't modify any attributes on the Billing and Payment Details tab, don't modify bill-to details on the order line, then submit your sales order."));
        ValidationException ex = new ValidationException(messages);
        throw ex;
      } 
    }
  }
}


Object getRefLine(Long refFulfillLineId) {
  def fLinePVO = context.getViewObject("oracle.apps.scm.doo.publicView.analytics.FulfillLinePVO");
  def vc = fLinePVO.createViewCriteria();
  def vcrow = vc.createViewCriteriaRow();
  vcrow.setAttribute("FulfillLineId", refFulfillLineId);

  def rowset = fLinePVO.findByViewCriteria(vc, -1);
  def line = rowset.next();
  return line;
}

Object getPayNowTotalByHeaderId(Long headerId) {
def totalPVO = context.getViewObject("oracle.apps.scm.doo.publicView.analytics.OrderTotalPVO");
def vc = totalPVO.createViewCriteria();
def vcrow = vc.createViewCriteriaRow();
vcrow.setAttribute("OrderTotalHeaderId", headerId);
vcrow.setAttribute("OrderTotalTotalCode", "QP_TOTAL_PAY_NOW");

  def rowset = totalPVO.findByViewCriteria(vc, -1);
  def total = rowset.next();
  if(null != total)
   return total.getAttribute("OrderTotalTotalAmount");
  else
    return 0;
}

Object getPayNowTotalByHeaderRow(def headerRow) {
def totals = header.getAttribute("OrderTotals");       
  while (totals.hasNext()) {
   def total = totals.next();
   if(total.getAttribute("TotalCode").equals("QP_TOTAL_PAY_NOW"))
      return total.getAttribute("TotalAmount");
  }
  return 0;
}

複数の検証メッセージの表示

前述の例では、要件を満たさない販売実績レコードが1つ見つかったとすぐに拡張の実行が停止し、エラーがレポートされます。 この拡張コードは、Messageオブジェクトを作成または使用しませんが、かわりにValidationExceptionクラスに対して直接機能します。

拡張機能では、ValidationExceptionをコールする前に、Messageオブジェクトの1つ以上のインスタンスを作成できます。 この機能を使用して、要件を満たさないすべての販売実績行をレポートし、拡張のコーディング方法を制御します。

次に、Messageオブジェクトを使用して詳細なエラー・レポートを提供する例を示します。 検証に失敗したすべての販売実績行がレポートされます。

コード

説明

import oracle.apps.scm.doo.common.extensions.ValidationException;

ValidationMessageオブジェクトを作成できるように、ValidationExceptionクラスをインポートします。

import oracle.apps.scm.doo.common.extensions.Message;

Messageオブジェクトを作成できるようにMessageクラスをインポートします。

def salesCredits = header.getAttribute("SalesCredits");

オーダー・ヘッダーが参照する販売実績の行セットを取得します。

List<Message> msgs = new ArrayList<Message>();

while( salesCredits.hasNext() )

処理する必要がある販売実績行をさらに存在するかどうかを決定します。

def salesCredit = salesCredits.next();

次の販売実績行を取得します。

if( "1".equals(salesCredit.getAttribute("SalesCreditTypeCode")) ) {

販売実績が収益率かどうかを決定します。

def percent = salesCredit.getAttribute("Percent");

販売実績の割当率を取得します。

if( percent < 30 ) {

パーセントが30未満の場合は、検証エラーを作成します。

def tokens = [SALESPERSON: salesCredit.getAttribute("Salesperson"), PERCENT: percent];

ValidationExceptionに送信するトークン値を指定します。

Message msg = new Message(Message.MessageType.ERROR, "SALES_CREDIT_TOO_LOW_MSG", tokens);

新規メッセージを作成します。

msgs.add(msg);

リストの各メッセージを累積します。

if( !msgs.isEmpty() ) {

msgsリストが空でない場合、少なくとも1つの販売実績行にエラーがあります。

throw new ValidationException(msgs);

ValidationExceptionを作成してスローします。

これはコメントなしで同じコードです。

import oracle.apps.scm.doo.common.extensions.ValidationException;                                
import oracle.apps.scm.doo.common.extensions.Message;                                            
def salesCredits = header.getAttribute("SalesCredits");                                          
List<Message> msgs = new ArrayList<Message>();
while( salesCredits.hasNext() ) {                                                                
  def salesCredit = salesCredits.next();                                                         
  if( "1".equals(salesCredit.getAttribute("SalesCreditTypeCode")) ) {                            
    def percent = salesCredit.getAttribute("Percent");                                           
    if( percent < 30 ) {                              
def tokens = [SALESPERSON: salesCredit.getAttribute("Salesperson"), PERCENT: percent]; 
Message msg = new Message(Message.MessageType.ERROR, "SALES_CREDIT_TOO_LOW_MSG", tokens);  
msgs.add(msg);                                                                             
    }
  } 
}
if( !msgs.isEmpty() ) {                                                                          
  throw new ValidationException(msgs);                                                           
}

警告の表示

この例では、履行がオーダー日を満たせない場合に警告を表示します。 サーバー時間を使用して、オーダー入力日に従って配送で品目を出荷できるかどうかを判断します。 できない場合は、警告を表示します。

import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;

//Get the sold-to customer.
String customer = header.getAttribute("BuyingPartyName");

//If cusomer is not PMC  - Snow Enterprise then we do not want to check for the order date
if( customer != "PMC  - Snow Enterprise" ) return;

//Initialize the variable that indicates whether the sales order is past the cut off time to false.
boolean orderAfterCutOffTime = false;

//Initialize calendar object. The calendar has the current system time, by default. In this example, we want to set up the calendar so it's in Eastern Stardard Time.
Calendar now = new GregorianCalendar(TimeZone.getTimeZone("EST"));

//The following commented out code line is just for debugging purposes. It prints out the customer, and hour of day values in the shipping instructions attribute which is visible in the UI.
//This is an easy way to inspect variable values and debug code.
 header.setAttribute("ShippingInstructions", customer + ", " + now.get(Calendar.HOUR_OF_DAY) + ", " + now.get(Calendar.MINUTE));

CutOffHour = 10
CurrentHour = now.get(Calendar.HOUR_OF_DAY)

if( CurrentHour > CutOffHour  ) {
    orderAfterCutOffTime = true;
}

//We will iterate through the lines in the order to see whether the ship from organization contains Vision Operations on any of the order lines. This will save some CPU cycles.
//We'll iterate through lines only if the order is past the cut-off time.
if( orderAfterCutOffTime ) {
  //get the lines iterator
  count = 0
 
  def lines = header.getAttribute("Lines");//get the lines row set
  while( lines.hasNext() ) {//if there are more order lines
       def line = lines.next();  
       count = count +1;  
       String shipFromOrgName = line.getAttribute("FulfillmentOrganizationName");
 
       if( shipFromOrgName != null) {    
           if( shipFromOrgName != "Vision Operations" ){
               msg = new Message(Message.MessageType.WARNING, "This order has been entered after the cut off time " + CutOffHour + " and will not be shipped tomorrow, current hour is : " + CurrentHour + " !!!!!");
               throw new ValidationException(msg);
           }
        }
    }
}

トランザクション・データの取得および表示

この例では、メッセージを使用して、販売オーダーの税金データを取得および表示します。

import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;

if (!"OrderTaxDetails_run_extension".equals(header.getAttribute("CustomerPONumber"))) return;

List < Message > messages = new ArrayList < Message > ();

messages.add(new Message(Message.MessageType.ERROR, "Status Code is " + header.getAttribute("StatusCode")));

def lines = header.getAttribute("Lines");
while (lines.hasNext()) {
    def line = lines.next();
    def charges = line.getAttribute("OrderCharges");
    while (charges.hasNext()) {
        def charge = charges.next();
        def chargeComponents = charge.getAttribute("OrderChargeComponents");
        while (chargeComponents.hasNext()) {
            def chargeComponent = chargeComponents.next();
            def taxDetails = chargeComponent.getAttribute("OrderTaxDetails");
            while (taxDetails.hasNext()) {
                def taxDetail = taxDetails.next();
                messages.add(new Message(Message.MessageType.ERROR, "OrderChargeComponentId is " + taxDetail.getAttribute("OrderChargeComponentId")));
                messages.add(new Message(Message.MessageType.ERROR, "TaxRate is " + taxDetail.getAttribute("TaxRate")));
                messages.add(new Message(Message.MessageType.ERROR, "TaxIncludedFlag is " + taxDetail.getAttribute("TaxIncludedFlag")));
                messages.add(new Message(Message.MessageType.ERROR, "HeaderCurrencyTaxUnitAmount is " + taxDetail.getAttribute("HeaderCurrencyTaxUnitAmount"))); //Not HdrCurrTaxUnitAmt
                messages.add(new Message(Message.MessageType.ERROR, "HeaderCurrencyTaxableUnitAmount is " + taxDetail.getAttribute("HeaderCurrencyTaxableUnitAmount"))); //Not HdrCurrTaxableUnitAmt
                messages.add(new Message(Message.MessageType.ERROR, "TaxRateIdentifier is " + taxDetail.getAttribute("TaxRateIdentifier"))); //Not TaxRateId
                messages.add(new Message(Message.MessageType.ERROR, "OrderTaxDetailId is " + taxDetail.getAttribute("OrderTaxDetailId")));
                messages.add(new Message(Message.MessageType.ERROR, "TaxExemptReasonCode is " + taxDetail.getAttribute("TaxExemptReasonCode")));
                messages.add(new Message(Message.MessageType.ERROR, "TaxExemptionCertificateNumber is " + taxDetail.getAttribute("TaxExemptionCertificateNumber"))); //Not TaxExemptCertificateNumber
            }
        }
    }

}

ValidationException ex = new ValidationException(messages);
throw ex;

文書参照の取得および表示

この例では、メッセージを使用して、販売オーダーの文書参照を取得および表示します。

import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;

String poNumber = header.getAttribute("CustomerPONumber");
if (poNumber == null) return;
if (!poNumber.startsWith("DocReferences")) return;

List < Message > messages = new ArrayList < Message > ();
messages.add(new Message(Message.MessageType.ERROR, "HeaderId: " + header.getAttribute("HeaderId")));
messages.add(new Message(Message.MessageType.ERROR, "Pre-submit"));

def docReferences = header.getAttribute("DocumentReferences");
while (docReferences.hasNext()) {
    def docRef = docReferences.next();
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalNumber: " + docRef.getAttribute("DocumentAdditionalNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionaldentifier: " + docRef.getAttribute("DocumentAdditionaldentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentIdentifier: " + docRef.getAttribute("DocumentIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalLineNumber: " + docRef.getAttribute("DocumentAdditionalLineNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalLineIdentifier" + docRef.getAttribute("DocumentAdditionalLineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentLineIdentifier: " + docRef.getAttribute("DocumentLineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentLineNumber: " + docRef.getAttribute("DocumentLineNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentReferenceType: " + docRef.getAttribute("DocumentReferenceType")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalSubLineNumber: " + docRef.getAttribute("DocumentAdditionalSubLineNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalSubLineIdentifier: " + docRef.getAttribute("DocumentAdditionalSubLineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentSubLineIdentifier: " + docRef.getAttribute("DocumentSubLineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentSubLineNumbe: " + docRef.getAttribute("DocumentSubLineNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentNumber: " + docRef.getAttribute("DocumentNumber")));
    messages.add(new Message(Message.MessageType.ERROR, "FulfillLineIdentifier: " + docRef.getAttribute("FulfillLineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "LineIdentifier: " + docRef.getAttribute("LineIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "OwnerTableId: " + docRef.getAttribute("OwnerTableId")));
    messages.add(new Message(Message.MessageType.ERROR, "OwnerTableName: " + docRef.getAttribute("OwnerTableName")));
    messages.add(new Message(Message.MessageType.ERROR, "TaskType: " + docRef.getAttribute("TaskType")));
    messages.add(new Message(Message.MessageType.ERROR, "DocumentSystemReferenceIdentifier: " + docRef.getAttribute("DocumentSystemReferenceIdentifier")));
    messages.add(new Message(Message.MessageType.ERROR, "HeaderId: " + docRef.getAttribute("HeaderId")));
}

def lines = header.getAttribute("Lines");
messages.add(new Message(Message.MessageType.ERROR, "get lines"));
while (lines.hasNext()) {
    messages.add(new Message(Message.MessageType.ERROR, "A line"));
    def line = lines.next();
    def lineDocReferences = line.getAttribute("DocumentReferences");
    while (lineDocReferences.hasNext()) {
        messages.add(new Message(Message.MessageType.ERROR, "has doc references"));
        def lineDocRef = lineDocReferences.next();
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalNumber: " + lineDocRef.getAttribute("DocumentAdditionalNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionaldentifier: " + lineDocRef.getAttribute("DocumentAdditionaldentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentIdentifier: " + lineDocRef.getAttribute("DocumentIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalLineNumber: " + lineDocRef.getAttribute("DocumentAdditionalLineNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalLineIdentifier" + lineDocRef.getAttribute("DocumentAdditionalLineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentLineIdentifier: " + lineDocRef.getAttribute("DocumentLineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentLineNumber: " + lineDocRef.getAttribute("DocumentLineNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentReferenceType: " + lineDocRef.getAttribute("DocumentReferenceType")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalSubLineNumber: " + lineDocRef.getAttribute("DocumentAdditionalSubLineNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentAdditionalSubLineIdentifier: " + lineDocRef.getAttribute("DocumentAdditionalSubLineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentSubLineIdentifier: " + lineDocRef.getAttribute("DocumentSubLineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentSubLineNumbe: " + lineDocRef.getAttribute("DocumentSubLineNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentNumber: " + lineDocRef.getAttribute("DocumentNumber")));
        messages.add(new Message(Message.MessageType.ERROR, "FulfillLineIdentifier: " + lineDocRef.getAttribute("FulfillLineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "LineIdentifier: " + lineDocRef.getAttribute("LineIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "OwnerTableId: " + lineDocRef.getAttribute("OwnerTableId")));
        messages.add(new Message(Message.MessageType.ERROR, "OwnerTableName: " + lineDocRef.getAttribute("OwnerTableName")));
        messages.add(new Message(Message.MessageType.ERROR, "TaskType: " + lineDocRef.getAttribute("TaskType")));
        messages.add(new Message(Message.MessageType.ERROR, "DocumentSystemReferenceIdentifier: " + lineDocRef.getAttribute("DocumentSystemReferenceIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "HeaderId: " + lineDocRef.getAttribute("HeaderId")));
    }
}

ValidationException ex = new ValidationException(messages);
throw ex;

トランザクション属性のテスト

この例では、保存時拡張ポイント中にメッセージを使用してトランザクション属性をテストします。

import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;

if (!"TestTIAOnSave_run_extension".equals(header.getAttribute("CustomerPONumber"))) return;

String poNumber = header.getAttribute("CustomerPONumber");
//Long headerId = header.getAttribute("HeaderId");

List < Message > messages = new ArrayList < Message > ();
/*messages.add(new Message( Message.MessageType.ERROR, "Enter TIA On Save"));
messages.add(new Message( Message.MessageType.ERROR, "CustomerPONumber: " + poNumber));
messages.add(new Message( Message.MessageType.ERROR, "HeaderId: " + headerId));*/

def lines = header.getAttribute("Lines");
def i = 0;
while (lines.hasNext()) {
    def line = lines.next();
    def tias = line.getAttribute("TransactionAttributes");
    while (tias.hasNext()) {
        messages.add(new Message(Message.MessageType.ERROR, "FulfillLineId: " + line.getAttribute("FulfillmentLineIdentifier")));
        def tia = tias.next();
        messages.add(new Message(Message.MessageType.ERROR, "TransactionAttributeIdentifier: " + tia.getAttribute("TransactionAttributeIdentifier")));
        messages.add(new Message(Message.MessageType.ERROR, "TransactionAttributeCode: " + tia.getAttribute("TransactionAttributeCode")));
        messages.add(new Message(Message.MessageType.ERROR, "TransactionAttributeName: " + tia.getAttribute("TransactionAttributeName")));
        messages.add(new Message(Message.MessageType.ERROR, "CharacterValue: " + tia.getAttribute("CharacterValue")));
        messages.add(new Message(Message.MessageType.ERROR, "NumberValue: " + tia.getAttribute("NumberValue")));
        messages.add(new Message(Message.MessageType.ERROR, "DateValue: " + tia.getAttribute("DateValue")));
        messages.add(new Message(Message.MessageType.ERROR, "TimestampValue: " + tia.getAttribute("TimestampValue")));
        /*
          //tia.setAttribute("TransactionAttributeCode", "Color");  //TransactionAttributeIdentifier will be 300100061374755
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, TransactionAttributeCode:  " + tia.getAttribute("TransactionAttributeCode")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, TransactionAttributeName:  " + tia.getAttribute("TransactionAttributeName")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, TransactionAttributeIdentifier:  " + tia.getAttribute("TransactionAttributeIdentifier")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, CharacterValue: " + tia.getAttribute("CharacterValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, NumberValue: " + tia.getAttribute("NumberValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, DateValue: " + tia.getAttribute("DateValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeCode to Color, TimestampValue: " + tia.getAttribute("TimestampValue")));
        
          //tia.setAttribute("CharacterValue", "Purple");
          //messages.add(new Message( Message.MessageType.ERROR, "After setting CharacterValue to Purple, CharacterValue:  " + tia.getAttribute("CharacterValue")));
          
          //tia.setAttribute("TransactionAttributeName", "zcz colors 2");   //TransactionAttributeIdentifier will be 300100033383860, code: zcz_colors_2
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, TransactionAttributeCode:  " + tia.getAttribute("TransactionAttributeCode")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, TransactionAttributeName:  " + tia.getAttribute("TransactionAttributeName")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, TransactionAttributeIdentifier:  " + tia.getAttribute("TransactionAttributeIdentifier")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, CharacterValue: " + tia.getAttribute("CharacterValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, NumberValue: " + tia.getAttribute("NumberValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, DateValue: " + tia.getAttribute("DateValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeName to zcz colors 2, TimestampValue: " + tia.getAttribute("TimestampValue")));
          
          //tia.setAttribute("TransactionAttributeIdentifier", "300100039021944"); //mapping to name: zCZ_FRAME_COLOR, display name: Frame Color
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, TransactionAttributeCode:  " + tia.getAttribute("TransactionAttributeCode")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, TransactionAttributeName:  " + tia.getAttribute("TransactionAttributeName")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, TransactionAttributeIdentifier:  " + tia.getAttribute("TransactionAttributeIdentifier")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, CharacterValue: " + tia.getAttribute("CharacterValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, NumberValue: " + tia.getAttribute("NumberValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, DateValue: " + tia.getAttribute("DateValue")));
          //messages.add(new Message( Message.MessageType.ERROR, "After setting TransactionAttributeIdentifier to 300100039021944, TimestampValue: " + tia.getAttribute("TimestampValue")));

          tia.setAttribute("TransactionAttributeIdentifier", "300100005319663"); //set back to the original TransactionAttributeIdentifier 
          tia.setAttribute("CharacterValue", "BLUE");
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, TransactionAttributeCode:  " + tia.getAttribute("TransactionAttributeCode")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, TransactionAttributeName:  " + tia.getAttribute("TransactionAttributeName")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, TransactionAttributeIdentifier:  " + tia.getAttribute("TransactionAttributeIdentifier")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, CharacterValue: " + tia.getAttribute("CharacterValue")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, NumberValue: " + tia.getAttribute("NumberValue")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, DateValue: " + tia.getAttribute("DateValue")));
          messages.add(new Message( Message.MessageType.ERROR, "After resetting TransactionAttributeIdentifier to 300100005319663, TimestampValue: " + tia.getAttribute("TimestampValue")));*/
    }
}

ValidationException ex = new ValidationException(messages);
throw ex;