-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK-56182: Add analytics for processes app (#90)
Add analytics for processes app
- Loading branch information
Showing
12 changed files
with
166 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...s-services/src/main/java/org/exoplatform/processes/listener/ProcessAnalyticsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.exoplatform.processes.listener; | ||
|
||
import org.exoplatform.analytics.model.StatisticData; | ||
import org.exoplatform.analytics.utils.AnalyticsUtils; | ||
import org.exoplatform.processes.model.WorkFlow; | ||
import org.exoplatform.services.listener.Event; | ||
import org.exoplatform.services.listener.Listener; | ||
import org.exoplatform.container.xml.InitParams; | ||
|
||
public class ProcessAnalyticsListener extends Listener<Long, WorkFlow> { | ||
|
||
private final String operation; | ||
|
||
public ProcessAnalyticsListener(InitParams initParams) { | ||
this.operation = initParams.getValueParam("operation").getValue(); | ||
} | ||
|
||
@Override | ||
public void onEvent(Event<Long, WorkFlow> event) throws Exception { | ||
StatisticData statisticData = new StatisticData(); | ||
long userId = event.getSource(); | ||
WorkFlow workFlow = event.getData(); | ||
statisticData.setModule("processes"); | ||
statisticData.setSubModule("process"); | ||
statisticData.setOperation(operation); | ||
statisticData.setUserId(userId); | ||
statisticData.addParameter("processID", workFlow.getId()); | ||
statisticData.addParameter("processName", workFlow.getTitle()); | ||
AnalyticsUtils.addStatisticData(statisticData); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...s-services/src/main/java/org/exoplatform/processes/listener/RequestAnalyticsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.exoplatform.processes.listener; | ||
|
||
import org.exoplatform.analytics.model.StatisticData; | ||
import org.exoplatform.analytics.utils.AnalyticsUtils; | ||
import org.exoplatform.container.xml.InitParams; | ||
import org.exoplatform.processes.model.Work; | ||
import org.exoplatform.processes.model.WorkFlow; | ||
import org.exoplatform.processes.service.ProcessesService; | ||
import org.exoplatform.services.listener.Event; | ||
import org.exoplatform.services.listener.Listener; | ||
import org.exoplatform.task.dto.ProjectDto; | ||
|
||
public class RequestAnalyticsListener extends Listener<Work, ProjectDto> { | ||
|
||
private ProcessesService processesService; | ||
private final String operation; | ||
|
||
public RequestAnalyticsListener(InitParams initParams, ProcessesService processesService) { | ||
this.operation = initParams.getValueParam("operation").getValue(); | ||
this.processesService = processesService; | ||
} | ||
|
||
@Override | ||
public void onEvent(Event<Work, ProjectDto> event) throws Exception { | ||
StatisticData statisticData = new StatisticData(); | ||
Work work = event.getSource(); | ||
ProjectDto project = event.getData(); | ||
WorkFlow workFlow = processesService.getWorkFlowByProjectId(project.getId()); | ||
long userId = work.getCreatorId(); | ||
statisticData.setModule("processes"); | ||
statisticData.setSubModule("request"); | ||
statisticData.setOperation(operation); | ||
statisticData.setUserId(userId); | ||
statisticData.addParameter("processID", workFlow.getId()); | ||
statisticData.addParameter("processName", workFlow.getTitle()); | ||
statisticData.addParameter("requestID", work.getId()); | ||
statisticData.addParameter("requestName", work.getTitle()); | ||
AnalyticsUtils.addStatisticData(statisticData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
processes-webapp/src/main/resources/locale/portlet/Analytics_en.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
analytics.field.label.processID=Processes: Process ID | ||
analytics.field.label.processName=Processes: Process Name | ||
analytics.field.label.requestID=Processes: Request ID | ||
analytics.field.label.requestName=Processes: Request Name | ||
|
||
analytics.processCreated=Process created | ||
analytics.requestCreated=Request created | ||
|
||
analytics.process=Process | ||
analytics.request=Request | ||
analytics.origin.process=Processes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
processes-webapp/src/main/webapp/WEB-INF/conf/processes/analytics-configuration.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<!-- | ||
* Copyright (C) 2022 eXo Platform SAS. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
--> | ||
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd http://www.exoplatform.org/xml/ns/kernel_1_3.xsd" | ||
xmlns="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd"> | ||
|
||
<external-component-plugins profiles="analytics"> | ||
<target-component>org.exoplatform.services.listener.ListenerService</target-component> | ||
<component-plugin> | ||
<name>exo.process.created</name> | ||
<set-method>addListener</set-method> | ||
<type>org.exoplatform.processes.listener.ProcessAnalyticsListener</type> | ||
<init-params> | ||
<value-param> | ||
<name>operation</name> | ||
<value>processCreated</value> | ||
</value-param> | ||
</init-params> | ||
</component-plugin> | ||
<component-plugin> | ||
<name>exo.process.request.created</name> | ||
<set-method>addListener</set-method> | ||
<type>org.exoplatform.processes.listener.RequestAnalyticsListener</type> | ||
<init-params> | ||
<value-param> | ||
<name>operation</name> | ||
<value>requestCreated</value> | ||
</value-param> | ||
</init-params> | ||
</component-plugin> | ||
</external-component-plugins> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters