Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Content layer
id2050374827
#foreach ($p in $sorter.humanSort($Package, ["version", "name"], "desc")) $p
Content column
id2050374833
Content block
id2050374822

On this page

Table of Contents
maxLevel4
minLevel3

#foreach ($rel in
Content block
id2050374832

$sorter is used to sort a collection of report templates.

Info
titleInformation

The following functions perform case-insensitive sorting by default:


$sorter.sort(collection, fieldName)

The sort function for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates.


Name Type Description 
Parameter(s)   collection java.util.Collection  A collection to
be sorted 
fieldNamejava.lang.StringA fieldName to
be sorted and
the sort direction. 
Return -java.util.CollectionA sorted collection. 

For example:

Code Block
languagetext
#foreach ($rel in $sorter.sort($package, "name"))
$rel.name
#end
  • $package is the collection to be sorted.
  • "name:desc" is separated by ":" in two parts:
    • The first part is to identify fieldName to be sorted.
    • The second part is the option to identify the sorting direction. Sometimes, the direction is not identified. It is ascending by default.


$sorter.sort(collection, fieldName, isCaseInsensitive)

This is the The sort function for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through the templates.This function allows case-sensitive sorting.


NameTypeDescriptionName Type Description 
Parameter(s) collection collection javajava.util.CollectionA collection to
be sorted. 

 ReturnfieldName -java.utillang.Collection StringA fieldName to be sorted
collection.

For example:

Code Block
languagetext
and the sort direction.

isCaseInsensitivebooleanTrue if case-insensitive sorting.
Return-java.util.CollectionA sorted collection.


$sorter.sort(

$package)) $rel.name #end

collection)

This is the sort function for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through the templates.


Name Type Description 
Parameter(s) collection  java
  • $package is a collection to be sorted.
Tip

The collection will be sorted by name, in ascending order, by default.

$sorter.sort(collection, fieldNameCollection, direction)

This sort function allows specifying more than one field name to be sorted. The priority of fields is ranked by the sequence in the fieldNameCollection parameter.

fieldNameCollectionCollection collection of field names, sorted by the priority of field name order in the collection.
Name Type Description Parameter(s) collection java.util.CollectionA collection to
be sorted. 
 Return -java.util.Collection A
directionjava.lang.StringSorting direction. It is either "asc" or "desc". If this field is not entered, "asc" is used by default.
 Return -java.util.Collection A sorted collection.

For example:

Code Block
languagetext
#foreach ($p in $sorter.sort($Package, ["version", "name"], "desc"))
$p.name
#end

$sorter.sortByFirstNumber(collection, fieldName)

The sortByFirstNumber function is for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates.

sorted
collection.

For example:

Code Block
languagetext
#foreach ($rel in $sorter.sort($package))
$rel.name
#end
  • $package is a collection to be sorted.
Tip

The collection will be sorted by name, in ascending order, by default.


$sorter.sort(collection, fieldNameCollection, direction)

This sort function allows specifying more than one field name to be sorted. The priority of fields is ranked by the sequence in the fieldNameCollection parameter.


Name Type Description 
Parameter(s) collection java.util.CollectionA collection to be sorted. 
fieldNameCollectionjava.util.CollectionA collection of field names, sorted by the priority of field name order in the collection.
directionjava.lang.StringSorting direction. It is either "asc" or "desc". If this field is not entered, "asc" is used by default.
 Return -java.util.Collection 
Name Type Description 
Parameter(s)  collection java.util.Collection A collection
to be sorted. 
 fieldName  java.lang.StringA fieldName to
be sorted and
the sorting direction.
 Return -java.util.CollectionA sorted collection.

For example:

Code Block
languagetext
#foreach ($rel$p in $sorter.sortByFirstNumbersort($package$Package, ["name:version", "name"], "desc"))
$rel$p.name
#end
$package is a collection


$sorter.sort(collection, fieldName, direction, isCaseInsensitive)

This sort function allows specifying more than one field name to be sorted

by FirstNumber.

. The priority of fields is ranked by the sequence in the fieldNameCollection parameter. This function allows case-sensitive sorting.


