Skip to content

Commit 83c0000

Browse files
feat: Add process for Export Current Role Accesses of record. (#54)
* feat: Add process for `Export Current Role Accesses` of record. * fix spaces. * validate client id of record and session.
1 parent b524ee5 commit 83c0000

File tree

3 files changed

+209
-0
lines changed

3 files changed

+209
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/******************************************************************************
2+
* Product: ADempiere ERP & CRM Smart Business Solution *
3+
* Copyright (C) 2006-2017 ADempiere Foundation, All Rights Reserved. *
4+
* This program is free software, you can redistribute it and/or modify it *
5+
* under the terms version 2 of the GNU General Public License as published *
6+
* or (at your option) any later version. *
7+
* by the Free Software Foundation. This program is distributed in the hope *
8+
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
9+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
10+
* See the GNU General Public License for more details. *
11+
* You should have received a copy of the GNU General Public License along *
12+
* with this program, if not, write to the Free Software Foundation, Inc., *
13+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
14+
* For the text or an alternative of this public license, you may reach us *
15+
* or via info@adempiere.net *
16+
* or https://github.com/adempiere/adempiere/blob/develop/license.html *
17+
*****************************************************************************/
18+
19+
package org.spin.eca56.process;
20+
21+
import org.adempiere.core.domains.models.I_AD_Role;
22+
import org.adempiere.exceptions.AdempiereException;
23+
import org.compiere.model.MRole;
24+
import org.compiere.model.Query;
25+
import org.compiere.util.Env;
26+
import org.spin.eca56.util.queue.ApplicationDictionary;
27+
import org.spin.queue.util.QueueLoader;
28+
29+
/** Generated Process for (Export Current Role Accesses)
30+
* @author Edwin Betancourt, EdwinBetanc0urt@outlook.com, https://github.com/EdwinBetanc0urt
31+
* @version Release 3.9.4
32+
*/
33+
public class ExportCurrentRoleAccesses extends ExportCurrentRoleAccessesAbstract
34+
{
35+
@Override
36+
protected void prepare()
37+
{
38+
// Valid Record Identifier
39+
if (this.getRecord_ID() < 0) {
40+
throw new AdempiereException("@FillMandatory@ @AD_Role_ID@");
41+
}
42+
43+
super.prepare();
44+
}
45+
46+
@Override
47+
protected String doIt() throws Exception
48+
{
49+
exportCurrentRoleAccesses();
50+
return "Ok";
51+
}
52+
53+
private void exportCurrentRoleAccesses() {
54+
addLog("@AD_Role_ID@");
55+
56+
MRole role = new Query(
57+
getCtx(),
58+
I_AD_Role.Table_Name,
59+
I_AD_Role.COLUMNNAME_AD_Role_ID + " = ?",
60+
get_TrxName()
61+
)
62+
.setParameters(this.getRecord_ID())
63+
.first()
64+
;
65+
66+
final int clientId = Env.getAD_Client_ID(getCtx());
67+
if (clientId != role.getAD_Client_ID()) {
68+
throw new AdempiereException("@AD_Role_ID@ @RecordOfAnotherClient@");
69+
}
70+
71+
QueueLoader.getInstance()
72+
.getQueueManager(ApplicationDictionary.CODE)
73+
.withEntity(role)
74+
.addToQueue()
75+
;
76+
addLog(role.getAD_Role_ID() + " - " + role.getName());
77+
}
78+
79+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/******************************************************************************
2+
* Product: ADempiere ERP & CRM Smart Business Solution *
3+
* Copyright (C) 2006-2017 ADempiere Foundation, All Rights Reserved. *
4+
* This program is free software, you can redistribute it and/or modify it *
5+
* under the terms version 2 of the GNU General Public License as published *
6+
* or (at your option) any later version. *
7+
* by the Free Software Foundation. This program is distributed in the hope *
8+
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
9+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
10+
* See the GNU General Public License for more details. *
11+
* You should have received a copy of the GNU General Public License along *
12+
* with this program, if not, write to the Free Software Foundation, Inc., *
13+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
14+
* For the text or an alternative of this public license, you may reach us *
15+
* or via info@adempiere.net *
16+
* or https://github.com/adempiere/adempiere/blob/develop/license.html *
17+
*****************************************************************************/
18+
19+
package org.spin.eca56.process;
20+
21+
import org.compiere.process.SvrProcess;
22+
23+
/** Generated Process for (Export Current Role Accesses)
24+
* @author ADempiere (generated)
25+
* @version Release 3.9.4
26+
*/
27+
public abstract class ExportCurrentRoleAccessesAbstract extends SvrProcess {
28+
/** Process Value */
29+
private static final String VALUE_FOR_PROCESS = "ECA56_ExportCurrentRoleAccesses";
30+
/** Process Name */
31+
private static final String NAME_FOR_PROCESS = "Export Current Role Accesses";
32+
/** Process Id */
33+
private static final int ID_FOR_PROCESS = 54759;
34+
35+
@Override
36+
protected void prepare() {
37+
}
38+
39+
/** Getter Parameter Value for Process ID */
40+
public static final int getProcessId() {
41+
return ID_FOR_PROCESS;
42+
}
43+
44+
/** Getter Parameter Value for Process Value */
45+
public static final String getProcessValue() {
46+
return VALUE_FOR_PROCESS;
47+
}
48+
49+
/** Getter Parameter Value for Process Name */
50+
public static final String getProcessName() {
51+
return NAME_FOR_PROCESS;
52+
}
53+
54+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<Migrations>
3+
<Migration EntityType="ECA56" Name="ECA56 Add Process for Export Current Role Accesses" ReleaseNo="1.0" SeqNo="10240">
4+
<Comments>ECA56 Add process for Export Current Role Accesses of record to external service</Comments>
5+
<Step SeqNo="10" StepType="AD">
6+
<PO AD_Table_ID="284" Action="I" Record_ID="54759" Table="AD_Process">
7+
<Data AD_Column_ID="63488" Column="AD_Browse_ID" isNewNull="true"/>
8+
<Data AD_Column_ID="2802" Column="AD_Client_ID">0</Data>
9+
<Data AD_Column_ID="56515" Column="AD_Form_ID" isNewNull="true"/>
10+
<Data AD_Column_ID="2803" Column="AD_Org_ID">0</Data>
11+
<Data AD_Column_ID="7752" Column="AD_PrintFormat_ID" isNewNull="true"/>
12+
<Data AD_Column_ID="2801" Column="AD_Process_ID">54759</Data>
13+
<Data AD_Column_ID="4374" Column="AD_ReportView_ID" isNewNull="true"/>
14+
<Data AD_Column_ID="11834" Column="AD_Workflow_ID" isNewNull="true"/>
15+
<Data AD_Column_ID="5790" Column="AccessLevel">6</Data>
16+
<Data AD_Column_ID="4656" Column="Classname">org.spin.eca56.process.ExportCurrentRoleAccesses</Data>
17+
<Data AD_Column_ID="57920" Column="CopyFromProcess">N</Data>
18+
<Data AD_Column_ID="2805" Column="Created">2024-10-10 18:12:25.929</Data>
19+
<Data AD_Column_ID="2806" Column="CreatedBy">1001212</Data>
20+
<Data AD_Column_ID="2810" Column="Description">Allows export current role accesses for external service</Data>
21+
<Data AD_Column_ID="6485" Column="EntityType">ECA56</Data>
22+
<Data AD_Column_ID="78843" Column="GenerateClass">N</Data>
23+
<Data AD_Column_ID="2811" Column="Help">This process use a queue for export current role accesses. Please note that only the current record is considered.</Data>
24+
<Data AD_Column_ID="2804" Column="IsActive">true</Data>
25+
<Data AD_Column_ID="12458" Column="IsBetaFunctionality">false</Data>
26+
<Data AD_Column_ID="4214" Column="IsDirectPrint">false</Data>
27+
<Data AD_Column_ID="3371" Column="IsReport">false</Data>
28+
<Data AD_Column_ID="14084" Column="IsServerProcess">false</Data>
29+
<Data AD_Column_ID="50182" Column="JasperReport" isNewNull="true"/>
30+
<Data AD_Column_ID="2809" Column="Name">Export Current Role Accesses</Data>
31+
<Data AD_Column_ID="2813" Column="ProcedureName" isNewNull="true"/>
32+
<Data AD_Column_ID="50181" Column="ShowHelp">Y</Data>
33+
<Data AD_Column_ID="6652" Column="Statistic_Count">0</Data>
34+
<Data AD_Column_ID="6653" Column="Statistic_Seconds">0</Data>
35+
<Data AD_Column_ID="84383" Column="UUID">d682a596-7116-4d86-b158-3f7235ada70b</Data>
36+
<Data AD_Column_ID="2807" Column="Updated">2024-10-10 18:12:25.929</Data>
37+
<Data AD_Column_ID="2808" Column="UpdatedBy">1001212</Data>
38+
<Data AD_Column_ID="4023" Column="Value">ECA56_ExportCurrentRoleAccesses</Data>
39+
<Data AD_Column_ID="11563" Column="WorkflowValue" isNewNull="true"/>
40+
</PO>
41+
</Step>
42+
<Step SeqNo="20" StepType="AD">
43+
<PO AD_Table_ID="287" Action="I" Record_ID="0" Table="AD_Process_Trl">
44+
<Data AD_Column_ID="2845" Column="AD_Client_ID">0</Data>
45+
<Data AD_Column_ID="2844" Column="AD_Language">es_MX</Data>
46+
<Data AD_Column_ID="2846" Column="AD_Org_ID">0</Data>
47+
<Data AD_Column_ID="2843" Column="AD_Process_ID">54759</Data>
48+
<Data AD_Column_ID="2848" Column="Created">2024-10-10 18:12:26.477</Data>
49+
<Data AD_Column_ID="2849" Column="CreatedBy">1001212</Data>
50+
<Data AD_Column_ID="2853" Column="Description">Permite exportar los accesos de rol actual para el servicio externo</Data>
51+
<Data AD_Column_ID="2854" Column="Help">Este proceso utiliza una cola para exportar los accesos al rol actual. Tenga en cuenta que sólo se considera el registro actual</Data>
52+
<Data AD_Column_ID="2847" Column="IsActive">true</Data>
53+
<Data AD_Column_ID="2855" Column="IsTranslated">false</Data>
54+
<Data AD_Column_ID="2852" Column="Name">Exportar Accesos del Rol Actual</Data>
55+
<Data AD_Column_ID="84387" Column="UUID">b2bf7f87-4f78-42b3-b6ca-900c840c0439</Data>
56+
<Data AD_Column_ID="2850" Column="Updated">2024-10-10 18:12:26.477</Data>
57+
<Data AD_Column_ID="2851" Column="UpdatedBy">1001212</Data>
58+
</PO>
59+
</Step>
60+
<Step SeqNo="30" StepType="AD">
61+
<PO AD_Table_ID="53660" Action="I" Record_ID="54759" Table="AD_Table_Process">
62+
<Data AD_Column_ID="69639" Column="AD_Client_ID">0</Data>
63+
<Data AD_Column_ID="69640" Column="AD_Org_ID">0</Data>
64+
<Data AD_Column_ID="69647" Column="AD_Process_ID">54759</Data>
65+
<Data AD_Column_ID="69648" Column="AD_Table_ID">156</Data>
66+
<Data AD_Column_ID="69642" Column="Created">2024-10-11 23:20:12.896</Data>
67+
<Data AD_Column_ID="69644" Column="CreatedBy">1001212</Data>
68+
<Data AD_Column_ID="69649" Column="EntityType">ECA56</Data>
69+
<Data AD_Column_ID="69641" Column="IsActive">true</Data>
70+
<Data AD_Column_ID="84427" Column="UUID">7dfafc55-3f48-4054-9831-3be7b159d1bc</Data>
71+
<Data AD_Column_ID="69643" Column="Updated">2024-10-11 23:20:12.896</Data>
72+
<Data AD_Column_ID="69645" Column="UpdatedBy">1001212</Data>
73+
</PO>
74+
</Step>
75+
</Migration>
76+
</Migrations>

0 commit comments

Comments
 (0)