The configuration of each adapter is adapter-specific, but some concepts are common.
The keyword resource is always followed by a pattern that denotes one or more files or folders in the Eclipse workspace. Generally a resource pattern is composed as follows:
/project_name_pattern/folder_name_pattern/folder_name_pattern/filename_pattern
That is, a resource pattern
/
,
The sequence of these components constitutes a
resource_path, also simply called
path. Adjacent path components are separated by a slash character (
/
) from each other.
Each of these pattern may contain the wildcard characters
*
or
?
. These characters are placeholders representing actual characters in project names, folder names, or filenames, respectively. The asterisk (
*
) stands for a sequence of zero or more characters, a question mark (
?
) is a placeholder for exactly one character. A resource pattern may be matched by multiple actual resources, constitution a resource set. Generally a resource pattern is resolved to zero, one, or more than one actual resources.
Examples:
resource /de.itemis.pedelec.implementation.control/readme.txt
resource *.txt
resource /de.itemis*/readme.???
The first example specifies exactly one file.
The second one specifies all files (or folders or Eclipse projects) whose names are ending on the .txt filename extension.
The third example pertains to all projects starting with
de.itemis
. In these projects, the resource pattern matches all file in the top-level folder beginning with
readme.
followed by a three-characters extension, like, e.g.,
doc
or
txt
. Please note that extensions like
docx
or
c
do not match the pattern.
For all adapters that support the name keyword or attribute mapping, a set of string functions is available. These allow to manipulate the original value that is read from the data source, before it is written into an artifact name or attribute.
Supported functions on basic strings are:
The functions matchAll and split result in a list of strings instead of a single string. You may use all of the above functions on lists of strings. They will be applied to each individual string and the result will be a list of the result strings in the same order. When you use matchAll or split on a list of strings, the resulting substrings will be added in the positions of their respective input strings, i.e., the result will still be a flat list, not a list of lists.
Additionally, the following functions may be used on lists of strings:
When you split a string into a list of strings and don’t use join to turn them back into a single string, the list of strings will automatically be concatenated with ,.
Examples:
Sample call | Result |
---|---|
"SomeSplitAttribute".substringBefore("Split")
|
"Some"
|
"SomeSplitAttribute".substringAfter("split")
|
"Attribute"
|
"Some\\Attribute".replace("\\", "/")
|
"Some/Attribute"
|
"SomeSomeGroupInAttribute".replaceAll(".*(SomeGroupIn).*", "-")
|
"Some-Attribute"
|
"SomeAttributeValue".trim(8, KEEP_PREFIX)
|
"SomeAtt..."
|
"SomeAttributeValue".trim(8, KEEP_SUFFIX)
|
"...teValue"
|
"SomeAttributeValue".trim(8, TRIM_MIDDLE)
|
"Some...lue"
|
"SomeSomeGroupInAttribute".match(".*(SomeGroup).*")
|
"SomeGroup"
|
"Some SomeGroupInAttribute SomeOtherGroup".matchAll(".*(Some\\w*Group).*")
|
"SomeGroup,SomeOtherGroup"
|
"SomeSplitAttributeSplitAttribute".split("Split")
|
"Some,Attribute,Attribute"
|
"SomeSplitAttributeSplitAttribute".split("Split").join("; ")
|
"Some; Attribute; Attribute"
|
"One/Two/Three".split("/").map("["+current+"]")
|
"[One],[Two],[Three]"
|
"One/Two/Three;A/B/C".split(";").map(current.split("/").join(", ")).join(" - ")
|
"One, Two, Three - A, B, C"
|
Regular expressions
are a powerful means for
find or
find and replace operations on character strings. A regular expression, also known as
regex or
regexp, is a sequence of characters that defines a search pattern. For example, the regex
aaa.*bbb
specifies a search pattern matching strings consisting of the letters „aaa”, followed by a (possibly empty) sequence of arbitrary characters, followed by the letters „bbb”.
You can use regular expression in many places when setting up your itemis ANALYZE configuration. ANALYZE supports regular expressions as defined by the Java programming language or, to be more exact, by the java.util.regex.Pattern class.
Java regular expressions are very similar to Perl regular expressions. However, please note that there are a few differences!
There is a very common scenario of a regular expression we want to show you. It is called Text-Until-Next and means, that the regular expression match the whole text until the next match is found. It also solves a problem, that if a matched section contains too many characters, individual matches may no longer be found. The pattern will in general look like this:
(?sm)(^[A][B][C])(.+?(?=\\z|[A])
The above formula contains placeholder [A], [B] and [C]. So you will replace these on your own, also the brackets will be replaced.
We will break this formula into two different parts for an easier explanation.
Part one contains (?sm)(^[A][B][C])
and find the given requirements specifications
Part two contains (.+?(?=\\z|[A])
and groups the following text from the previously found requirement from part one to the next match or to the end of the document.
An example can be looked like:
(?sm)(^ID: .*?\n)(.+?(?=\\z|ID: )
Here the requirements identification [A] is set to
ID: and must be the first element in the line because of the
^. The name of the requirements [B] can be everything
.*? and the name of the requirements [C] ends with a linebreak
\n. The ID and the name of the requirements will be in the first group $1 and the text will be in the second group $2.
So a complete configuration with the groups as mapping looked like this:
„RegEx Tester”, A view in itemis ANALYZE enables you to test your regular expression. You can open this view via Window → Show View → Other... → RegEx Tester. Everywhere in your itemis ANALYZE configuration, where regular expression is used, there is a hyperlink on the regular expression. By pressing this hyperlink via ([Ctrl]+left mouse
), the RegEx Tester view will open automatically and insert the selected regular expression in the view.
Example:
In this example, we clicked on the hyperlink of the regular expression in the itemis ANALYZE configuration. This opens the new view „RegEx Tester” and import the regular expression which was selected. Then we can test the regular expression by inserting text in the box below. After pressing „Find”, the view shows where the text matches the regular expression and highlights in red. Also in the box at the bottom shows more details of the findings. Now you can easily adjust or write your regular expression and get feedback instantly.
Condition Expressions helps user to provide suitable expressions based on certain conditions. The decisions are taken at the runtime based on the value in the condition provided. itemis ANALYZE currently supports 2 types of conditions expressions i.e.
Example : Here in this example based on different conditions output from the if-else ladder varies. if attribute („Name”) contains „Contract” then output shall be – Contract else it will check for remaining conditions and provide suitable outputs, If none of the conditions match then statement in the else block would be the output.
if (attribute ("Name") contains "Contract" ){
valueOf("Name") + "- Contract"
}else if (attribute ("Name") contains "Employee" ){
"- Employee"
}else if (attribute ("Name") contains "Permanent" ){
"- Permanent"
}else{
"- Others"
}
Example : Here in the example output varies based on the value of attribute(„Name”). If attribute („Name”) is „Lenny” then output will be „Lenny Holmes” similarly for other cases. If no case matches then output in the default statement will be provided.
switch (attribute ("Name")) {
case "Lenny" : "Lenny Holmes"
case "Alex" : "Alex G"
default : "Unknown Author"
}
Note : Most of the expressions like attributes/ string functions described in this documentation can be used in if-else blocks or case parts if it makes sense.