Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Inhalt
maxLevel5

Releases

VersionDateNotesCompatibility
1.0.012.03.2021First published versionab Nuclos 4.46.1

Overview

This Nuclet is a collection of many frequently needed Java methods, data sources and resources that support Nuclet development and standardise Nuclet behaviour.

Description of the Utils classes 

All methods presented here are static.

Some methods use constants, such as the format pattern 'HH:mm:ss' for formatting the time. Most of these constants are Nuclet parameters and can be adjusted accordingly.

After adjusting the Nuclet parameters, the job Initialisiere NucletUtils must be run once, otherwise the changes may only take effect after the next server start.

ClassDescription
NucletBOUtils

This class contains helpful methods around business objects, e.g.

  • getBusinessObjectByName(Land.class, Konstanten.Land.DEUTSCHLAND)
  • getOrCreateBusinessObjectByName(Land.class, Konstanten.Land.DEUTSCHLAND, Land.IsoCode, "DE")
  • setBusinessObjectAttribute(Auftrag.class, Auftrag.Dringend, Boolean.TRUE)
  • getResource("Word-Vorlage")
  • saveBusinessObjectWithoutRules(auftrag)
  • getStateList("Auftrag")
  • getLink(auftrag) = "http://localhost:80/nuclos/rest/bos/org_nuclet_test_Auftrag/109194126"
  • areDifferent(auftrag1.getKundeId(), auftrag2.getKundeId())
NucletDateUtils

This class contains helpful date functions, e.g.

  • getDate(year, month, day)
  • getYear(date)
  • getDaysBetweenDates(date1, date2)
  • addToDate(date, Calendar.MONTH, -1)
  • isSameDay(date1, date2)
  • isGeneralHoliday(date)
  • isWorkday(date)
  • max(date1, date2)
NucletDialogUtils

This class contains helpful dialog functions, e.g.

  • dialogYesNo("No shipping costs", "The order has no shipping costs. Continue?", "org.nuclet.firma.Auftrag", String "Action cancelled")
  • dialogOkCancel(title, message, contextIdentifier, cancelMessage) 
  • dialogGetInput(title, message, contextIdentifier)
  • dialogGetSelection(title, message, contextIdentifier, options)
NucletExcelUtils

This class contains helpful methods for working with Excel lists, e.g.

  • getCellName(row, column)
  • getCellValue(row, column)
  • writeCellValue(sheet, rownumber, columnnumber, value)
  • writeCellValue(cell, value)
  • getWorkbookTemplate(template)
  • writeCellFormula(row, firstrow, columnnumber, getColumnSum(row, column_start, column_end))
NucletFileUtils

This class contains helpful methods for file handling, e.g.

  • writeArrayToNuclosFile(filename, content)
  • writeStringToNuclosFile(filename, string)
  • writeNuclosFileToFile(nuclosFile)
NucletFormatUtils
This class contains helpful methods for formatting tasks, e.g.
  • format(date) = "01.03.2021"
  • format(date, "yy-MM-dd") = "21-03-01"
  • formatTime(date) = "12:20:44"
  • formatWeek(date) = "KW 13"
  • formatDateTime(date) = "01.03.2021 12:20:44"
  • formatDateForFile(date) = "2021-03-01"
  • formatCurrency(bdValue) = "2.412,37 €" 
  • formatRoman(2021) = "MMXXI"
  • formatExcelColumnName(30) = "AD"
  • isInteger(string)
  • getInteger(string)
NucletHtmlUtils

This class contains helpful methods for HTML formatting, e.g.

  • bold(string) = "<b>string</b>"
NucletImageUtils
This class contains helpful methods for images, e.g.
  • getThumbnail(image, width, height)
NucletLoggingUtils
This class contains helpful methods for logging, e.g.
  • log(message)
NucletMigrationUtils

This class contains helpful methods for migrations, e.g.

  • confirmMigrationHasNotBeenExecuted(name)
  • startMigration(name, context);
  • finishMigration(protokoll, context);
NucletNumberUtils
This class contains helpful mathematical methods. Many of them do not return an error if a BigDecimal argument == null, but instead return null.
  • min(BigDecimal a, BigDecimal b)
  • sum(BigDecimal a, BigDecimal b)
  • quotient(BigDecimal a, BigDecimal b)
  • areAlmostEqual(BigDecimal a, BigDecimal b)
  • getDiscountedAmount(BigDecimal amount, BigDecimal discount)
  • getOriginalAmount(BigDecimal amount, BigDecimal discount)
