-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INTEROP-64: migrate routes to YAML DSL (#199)
* INTEROP-64: migrate routes to YAML DSL * fix: force header value to be integer * docs: correct typo Co-authored-by: Johan Hole <johan.hole@dhis2.org> * refactor: move global exception handler to its own config file --------- Co-authored-by: cjmamo <823038+claudemamo@users.noreply.github.com> Co-authored-by: Johan Hole <johan.hole@dhis2.org>
- Loading branch information
1 parent
665260f
commit f8f30a8
Showing
35 changed files
with
997 additions
and
1,081 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
49 changes: 0 additions & 49 deletions
49
src/main/java/org/hisp/dhis/integration/rapidpro/CompleteDataSetRegistrationFunction.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...a/org/hisp/dhis/integration/rapidpro/aggregationStrategy/DataElementCodeAggrStrategy.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,18 @@ | ||
package org.hisp.dhis.integration.rapidpro.aggregationStrategy; | ||
|
||
import org.apache.camel.AggregationStrategy; | ||
import org.apache.camel.Exchange; | ||
|
||
import java.util.List; | ||
|
||
import static org.apache.camel.builder.Builder.jsonpath; | ||
|
||
public class DataElementCodeAggrStrategy implements AggregationStrategy | ||
{ | ||
@Override | ||
public Exchange aggregate( Exchange oldExchange, Exchange newExchange ) | ||
{ | ||
oldExchange.getMessage().setHeader( "dataElementCodes", jsonpath( "$.dataElements..code" ).evaluate( newExchange, List.class ) ); | ||
return oldExchange; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/org/hisp/dhis/integration/rapidpro/aggregationStrategy/PeriodAggrStrategy.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,14 @@ | ||
package org.hisp.dhis.integration.rapidpro.aggregationStrategy; | ||
|
||
import org.apache.camel.AggregationStrategy; | ||
import org.apache.camel.Exchange; | ||
|
||
public class PeriodAggrStrategy implements AggregationStrategy | ||
{ | ||
@Override | ||
public Exchange aggregate( Exchange oldExchange, Exchange newExchange ) | ||
{ | ||
oldExchange.getMessage().setHeader( "period", newExchange.getMessage().getBody() ); | ||
return oldExchange; | ||
} | ||
} |
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
src/main/java/org/hisp/dhis/integration/rapidpro/expression/FlowUuidsExpr.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,48 @@ | ||
package org.hisp.dhis.integration.rapidpro.expression; | ||
|
||
import org.apache.camel.Exchange; | ||
import org.apache.camel.Expression; | ||
import org.hisp.dhis.integration.rapidpro.ProgramStageToFlowMap; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class FlowUuidsExpr implements Expression | ||
{ | ||
@Autowired | ||
private ProgramStageToFlowMap programStageToFlowMap; | ||
|
||
@Value( "${rapidpro.flow.uuids:}" ) | ||
private String aggregateReportFlowUuids; | ||
|
||
@Override | ||
public <T> T evaluate( Exchange exchange, Class<T> type ) | ||
{ | ||
String programStageFlowUuids = programStageToFlowMap.getFlowUuids(); | ||
String flowUuids = (programStageFlowUuids.isEmpty() && aggregateReportFlowUuids.isEmpty()) ? | ||
"" : | ||
String.join( ",", programStageFlowUuids, aggregateReportFlowUuids ); | ||
return (T) flowUuids; | ||
} | ||
|
||
public ProgramStageToFlowMap getProgramStageToFlowMap() | ||
{ | ||
return programStageToFlowMap; | ||
} | ||
|
||
public void setProgramStageToFlowMap( ProgramStageToFlowMap programStageToFlowMap ) | ||
{ | ||
this.programStageToFlowMap = programStageToFlowMap; | ||
} | ||
|
||
public String getAggregateReportFlowUuids() | ||
{ | ||
return aggregateReportFlowUuids; | ||
} | ||
|
||
public void setAggregateReportFlowUuids( String aggregateReportFlowUuids ) | ||
{ | ||
this.aggregateReportFlowUuids = aggregateReportFlowUuids; | ||
} | ||
} |
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
62 changes: 0 additions & 62 deletions
62
src/main/java/org/hisp/dhis/integration/rapidpro/processor/EventStatusUpdateProcessor.java
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
...ain/java/org/hisp/dhis/integration/rapidpro/processor/FetchDueEventsQueryParamSetter.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.