Date: Sun, 2 Oct 2022 01:18:41 +0800 (CST) Message-ID: <220259170.3024.1664644721729@izbp1i1jfn47dnwbl698x4z> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3023_669298606.1664644721728" ------=_Part_3023_669298606.1664644721728 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The main goal of Gears Properties Manager is to manage system level and = global parameters;
In some enterprises with strong development ability, it is inconvenient = to use some global variables in various app For example, in ScriptRunner, s= ome customized scripts are often written into the workflow to obtain busine= ss data and send it to the third-party system. The third-party information = may include some URLs, account names and passwords, or other parameters. Wh= en these parameters are written more, the workload of modifying these workf= lows will be a challenge for changing them.
Therefore, the use of this app is to define global parameters, which can= be referenced to any required address. Just remember the key and value, an= d it will have the effect of one modification then all modifications.
At the same time, because of the global visual management of these param= eters, it is more convenient for operation and maintenance. You only need t= o query in the system without asking the specific developers how to define = them.
In this case, we write multiple scripts and put them in different places= . Usually, we will write the obtained value of this custom field in the scr= ipt
customFieldManager.getCustomFieldObjectByName= ("development leader") |
---|
Or we can write it this way,
customFieldManager.getCustomFieldObjec (123456L)= |
---|
In this case, it is also possible that this field is accidentally delete= d and re created; Then its ID value will also change. You still need to fin= d all the scripts in the system that use this code to modify its value.
Or in the following cases, the ID value or name is inconsistent in our p= roduction environment or test environment, which will also lead to the scri= pt debugged in the test environment, and the script obtained from the produ= ction environment can only be run by changing this value one by one.
For the above scenarios, using this plug-in, we can define a fixed varia= ble in it. The value of this variable can be quickly managed visually. Afte= r modifying this value, all the changes in the system will take effect, whi= ch makes it convenient for us to manage these variables in a unified way, s= o as to achieve visual and global management of variable scripts used every= where in our system.
In order to manage global parameters and facilitate the maintenance of m= anagers, for example, if an administrator needs to write multiple parameter= s for interfacing with a third-party system, he can group by these paramete= rs;
Therefore, the global grouping will be distinguished by prefix in this a= pp; When managing parameters, you first need to determine which prefix for = them .
Prefix information is a definition of grouping global parameters, so pre= fix management is required.
You can navigate to the prefix information to add and manage prefixes. A= fter saving, the prefix information defined in the system will be displayed= .
Key-value is effective information provided for business use. It is allo= wed to add a key value pair to the corresponding prefix to obtain informati= on through full key in the system.
You can select the prefix defined in the system to query all key value p= airs included in this prefix. Of course, you can also modify a key value pa= ir.
If you need to add a new key value pair to a prefix, you can add one. At= this time, click "add" to pop up the add interface
When the key value pair is defined and newly added, its information can = be obtained where needed for business processing.
Yes, you can use this kind of com.atlassian.jira.config.properti= es. Applicationproperties and use its getText() m= ethod.
String v= alue =3D applicationProperties.getString($fullkey) ;=20
Get all key-values information for a prefix
REST URL
/rest/gears= properties/1.0/properties/prefix/{prefixkey}
get<= /span>
/rest/gearsproperties/1.0/properti= es/prefix/ITDESK
{ "fullkey": "HKTXPROPERTIESKEY.ITDESK.StaffId", "prefix": "ITDESK", "key": "StaffId", "value": "1123" }, { "fullkey": "HKTXPROPERTIESKEY.ITDESK.key1", "prefix": "ITDESK", "key": "key1", "value": "value11" }, { "fullkey": "HKTXPROPERTIESKEY.ITDESK.key2", "prefix": "ITDESK", "key": "key2", "value": "value22" } ]=20
Get a value for a specific full key
/rest/gears= properties/1.0/properties/fullkey/{fullkey}
get<= /span>
/rest/gearsproperties/1.0/properti= es/fullkey/HKTXPROPERTIESKEY.ITDESK.StaffId
[
{ "fullkey": "HKTXPROPERTIESKEY.ITDESK.StaffId", "value": "1123" }=20
First, we define a variable value by this app=EF=BC=88 prefix is=EF=BC= =9ASCRITRUNNER=EF=BC=8CKEY is =EF=BC=9ADEV_OWNER=EF=BC=89 then its fullkey = is=EF=BC=9AHKTXPROPERTIESKEY.SCRITRUNNER.DEV_OWNER , value is=EF=BC=9A123456
Your code may be like this
import com.atlassian.jira.config.properties.A= pplicationProperties String <= span style=3D"color: rgb(255,0,0);">devOwnerCustomfieldId =3D applic= ationProperties.getString("HKTXPROPERT= IESKEY.SCRITRUNNER.DEV_OWNER") ; CustomField devOwnerCustomfield =3D customFi= eldManager.getCustomFieldObject(Long.parseLong(devOwnerCustomfieldId)); ApplicationUser devOw= nerUser =3D issue.getCustomFieldValue(devOwnerCustomfield); |
---|