Methods That You Can Use with Order Management Extensions

Get details about the methods that you can use with your order management extension.

canApplyHold Method

canApplyHold makes sure that the line isn't a child line of a model or kit, and that you haven't already applied a hold on the line.

boolean canApplyHold(def line, def holdCode) {

  if (isChildLine(line)) {
    debug("is child line");
    return false;
  }

  if (holdExists(line, holdCode)) {
    debug("hold already exists");
    return false;
  }

  return true;
}

canApplyHold returns a value.

  • true. The line isn't a child line of a model or kit, and you haven't already applied a hold on the line.
  • false. The line is a child line of a model or kit, or you already applied a hold on the line.

For details, see Use Order Management Extensions to Apply Holds.

Debug Method

Use the debug method to get details that can help you troubleshoot any problems that might come up when you use an extension to apply a hold. For details, see the Use the Debug Method subtopic in Test Your Order Management Extension.

Execution Context Method

The ExecutionContext method calls a SOAP web service.

Use this format.

SoapServiceResponse invokeSoapService(String integrationName, String xmlStr)

where

  • integrationName. Identifies the name of the integration.

  • xmlStr. XML representation of the SOAP body in String format.

ExecutionContext returns details.

Parameter

Description

public String getExtensionName()

String. Name of the order management extension that's currently running.

public String getEventCode()

String. Abbreviation that identifies the event that triggered the extension.

public Logger getLogger()

Logger. Logger where the extension can write logs.

public ServiceInvoker getServiceInvoker()

Returns a service that you can use to call a web service from the code in your order management extension.

public String getUserName()

Returns the name of the user currently signed in.

public boolean isUserInRole(String roleName)

Returns one of.

  • True. The user currently signed in is using the role that roleName specifies.

  • False. The user isn't using this role.

where

  • roleName. A string that identifies the role name.

public String getLanguage()

Returns an abbreviation that identifies the language that the user is using in the current session.

public Date getCurrentDate()

Returns the current system date in an instance of java.sql.Date.

public Timestamp getCurrentTime()

Returns the current system time in a java.sql.Timestamp object.

Get Attachments Method

Use the getAttachments() method to get these attributes:

Entity

Value to Use in Code

Parent

Read During All Events

Write During Save or Start of Submission Request

Write During End of Submission Request

Header attachment

Not applicable

Header

Yes

Yes

Yes

Fulfillment line attachment

Not applicable

Lines

Yes

Yes

No

holdExists Method

See whether you already applied a hold on the line.

boolean holdExists(def line, def holdCode) {
  ArrayList holds = line.getHolds();
  for (hold in holds) {
    if (holdCode.equals(hold.getAttribute("HoldCode"))) {
      debug("Found hold code on line");
      return true;
    }
  }
  return false;
}

holdExists returns a value.

  • true. You already applied a hold on the line.
  • false. You haven't applied a hold on the line.

isChildLine Method

See whether the line is a child of a model or kit.

boolean isChildLine(def line) {
  def rootParentLineId = line.getAttribute("RootParentLineReference");
  def fulfillLineId = line.getAttribute("FulfillmentLineIdentifier");
  return (rootParentLineId != null && rootParentLineId != fulfillLineId);
}

isChildLine returns a value.

  • true. The line is a child line of a model or kit.
  • false. The line isn't a child line of a model or kit.

isFirstDraftOrder Method

Make sure the sales order is in draft status.

boolean isFirstDraftOrder() {
  String statusCode = header.getAttribute("StatusCode");
  if ("DOO_DRAFT".equals(statusCode)) {
    def cvn = header.getAttribute("ChangeVersionNumber");
    if (cvn == 1) {
      return true;
    }
  }

  return false;
}

isFirstDraftOrder returns a value.

  • true. The sales order is in draft status.
  • false. The sales order isn't in draft status.

Logger Method

The Logger method returns the message log.

Use this format.

Format

Description

public boolean isEnabled(Level level)

Returns one of.

  • True. Logging is enabled at the level that Level specifies.

  • False. Logging isn't enabled at this level.

where

  • level. Sets the logging level according to a constant from java.util.logging.Level.

public void logFine(String message)

Saves message to the log at the fine level.

where

  • message. A text string that the command saves to the log.

public void logFine(String messageFormat, Object... arguments)

Saves the message at the fine level.

where

  • messageFormat. Format of the message. The command uses this format to create the message string. It passes the format and argumentsto String.format().

  • arguments. Arguments that replace the tokens in the format string.

