JamCommons
Overview
This module adds a number of reusable java actions and microflows to your project.
See the documentation and screenshot for an overview of all the functionality.
Documentation
JamCommons documentation
EventHandlers
AfterStartup
Use this as Startup microflow. All AfterStartup (exact name) microflows in other modules will be executed when the JammCommons microflow is executed.
OnCreateSessionScoped
Sets an association between the SessionScoped object and CurrentSession. The SessionScoped object will be deleted after the CurrentSession is removed because of the delete behavior on the association.
OnCreateSessionScopedImage
Sets an association between the SessionScopedImage object and CurrentSession. The SessionScopedImage object will be deleted after the CurrentSession is removed because of the delete behavior on the association.
ExecuteMicroflow
ExecuteAllAfterStartupFlows
Execute all flows found with the name “AfterStartup”
ExecuteAllBeforeShutdownFlows
Execute all flows found with the name “BeforeShutdown”
ExecuteMicroflowInputObjectReturnVoid
Executes a microflow with an object and returns a boolean.
ExecuteMicroflowInputStringReturnList
Executes a microflow with an objecttype and string and returns a list of that objecttype.
ExecuteMicroflowInputStringReturnObject
Executes a microflow with an objecttype and string and returns an object of that objecttype.
ExecuteMicroflowWithoutModuleName
Executes a microflow who’s name is equal to the input string. Module independent.
Java
StoreHttpResponseInFileDocument
Store the HTTP response in a FileDocument
ArrayFilterOnSpecialisation
Return a list with only objects from a given specialisation
ArrayGet
Returns the value of the indexed component in the specified array object.
CascadeCommit
Commits every object that has an association with the input object excluding system objects.
CascadeCommitSessionScoped
Commits only SessionScoped objects that has an association with the input SessionScoped object
CompareHashedString
Compares 2 hashed strings. Returns true if they are the same. Use an object and his hashed string attribute and a unhashed string you want to compare it with as input.
CreateObject
Creates an object based on the object type of the input parameter.
FileDocumentFromFile
Loads a file from the /resources folder and stores it inside a FileDocument.
GetEntityName
Return entity name as string.
GetMicroflowName
Return microflow name as string.
InstantiateAssociations
Instantiate 1 to 1 associations.
LogLevelFromString
Return enum value based on string.
MonthsBetween
Calculates the amount of months between two dates.
ResizeImage
Resize an image (maintaining aspect ratio of the lowest value) and writes the image to a new object
RetrieveObjectByGuid
Retrieves an object by his Guid.
RetrieveSingleton
Use singleton pattern in Mendix. If parent is empty the object is retrieved or created and committed. If the parent is not empty then the object is retrieved via his parent and if the object is not found a new one is created and committed. The association has to be one to one.
RotateImage
Rotate an image and writes the image to a new object
RoundByMultiple
Round a value to the nearest value possible by the multiplier.
SpelloutNumber
Returns the spelled out number. For example: 4 will be “four”, depending on the locale.The locale string for Dutch is: nl_NL
StringClean
Clean a string by:
- Trimming
- Remove control characters
- Remove non-printable characters
StringJoin
Concatenates the given elements with the delimiter and returns the concatenated string.
StringSplit
Splits this string around matches of the given regular expression.Trailing empty strings are not included in the resulting array.
The string “boo:and:foo”, for example, yields the following results with these expressions:
: { "boo", "and", "foo" } · { "b
ObjectActions
DeleteNewSessionScopedObjects
Deletes all non-committed SessionScoped objects.
Retrieve
RetrieveDecimalWhenEmpty
Returns 0 if the decimal is empty. If the decimal is known, that value is returned.
RetrieveFormattedCurrency
Retrieves a formatted currency (euro sign and thousand seperator) from a decimal.
RetrieveFormattedDate
Retrieves a formatted date (d MMMM yyyy)from an DateTime.
RetrieveFormattedPercentage
Retrieves an formatted percentage with 2 decimals from a decimal.
RetrieveFormattedTabbedCurrency
Retrieves a formatted currency (euro sign and thousand seperator) from a decimal with a tab between the euro sign and the amount.
RetrieveStringWhenEmpty
Returns ‘’ instead of empty when the string is empty. If the string is known, the value is returned.
Rules
IsNumberNegative
Returns true of the decimal is negative.