NucletParameterUtils

This class contains helpful methods for Nuclet parameters, e.g.

  • getNucletParameterAsInteger(uid)
  • getNucletParameterAsPositiveInteger(uid)
  • getNucletParameterAsBigDecimal(uid)
  • getNucletParameterAsBoolean(uid)
NucletStringUtils

This class contains helpful methods for strings, e.g.

  • leftpad("12", 4) = "0012"
  • shorten("123456789", 7) = "1234..."
  • createPassword(8) = "F62hpN1c"
NucletUserUtils
This class contains helpful methods for users and user groups, e.g.
  • confirmUserhasRole(user, role)
  • getUser(String benutzernuclos)
NucletUtilsInitialisieren
Job rule that activates updated Nuclet parameters for the rules. Otherwise the changed parameters may only take effect after the next server restart.

Description of the Data sources

Data sourceDescription
EntityRules
Returns all insert, insertFinal, update and updateFinal rules that are executed for a specified BO
Nuclet parameters
Returns the name of a Nuclet parameter for its uid
Resource
Returns the resource (content) for the specified name
StatesForModel
Returns all states that belong to the specified state model (name)
ModelForState
Returns the name of the state model to which a specified state (uid) belongs
Transitions
Returns all incoming and outgoing state transitions for a particular state (model, numeral)
Usage in Datasources
Returns all usages of a given database field in Nuclos data sources and database objects.
This is very helpful when you want to rename or delete such a field
Find Table for id
Finds all tables in which the specified intid is used
Find Table for struid
Finds all tables in which the specified struid is used

Description of the Reports

Data sourceDescription
Usage in Datasources
Returns all usages of a given database field in Nuclos data sources and database objects.
This is very helpful when you want to rename or delete such a field
Find Table for id
Finds all tables in which the specified intid is used
Find Table for struid
Finds all tables in which the specified struid is used

Description of the Jobs

Data sourceDescription
InitialisiereNucletUtils
This job should be run when something in the Nuclet parameters of NucletUtils has been changed.

Description of the BO's

Data sourceDescription
Migration log
Here Nuclos can remember whether migrations that should not be run multiple times have already taken place (see also the Utils class NucletMigrationUtils)
Parameter

Global parameters can be stored here, similar to Nuclet parameters. The advantage here is that they can be grouped into lists, which is clearer when you have very many parameters.
The NucletParameterUtils class provides the appropriate methods for determining the parameters. 

System/Tabelle/*
These are virtual BOs that make system tables readable.
Helps in searching for system objects and in determining properties in rule code.

Description of the Database functions

Database objectDescription
LB20_CA_AMPEL
Returns a correspondingly coloured traffic light for the arguments 'G'(reen), 'Y'(ellow) and 'R'(ed), and a grey traffic light for all other values
LB20_FN_GET_PARAMETER
Returns a parameter value for a parameter list and a parameter name, see also BO Parameter

Description of the Resources

Data sourceDescriptionNote
Traffic lights
Here there are traffic lights in various colours, which are used e.g. by the database function LB20_CA_AMPEL benutzt werden are used
Emojis

Some standard emojis

Checkbox
Checkbox symbols, e.g. for display in a PDF
CSS template

CSS template with a collection of frequently used CSS code blocks for use in the system parameter "WEBCLIENT CSS" or as a client extension in the Nuclet. Copy the required CSS passages and configure them with your own colours or parameters.

Layout for transaction data - 
three columns + tab panel, line spacing 10 px

Layout for use in transaction data. Contents: 

  • frame with heading (large font)
  • three columns for attributes
  • line spacing: 10 px
  • tab pane with two tabs → attributes + subform

Layout for master data - 
one column, line spacing 10 px

Layout for use in master data. Contents:

  • frame with heading (large font)
  • one column for attributes
  • line spacing: 10 px

Layout for master data - 
two columns, line spacing 10 px

Layout for use in master data. Contents:

  • frame with heading (large font)
  • two columns for attributes
  • line spacing: 10 px

...