[CONSULT-1524] changed execution from member to method parameter#2
[CONSULT-1524] changed execution from member to method parameter#2eugenweissbart wants to merge 4 commits intohydra-billing:masterfrom
Conversation
build.xml
Outdated
| </path> | ||
| <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.classpath" /> | ||
| --> | ||
| <property name="groovy.home" value="/usr/local/Cellar/groovy" /> |
There was a problem hiding this comment.
This is where it's located on my mac. Will revert in next commit.
| false | ||
| } | ||
| } | ||
| } No newline at end of file |
| switch (event) { | ||
| case ActivitiActivityEventImpl: | ||
| detailedLog = getActivityLog() | ||
| detailedLog = "${event.getActivityId()} (${event.getActivityType()} - ${event.getActivityName()})" |
There was a problem hiding this comment.
You could still use that functions, but pass event as a param.
There was a problem hiding this comment.
I don't find them much necessary as they just return a single string
There was a problem hiding this comment.
They are pretty complicated. We use this functions to simplify code.
| def protected execute() { | ||
|
|
||
| def protected execute(execution) { |
There was a problem hiding this comment.
Don't you need to describe type of execution like:
DelegateExecution execution?
|
|
||
| logger | ||
| } | ||
| } No newline at end of file |
src/bss/http.groovy
Outdated
| def HTTPRestProcessor(parameters) { | ||
| this.execution = parameters.execution | ||
| this.httpClient = new RESTClient(parameters.baseUrl) | ||
| this.httpClient.ignoreSSLIssues() |
There was a problem hiding this comment.
Easy man, easy. What happened here?
There was a problem hiding this comment.
Oops, this was for testing purposes (self-signed SSL cert error) and didnt go away, will fix
src/bss/http.groovy
Outdated
| logger = execution.getVariable("logger") | ||
| } | ||
|
|
||
| logger |
There was a problem hiding this comment.
This method could be shortened to something like:
def protected getLogger(DelegateExecution execution) {
if (execution) {
execution.getVariable("logger")
}
}
There was a problem hiding this comment.
Will this actually return the logger?
|
|
||
| def public sendRequest(params, String method) { | ||
| def execution = params.execution | ||
| params.remove('execution') |
There was a problem hiding this comment.
groovy's HTTPBuilder has this strange check that caused the code to fail if execution stays in params map.
|
|
||
| import org.activiti.latera.bss.eventListeners.AbstractListener | ||
| import org.activiti.latera.bss.http.HTTPRestProcessor | ||
| import org.activiti.engine.delegate.event.* |
There was a problem hiding this comment.
I think you use only ActivitiEvent from this package.
| def orderData = getOrderData(execution) | ||
| def orderDataBuffer = execution.getVariable('homsOrdDataBuffer') | ||
|
|
||
| if (orderData != orderDataBuffer) { |
There was a problem hiding this comment.
You don't need variable orderDataBuffer. Just compare directly to result of execution.getVariable.
There was a problem hiding this comment.
Won't agree here because the variables are changed already, here we have a few options
- use homsOrdDataBuffer
- get variables from HOMS before comparsion (not good as will add one HTTP GET request each AutoSaveOrderData run (basically each ACTIVITI_COMPLETED event)
- push variables seamlessly each ACTIVITI_COMPLETED (even worse)
There was a problem hiding this comment.
Discussed, will replace orderDataBuffer with execution.getVariable('homsOrdDataBuffer')
* Changed groovy path in build.xml * Added trailing newlines where missing * Fixed execute method declaration in src/bss/executionListeners/abstract_listener.groovy * Fixed alignment in src/bss/executionListeners/init_logging.groovy * Removed unnecessary ignoreSSLIssues call in src/bss/http.groovy * Shortened getLogger declaration in src/bss/http.groovy * Fixed imports for src/homs/eventListeners/auto_save_order_data.groovy * Removed unnecessary orderDataBuffer variable in src/homs/eventListeners/auto_save_order_data.groovy
build.xml
Outdated
| <property name="dst.build" location="${dst}/build" /> | ||
| <property name="dst.lib" location="${dst}/lib" /> | ||
|
|
||
| <!-- |
There was a problem hiding this comment.
Just remove this code if you don't need it.
| execute() | ||
| def execution = getExecution(event) | ||
|
|
||
| execute(execution, event) |
There was a problem hiding this comment.
Remove def execution and change this line to:
execute(getExecution(event), event)
| switch (event) { | ||
| case ActivitiActivityEventImpl: | ||
| detailedLog = getActivityLog() | ||
| detailedLog = "${event.getActivityId()} (${event.getActivityType()} - ${event.getActivityName()})" |
There was a problem hiding this comment.
They are pretty complicated. We use this functions to simplify code.
| } | ||
|
|
||
| def protected getLogger(DelegateExecution execution) { | ||
| def logger = null |
There was a problem hiding this comment.
def protected getLogger(DelegateExecution execution) {
if (execution) {
execution.getVariable("logger")
}
}
I'm pretty sure it works the same.
| def homsUser = getParameterValue('homsUser', execution) | ||
| def homsPassword = getParameterValue('homsPassword', execution) | ||
| def execute(execution) { | ||
| def homsUrl = execution.getVariable('homsUrl') |
* Removed commented options in build.xml * Removed unneeded execution variable definition in src/bss/eventListeners/abstract_listener.groovy * Re-implemented detailed log functions in src/bss/eventListeners/event_logging.groovy * Shortened getLogger for src/bss/executionListeners/abstract_listener.groovy too * Fixed alignment in src/homs/executionListeners/finish_order.groovy
No description provided.