public void logFiner(String message)

Saves message to the log at the finer level.

where

  • message. A text string that the command saves to the log.

public void logFiner(String messageFormat, Object... arguments)

Saves the message at the finer level.

where

  • messageFormat. Format of the message. The command uses this format to create the message string. It passes the format and argumentsto String.format().

  • arguments. Arguments that replace the tokens in the format string.

public void logFinest(String message)

Saves message to the log at the finest level.

where

  • message. A text string that the command saves to the log.

public void logFinest(String message)

Saves message to the log at the finest level.

where

  • message. A text string that the command saves to the log.

public void logSevere(String messageFormat, Object... arguments)

Saves the message at the severe level.

where

  • messageFormat. Format of the message. The command uses this format to create the message string. It passes the format and argumentsto String.format().

  • arguments. Arguments that replace the tokens in the format string.

public void logSevere(String messageFormat, Object... arguments)

Saves the message at the severe level.

where

  • messageFormat. Format of the message. The command uses this format to create the message string. It passes the format and argumentsto String.format().

  • arguments. Arguments that replace the tokens in the format string.

Message Method

The Message method uses a message type and message text to create a message for the sales order. It uses the ORA_MANAGE_EXTENSIONS request function to log messages, by default.

Here's the format to use to display a literal message that uses the default message category and no tokens.

Message(MessageType type, String text)

where

  • type. Type of message. You can use ERROR or WARNING.

  • text. Text of the message to display, enclosed with one set of double quotation marks ( " " ).

Here's an example warning message that includes a literal string.

Message(MessageType Message.MessageType.WARNING, String "This is the warning message.")

Here's an error message that includes a literal string.

Message(MessageType Message.MessageType.ERROR, String "This is the error message.")

Specify Message Name and Tokens

Here's the format to use to specify the message name and message token parameters.

Message(MessageType type, String name, Map<String, Object> parameters)

where

  • type. Type of message. You can use ERROR or WARNING.

  • name. Name of a message from the Manage Messages page.

    Here are the values that attributes for this message must use on the Manage Messages page.

    Attribute

    Value

    Application

    Distributed Order Orchestration

    Module

    Distributed Order Orchestration

    For details, see Set Up Messages in Order Management.

  • parameters. A map that contains message tokens and token values. The Message method uses this map to populate tokens with values. These tokens are part of the message.

Here's some example code that displays the contents of a message named DOO_CUST_RELATIONSHIP_WARNING.

Message(MessageType Message.MessageType.WARNING, String "DOO_CUST_RELATIONSHIP_WARNING", Map<String, Object> messageParams)

Create Messages for Sales Orders and Sales Order Lines

You can use the Request function, message name, and message token parameters to create a message for the sales order or the order line. The Message method will log the message with the request function that you specify.

Here's the format to use for the sales order.

Message(MessageType type, String requestFunction, String name, Map string, object msgParams)

Here's the format to use for the order line.

Message(MessageType type, String requestFunction, Object line, String name, Map string, object msgParams)

where

  • Object line. Identifies the order line to reference when logging the message.

For details about the other parameters, see the Map Tokens for the Message Repository section in this topic.

Here's some example code that uses a request function.

Message(MessageType Message.MessageType.WARNING, String "DEMO_REQFUNC", String "DOO_CUST_RELATIONSHIP_WARNING", Map string, object msgParams)

where

  • DEMO_REQFUNC is a value in lookup DOO_MSG_REQUEST_FUNCTION.

Row Set Iterator Method

The RowSetIterator method manages rows in the iterator.

Use this format.

Row first()

RowSetIterator returns details.

Parameter

Description

Row first()

Returns the first row in the iterator.

hasNext()

Returns a Boolean value that indicates whether another row exists after the current row.

Row next()

Returns the next row in the iterator.

If no more rows exist after the current row, then this parameter returns a null value.

Row last()

Returns the last row in the iterator.

hasPrevious()

Returns a Boolean value that indicates whether another row exists before the current row.

Row previous()

Returns the previous row in the iterator.

If no more rows exist before the current row, then this parameter returns a null value.

createRow()

Creates a new row. If the entity doesn't support creating a new row, then this parameter returns an error message when your extension calls this method.

insertRow(Row row)

Inserts the row into the current iterator, where row specifies the row number to insert.

Use this method to add a new row to the iterator after you create the iterator.