NameTypeDescription
Parameter(s)collectionjava.util.CollectionA collection to be sorted.

fieldNamejava.lang.StringA fieldName to be sorted and the sort direction.

directionjava.lang.StringSorting direction. It is either "asc" or "desc". If this field is not entered, "asc" is used by default.

isCaseInsensitivebooleanTrue if case-insensitive sorting.
Return-java.util.CollectionA sorted collection.


$sorter.sortByFirstNumber(collection, fieldName)

The sortByFirstNumber function is

  • "name:desc" is separated by ":" in two parts:
    • The first part is to identify fieldName to be sorted.
    • The second part is the option to identify the sorting direction. Sometimes, the direction is not identified. It is ascending by default.
  • $sorter.sortByFirstNumber(collection)

    The sortByFirstNumber function for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates.


    Name Type Description 
    Parameter(s) collection  collection java.util.CollectionCollection A collection
    to be sorted. 
     Return fieldName  - java.utillang.Collection StringA fieldName to
    be sorted and
    collection. the sorting direction.
     Return -java.util.CollectionA sorted collection.

    For For example:

    Code Block
    languagetext
    #foreach ($rel in $sorter.sortByFirstNumber($package, "name:desc")) 
    $rel.name
    #end
    • $package is a collection to be sorted by FirstNumber.

    $sorter.sortByLocale(collection, String)

    This is a function to sort for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates. To sort a given collection by a particular language, identify the country code to specify the language.

    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify fieldName to be sorted.
      • The second part is the option to identify the sorting direction. Sometimes, the direction is not identified. It is ascending by default.


    $sorter.sortByFirstNumber(collection)

    The sortByFirstNumber function for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates.

      

    Name Name Type Description 
    Parameter(s) collection java java.util.Collection CollectionA collection
    to be sorted. 
     ReturncountryCode  - java.langutil.StringThe country code
    to specify a language
    to perform sorting.
     Return - java.util.Collection A sorted collection.
    Collection A sorted
    collection. 

    For example:

    Code Block
    languagetext
    #foreach ($p$rel in $sorter.sortByLocalesortByFirstNumber($package, "DE")) 
    $p$rel.name
    #end
    • $package is a collection to be sorted by country codeFirstNumber."DE" is the country code for GERMANY (ISO country code).
    Tip

    This method sorts a collection by “name” attribute of each element by default.

    $sorter.sortByLocale(collection, String, String)


    $sorter.sortByLocale(collection, String)

    This is a function to sort for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates. To sort a given collection by a particular language, identify the country code to specify the language by identifying the country code and field name.

       

    Name Type Description 
    Parameter(s)  collection java.util.Collection A collection
    to be sorted. 
    fieldNamecountryCode  java.lang.StringThe country code
    A fieldName to b
    0e sorted. 
    countryCode  java.lang.StringThe country code
    to specify to specify a language
    to perform sorting. 
     Return - java.util.Collection A sorted collection.

    For example:

    Code Block
    languagetext
    #foreach ($p in $sorter.sortByLocale($package, "name", "DE"))
    $p.name
    #end
    • $package is the a collection to be sorted by country code.
    • “name” is the field name to be sorted.
    • "DE" is the country code for GERMANY (ISO country code).
    $sorter.humanSort(collection, fieldName)

    Tip

    This method sorts a collection by “name” attribute of each element by default.


    $sorter.sortByLocale(collection, String, String)

    This is a function to sort for report templates. The context name of this class is "sorter". Use $sorter to access public functions of this class through templates. To sort a given collection by a particular language, specify the language by identifying the country code and field name.


    Name Type Description 
    Parameter(s)   collection java.util.Collection A collection
    to be sorted. 
    fieldName java.lang.StringA fieldName to b
    0e sorted. 
    countryCode  java.lang.StringThe country code
    to specify a language
    to perform sorting. 
     Return - java.util.Collection A sorted collection.

    For example:

    Code Block
    languagetext
    #foreach ($p in $sorter.sortByLocale($package, "name", "DE"))
    $p.name
    #end
    • $package is the collection to be sorted.
    • “name” is the field name to be sorted.
    • "DE" is the country code for GERMANY (ISO country code).


    $sorter.humanSort(collection, fieldName)

    This is a special function to sort text in a human-like order. It splits text into numeric and non-numeric chunks and sorts them in numerical order. For example, "foo10" is ordered after "foo2".


    Name Type Description 
     Parameter(s) collection java.util.Collection A collection
    to be sorted.
    fieldName java.lang.StringA fieldName to
    be sorted and
    the sorting direction.
     Return - java.util.CollectionA sorted collection.

    For example:

    Code Block
    languagetext
    #foreach ($rel in $sorter.humanSort($package, "name:desc"))
    $rel.name
    #end
    •  $package is the collection to be sorted.
    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify fieldName to be sorted.
      • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.


    $sorter.humanSort(collection, fieldName, isCaseInsensitive)

    This is a special function to sort text in a human-like order. It splits text into numeric and non-numeric chunks and sorts them in numerical order. For example, "foo10" is ordered after "foo2". This function allows case-sensitive sorting.


    NameTypeDescription
    Parameter(s)collectionjava.util.CollectionA collection to be sorted.

    fieldNamejava.lang.StringA fieldName to be sorted and the sorting direction.

    isCaseInsensitivebooleanTrue if case-insensitive sorting.
    Return- java.util.CollectionA sorted collection.


    $sorter.humanSort(collection)

    This is a special function is a special function to sort text in a human-like order. It splits text into numeric and non-numeric chunks and sorts them in numerical order. For example, "foo10" is ordered after "foo2".

     Parameter 

    Name Type Description 
    Parameter(s)collection java.util.Collection A collection
    to be sorted.
    fieldName java.lang.String  java.util.CollectionA collection
    to be sortedA fieldName to
    be sorted and
    the sorting direction.
     Return - java.util.CollectionCollection A sorted collection. 

    For example:

    Code Block
    languagetext
    #foreach ($rel in $sorter.humanSort($package, "name:desc"))
    $rel.name
    #end
    •  $package $package is the collection to be sorted.


    $sorter.

    humanSort(collection, fieldNameCollection, direction)

    This humanSort function allows specifying more than one field name to be sorted. The priority of fields is ranked by the sequence in the fieldNameCollection parameter.


    NameTypeDescription
    Parameter(s)  collectionjava.util.CollectionA collection to be sorted.
    fieldNameCollectionjava.util.CollectionA collection of field names, sorted by the priority of field name order in the collection.
    directionjava.lang.StringSorting direction. It is either "asc" or "desc". If this field is not entered, "asc" is used by default.
    Return-java.util.CollectionA sorted collection.
  • "name:desc" is separated by ":" in two parts:
    • The first part is to identify fieldName to be sorted.
    • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.
  • $sorter.humanSort(collection)

    This is a special function to sort text in a human-like order. It splits text into numeric and non-numeric chunks and sorts them in numerical order. For example, "foo10" is ordered after "foo2".

    Name Type Description 
    Parameter(s)collection   java.util.CollectionA collection
    to be sorted.
     Return - java.util.Collection A sorted collection. 

    For example:

    Code Block
    languagetext
    #foreach ($rel$p in $sorter.humanSort($package$Package, ["version", "name"], "desc"))
    $rel$p.name
    #end
    $package is the collection to be sorted.


    $sorter.humanSort(collection,

    fieldNameCollection

    fieldName, direction, isCaseInsensitive)

    This humanSort function allows specifying more than one field name to be sorted. The priority of fields is ranked by the sequence in the fieldNameCollection parameter. This function allows case-sensitive sorting.

     NameTypeDescription
    Parameter(s)
      
    collectionjava.util.CollectionA collection to be sorted.
    fieldNameCollection
     fieldNamejava.
    util
    lang.
    Collection
    StringA
    collection of field names, sorted by the priority of field name order in the collection.
    fieldName to be sorted and the sorting direction.
     directionjava.lang.StringSorting direction. It is either "asc" or "desc". If this field is not entered, "asc"
    is used by default
    is used by default.
     isCaseInsensitivebooleanTrue if case-insensitive sorting.
    Return-java.util.CollectionA sorted collection
    .

    For example:

    Code Block
    languagetext
    .
    name #end


    $sorter.containmentTreeSort(collection)

    This function is for sorting elements that match the Containment tree order.


    Name Type Description 
    Parameter(s)collection   java.util.CollectionA collection
    to be sorted.
     Return - java.util.Collection A sorted collection. 



    $sorter.tagSort(collection, stereotypeName, tagName)

    This function is for sorting a collection item by specifying an applied stereotype name and tag name.


    NameTypeDescription
    Parameter(s)collectionjava.util.CollectionA collection to be sorted.

    stereotypeNamejava.lang.StringAn applied stereotype name.

    tagNamejava.lang.StringA tag name of the applied stereotype and the sorting direction.
    Return-java.util.CollectionA sorted collection.

    For example:

    Code Block
    languagetext
    #foreach($p in $sorter.tagSort($Package, "MyStereotype", "tagA:desc"))
    $report.getStereotypePropertyString($p, "Mystereotype", "tagA") :: $p.name
    #end
    • $package is the collection to be sorted.
    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify tagName to be sorted.
      • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.


    $sorter.tagSort($collection, $stereotypeName, $tagName, $forceNumber)

    This function is for sorting a collection item by specifying an applied stereotype name and tag name and forcing a tag value to convert to a numeric before sorting.


    NameTypeDescription
    Parameter(s)collectionjava.util.CollectionA collection to be sorted.

    stereotypeNamejava.lang.StringAn applied stereotype name.

    tagNamejava.lang.StringA tag name of the applied stereotype and the sorting direction.

    forceNumberbooleanTrue if a tag value is converted to a numeric before sorting.
    Return-java.util.CollectionA sorted collection.

    For example:

    Code Block
    languagetext
    #foreach($p in $sorter.tagSort($Package, "MyStereotype", "tagA:desc", true))
    $report.getStereotypePropertyString($p, "Mystereotype", "tagA") :: $p.name
    #end
    • $package is the collection to be sorted.
    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify tagName to be sorted.
      • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.
    • If this parameter is not defined in the function, the forceNumber default value of false will be applied.


    $sorter.tagSort($collection, $stereotype, $tagName)

    This function is for sorting a collection item by specifying an applied stereotype object and tag name.


    NameTypeDescription
    Parameter(s)collectionjava.util.CollectionA collection to be sorted.

    stereotypecom.nomagic.uml2.ext.magicdraw.mdprofiles.StereotypeAn applied stereotype object.

    tagNamejava.lang.StringA tag name of the applied stereotype and the sorting direction.
    Return-java.util.CollectionA sorted collection.

    For example:

    Code Block
    languagetext
    #foreach($p in $sorter.tagSort($Package, $stereotype, "tagA:desc"))
    $report.getStereotypePropertyString($p, "Mystereotype", "tagA") :: $p.name
    #end
    • $package is the collection to be sorted.
    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify tagName to be sorted.
      • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.
    sorter


    $sorter.tagSort($collection, $stereotype, $tagName, $forceNumber)

    This function is for sorting a collection item by specifying an applied stereotype object and tag name and forcing a tag value to convert to a numeric before sorting.


    NameTypeDescription
    Parameter(s)collectionjava.util.CollectionA collection to be sorted.

    stereotypecom.nomagic.uml2.ext.magicdraw.mdprofiles.StereotypeAn applied stereotype object.

    tagNamejava.lang.StringA tag name of the applied stereotype and the sorting direction.

    forceNumberbooleanTrue if a tag value is converted to a numeric before sorting.
    Return-java.util.CollectionA sorted collection.

    For example:

    Code Block
    languagetext
    #foreach($p in $sorter.tagSort($Package, $stereotype, "tagA:desc", true))
    $report.getStereotypePropertyString($p, "Mystereotype", "tagA") :: $p.name
    #end
    • $package is the collection to be sorted.
    • "name:desc" is separated by ":" in two parts:
      • The first part is to identify tagName to be sorted.
      • The second part is the option to identify the sorting scheme. Sometimes, the order is not identified. It is ascending by default.
    • If this parameter is not defined in the function, the forceNumber default value of false will be applied.