Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleIn header Logics
Code Block
languagegroovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createDateUserEntry('date')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value in a line item logic

...

Code Block
languagegroovy
final datePattern = 'yyyy-MM-dd'
def date = api.parseDate(datePattern, input.date)

...

Expand
titleIn header Logics
Code Block
languagegroovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createTimeUserEntry('time')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value in a line item logic

...

Code Block
languagegroovy
def matcher = input.time =~ /(?<hour>[0-9]{2}):(?<minute>[0-9]{2})/
matcher.matches() // ❶
def hour = matcher.group('hour') as Integer
def minute = matcher.group('minute') as Integer

...

Expand
titleIn header Logics
Code Block
languagegroovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createDateTimeUserEntry('dateTime')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value in a line item logic

...

Code Block
languagegroovy
final dateTimePattern =  "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
def dateTime = api.parseDateTime(dateTimePattern, input.dateTime)

...

Expand
titleIn header Logics
Code Block
languagegroovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createDateRangeUserEntry('dateRange')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value in a line-item logic

...

Code Block
languagegroovy
final datePattern = 'yyyy-MM-dd'
def dateFrom = api.parseDate(datePattern, input.dateRange[0])
def dateTo = api.parseDate(datePattern, input.dateRange[1])

...