Service Invoker Method

The ServiceInvoker method calls a service.

Validation Exception Method

The ValidationException method uses the error text that you specify to create a validation exception. It displays the message text that you specify.

Use this format.

ValidationException(String messageText)

Display Messages from the Message Repository

ValidationException can get the error message text from the Oracle Applications message repository, populate token values, and then display the message in the Order Management work area.

Use this format.

ValidationException(String name, Map string, object parameters)

where

  • name. Name of the message that you specify on the Manage Messages page.

  • parameters. A map that contains message tokens and token values. ValidationException uses this map to populate tokens with values in the message.

Map Tokens for the Message Repository

Here's the format to use with ValidationException to create the map that specifies.

ValidationException(java.lang.String requestFunction, java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> parameters)

where

  • requestFunction. Lookup code of the request function to log the message against. You use the Order Management lookup named Request Function to define a request function. If this parameter passes an empty value, then ValidationException defaults the request function to ORA_MANAGE_EXTENSIONS.

  • name. Name of the message that you specify on the Manage Messages page. You must specify Distributed Order Orchestration as the application for this message when you use the Manage Messages page.

  • parameters. A map that contains message tokens and token values. ValidationException uses this map to populate tokens with values in the message.

Display Message Objects from the Message Repository

ValidationException can use a list of message objects to create a validation exception. It can accommodate a validation error that includes more than one message.

Use this format.

ValidationException(List message messages)

where

  • messages. A list of message objects. For details about how to create a message object, see the Message Method section in this topic.

Use Reference Lookup Codes

Here's the format you use to reference a lookup code.

throw new ValidationException("lookup_code")

The lookup type named DOO_MSG_REQUEST_FUNCTION contains lookup codes.

Lookup Code

Description

ASSIGN_PROC

Process assignment.

MANAGE_TASK

Fulfillment task.

MANAGE_HOLD

Hold.

MANAGE_PROC

Fulfillment process.

PLAN_PROC

Fulfillment planning.

PROC_CHANGE

Change order.

XFORM_ORDER

Order transformation. Location that Order Management uses to store an incoming source order before it transforms it to a sales order.

VALD_CONSTRAINT

Processing constraint.

VALD_PROC_DEFN

Process definition.

VALD_ACTION_ELGB

Action eligibility.

ORA_VALD_ORDER_DATA

Order validation.

ORA_VALD_CONFIG

Configuration.

ORA_VALD_PRICING

Pricing.

ORA_NOTIFY_EVENT

Event notification.

ORA_VALD_PAYMENT

Payment.

ORA_VERIFY_TRADE_COMPLIANCE

Verify that fulfillment lines meet trade compliance policies.

ORA_CREDIT_CHECK

Verify credit check failure.

ORA_ORDER_APPROVALS

Message function classification for Order Approval messages.

ORA_MANAGE_EXTENSIONS

Default type for messages that the extensions framework logs.

You can specify one of these lookup codes or add new ones to the lookup.

View Object Method

The ViewObject method finds and returns a view criterion.

Use this format.

ViewCriteria getViewCriteria(name)

where

  • name. Name of the view criterion.

A view criterion is a list of row criterion for the WHERE clause in a view object. Each row criterion is an array that contains criterion for each attribute.

Create View Criterion

Use this format.

ViewCriteria createViewCriteria()

ViewObject returns the new view criterion object.

Finding Rows According to View Criterion

Here's the format to use to find rows according to the view criterion that you provide and return them in an iterator.

RowIterator findByViewCriteria(ViewCriteria viewCriteria, int numberOfRows)

where

  • viewCriteria. Name of the view criteria to use to find rows.

  • numberOfRows. Number of rows to return. Use one of.

    • -1. Get all rows that match the view criteria.

    • Positive integer. Get a subset of rows. For example, use 3 to get the first three rows that match the criteria. If only two rows match the criteria, then the method returns only these two rows.

For example, here's some code that gets all rows and stores them in a local variable named vc.

def rowset = itemPVO.findByViewCriteria(vc, -1);

Here's the format to include an array of variable names and values.

RowIterator findByViewCriteriaWithBindVars(ViewCriteria viewCriteria, int maxNumOfRows, String[] variableNames, Object[] variableValues)

where

  • variableNames. Array of variable names to use with the view criteria.

  • variableValues. Array of variable values to use with the view criteria.

Here's the format to use to find rows according to the name of the view criteria.

RowIterator findByViewCriteriaWithBindVars(String viewCriteriaName, int maxNumOfRows, String[] variableNames, Object[] variableValues)

where

  • viewCriteriaName. Name of the view criteria to use to find the rows.

For more, see Public View Objects in Oracle Applications Cloud (Doc ID 2386411.1).

Address Methods

You can use these methods with address data.

  1. public Address(String addressLine1, String addressLine2, String addressLine3, String addressLine4, String city, String state, String postalCode, String county, String province, String country)
  2. public void setAddress1(String address1)
  3. public String getAddress1() { return mAddress1; }
  4. public void setAddress2(String address2)
  5. public String getAddress2() { return mAddress2; }
  6. public void setAddress3(String address3)
  7. public String getAddress3() { return mAddress3; }
  8. public void setAddress4( () {String address4; }
  9. public String getAddress4() { return mAddress4; }
  10. public void setCity(String city)
  11. public String getCity() { return mCity; }
  12. public void setPostalCode(String postalCode)
  13. public String getPostalCode() {return mPostalCode; }
  14. public void setState(String state)
  15. public String getState() { return mState; }
  16. public void setProvince(String province)
  17. public String getProvince() { return mProvince; }
  18. public void setCounty(String county)
  19. public String getCounty() { return mCounty; }
  20. public void setCountry(String country)
  21. public String getCountry() { return mCountry; }

Attachment Methods

You can use these methods to manage attachments.

  1. public String getDatatypeCode() { return mDatatypeCode; }
  2. public void setDatatypeCode(String datatypeCode)
  3. public void setAttachedDocumentId(Long attachedDocumentId)
  4. public Long getAttachedDocumentId() { return mAttachedDocumentId; }
  5. public void setCategoryName(String mCategoryName)
  6. public String getCategoryName() { return mCategoryName; }
  7. public void setDocumentAttributes(String documentAttributes)
  8. public String getDocumentAttributes() { return mDocumentAttributes; }
  9. public void setDescription(String description)
  10. public String getDescription() { return mDescription; }
  11. public void setEntityAttributes(String entityAttributes)
  12. public String getEntityAttributes() { return mEntityAttributes; }
  13. public void setEntityName(String entityName)
  14. public String getEntityName() { return mEntityName; }
  15. public void setFileContentType(String fileContentType)
  16. public String getFileContentType() { return mFileContentType; }
  17. public void setFileName(String fileName)
  18. public String getFileName() { return mFileName; }
  19. public void setPk1Value(String pk1Value )
  20. public String getPk1Value() { return mPk1Value; }
  21. public void setTitle(String title)
  22. public String getTitle() { return mTitle; }
  23. public void setUrl(String url)
  24. public String getUrl() { return mUrl; }
  25. public BlobDomain getFileContent() { return mFileContent; }
  26. public void setFileContent(byte[] fileContent)
  27. public void setFileContent(BlobDomain fileContent) { }
  28. public String getText() { return mText; }
  29. public void setText(String text)
  30. public void setDocumentName(String documentId)
  31. public String getDocumentName() { return mDocumentId; }
  32. public void setDocumentIdentifier(String documentVersion)
  33. public String getDocumentIdentifier() { return mDocumentVersion; }
  34. public void setContentRepositoryFileShared(boolean contentRepositoryFileShared)
  35. public boolean isContentRepositoryFileShared() {
     return mContentRepositoryFileShared;
     }

CreateLineParams Methods

You can use these methods with the CreateLineParams operation.

  1. public void setProductIdentifier(Long productIdentifier)
  2. public void setProductNumber(String productNumber)
  3. public String getProductNumber()
  4. public void setOrderedUOMCode(String orderedUOMCode)
  5. public String getOrderedUOMCode()
  6. public void setOrderedUOM(String orderedUOM)
  7. public String getOrderedUOM()
  8. public void setOrderedQuantity(BigDecimal orderedQuantity)
  9. public BigDecimal getOrderedQuantity()

Extensible Flexfield Methods

You can use these methods when your extension references an extensible flexfield on an order header or order line.

Method Description

public getOrCreateContextRow(String contextCode)

Use this method to write a value to or to get a value from an extensible flexfield.

It returns the value that's in the flexfield context. If the context doesn't already exist, then the method creates and returns a new context.

Use the contextCode parameter on this method to get the flexfield context's code. If the context exists, then the method returns the context, else it creates a new one and returns it.

public Row getContextRow(String contextCode) Does the same thing as getOrCreateContextRow but only gets the value that the extensible flexfield currently contains.

Order Header and Order Line Methods

You can use these methods on the order header or the order line.

Method Description
public String getAttribute(String attributeName)

Get the value of any attribute that you specify in the method's attributeName parameter.

Specify the attribute's name or the entity name in the attributeName parameter.

You can also use getAttribute to get the value of these header entities:

  • DocumentReferences
  • HeaderAddresses
  • Lines
  • OrderTotals
  • SalesCredits

It can return a collection of header entities.

public List getAttachments() Get a list of attachments that are on the order header or order line.
public createAttachment(Attachment attachment) Add an attachment to the order header or order line.
public deleteAttachment(Attachment attachment) Delete an attachment from the order header or order line.
public duplicateAttachments(List attachmentList) Duplicate the attachments that are on the order header or order line.
public Line createNewLine(CreateLineParams createLineParams)

Add a free item.

It returns the line object of the line that it just added.

If you use createNewLine on the:

  • Order header. It creates an order line that doesn't reference an item on another line.
  • Order line. It creates order line x that references an item on order line y. The item on line x is free.
public boolean isSellingProfitCenterUserUpdated() Contains true or false. True: the user updated the SellingProfitCenter attribute. False: the user didn't update the SellingProfitCenter attribute.

Address Methods

The extension uses the address data that you specify in the method's parameter to find the attribute's value.

Method Description
public void setShipToAddress(Address address) Set the ship to address attribute on the order line.
public void setBillToAddress(Address address) Set the bill to address attribute on the order line.
public void setSupplierAddress(Address address) Set the supplier's address attribute on the order line.
public void setDestinationShippingAddress(Address address) Set the destination shipping address attribute on the order line.
public void setFinalDischargeLocationAddress(Address address) Set the final discharge address attribute on the order line.

Party Methods

The extension uses the person data that you specify in the method's parameter to find the attribute's value.

Method Description
public void setShipToParty(Person person) Set the ship to party attribute on the order line.
public void setShipToContact(Person person) Set the ship to contact attribute on the order line.
public void setBillToAccount(Person person) Set the bill to customer attribute on the order line.
public void setBillToContact(Person person) Set the bill to contact attribute on the order line.

Order Line Methods

Method Description
public String getAttribute(String attributeName)

Get the value of any attribute from the order line.

Specify the name of the attribute in the attributeName parameter.

You can also use the attributeName parameter to specify any of these entities that are in the line entity:

  • AssetTransactionDetails
  • BillingPlans
  • ChannelPrograms
  • DocumentReferences
  • FulfillLineDetails
  • Holds
  • LotSerial
  • ManualPriceAdjustments
  • OrderCharges
  • OrderTerms
  • Payments
  • Projects
  • SalesCredits
  • TransactionAttributes

You can't use this method to get an extensible flexfield's value.

public setAttribute(String attributeName, Object value)

Set the value of an attribute on the order line.

  • Use the attributeName parameter to specify the attribute that you want to set.
  • Use the value parameter to specify the attribute's value.
public List getTransformedLines()

Get a list of the lines that the extension transformed for the current line.

A transformed line is a line that contains a free item.

public boolean isTransformed() Contains true or false. True: the order line is a transformed line. False: the order line isn't a transformed line.
public boolean isOpen() Contains true or false. True: the order line is open. False: the order line isn't open.
public boolean isClosed() Contains true or false. True: the order line is closed. False: the order line isn't closed.
public boolean isCanceled() Contains true or false. True: the order line is cancelled. False: the order line isn't cancelled.
public List getHolds() Get a list of the holds that are on the order line.
public Hold applyHold(String holdCode)

Apply a hold on the order line.

This method also returns the hold object that it just added.

Person Methods

  1. public Person(String firstName, String lastName)
  2. public Person(String firstName, String middleName, String lastName)
  3. public Person(String firstName, String lastName, String middleName, String suffix, String title)
  4. public void setFirstName(String firstName)
  5. public String getFirstName() {return mFirstName;}
  6. public void setLastName(String lastName)
  7. public String getLastName() {return mLastName;}
  8. public void setMiddleName(String middleName
  9. public String getMiddleName() {return mMiddleName; }
  10. public void setSuffix(String suffix)
  11. public String getSuffix() {return mSuffix;}
  12. public void setTitle(String title)
  13. public String getTitle() {return mTitle; }