Skip to content

Commit

Permalink
Merge branch 'des-different-period-types' of github.com:dhis2/dhis2-c…
Browse files Browse the repository at this point in the history
…ore into des-different-period-types
  • Loading branch information
jason-p-pickering committed Dec 11, 2023
2 parents a4e6002 + 0894cd7 commit 201df01
Show file tree
Hide file tree
Showing 51 changed files with 1,742 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ queries:
- name: Extended Security
uses: security-extended
- name: Security and Quality
uses: security-and-quality
uses: security-and-quality
4 changes: 2 additions & 2 deletions .github/workflows/analyse-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
PR: ${{ github.event.number }}
if: github.event_name == 'pull_request'
run: |
mvn -f dhis-2/pom.xml clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests
mvn -f dhis-2/pom.xml clean install --threads 2C --batch-mode --update-snapshots --no-transfer-progress -DskipTests
mvn -f dhis-2/pom.xml sonar:sonar -Dsonar.internal.analysis.dbd=false --batch-mode --no-transfer-progress -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} -Dsonar.projectKey=dhis2_dhis2-core
- name: Analyse long-living branch
if: github.event_name != 'pull_request'
run: |
mvn -f dhis-2/pom.xml clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests
mvn -f dhis-2/pom.xml clean install --threads 2C --batch-mode --update-snapshots --no-transfer-progress -DskipTests
mvn -f dhis-2/pom.xml sonar:sonar -Dsonar.internal.analysis.dbd=false --batch-mode --no-transfer-progress -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.projectKey=dhis2_dhis2-core
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
config-file: ./.github/codeql/codeql-config.yml

- name: Build core
run: mvn clean install -f ./dhis-2/pom.xml --batch-mode --no-transfer-progress -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V
run: mvn clean install -f ./dhis-2/pom.xml --batch-mode --no-transfer-progress --update-snapshots -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V
- name: Build web
run: mvn clean install -f ./dhis-2/dhis-web/pom.xml --batch-mode --no-transfer-progress -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V
run: mvn clean install -f ./dhis-2/dhis-web/pom.xml --batch-mode --no-transfer-progress --update-snapshots -Pdev -DskipTests=true -Dmaven.javadoc.skip=true -V

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
6 changes: 3 additions & 3 deletions .github/workflows/run-api-analytics-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
# Remove Android and .NET libs (approx. 14GB)
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -41,8 +41,8 @@ jobs:

- name: Build core image
run: |
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f dhis-2/pom.xml -pl -dhis-web-embedded-jetty,-dhis-test-integration,-dhis-test-coverage
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f dhis-2/dhis-web/pom.xml
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true --update-snapshots -f dhis-2/pom.xml -pl -dhis-web-embedded-jetty,-dhis-test-integration,-dhis-test-coverage
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true --update-snapshots -f dhis-2/dhis-web/pom.xml
mvn --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f ./dhis-2/dhis-web/dhis-web-portal/pom.xml jib:dockerBuild -Djib.to.image=$CORE_IMAGE_NAME
- name: Get Sierra Leone DB from cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:

- name: Build war
run: |
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f dhis-2/pom.xml -pl -dhis-web-embedded-jetty,-dhis-test-integration,-dhis-test-coverage
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f dhis-2/dhis-web/pom.xml
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true --update-snapshots -f dhis-2/pom.xml -pl -dhis-web-embedded-jetty,-dhis-test-integration,-dhis-test-coverage
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true --update-snapshots -f dhis-2/dhis-web/pom.xml
- name: Build container image
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
distribution: temurin
cache: maven
- name: Run integration tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -Pintegration -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -Pintegration --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
timeout-minutes: 30
- uses: actions/upload-artifact@v3
name: Upload test logs on failure
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
distribution: temurin
cache: maven
- name: Run integration h2 tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -PintegrationH2 -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -PintegrationH2 --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-embedded-jetty
timeout-minutes: 30
- uses: actions/upload-artifact@v3
name: Upload test logs on failure
Expand Down Expand Up @@ -175,4 +175,3 @@ jobs:
SLACK_CHANNEL: 'team-backend'
SLACK_MESSAGE: "Latest test run on master failed and needs investigation :detective-duck:. \n Commit message: ${{ github.event.head_commit.message }}"
SLACK_COLOR: '#ff0000'

2 changes: 2 additions & 0 deletions dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/UID.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import static java.util.stream.Collectors.toUnmodifiableSet;

import com.fasterxml.jackson.annotation.JsonCreator;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -69,6 +70,7 @@ public String toString() {
return value;
}

@JsonCreator
public static UID of(@Nonnull String value) {
return new UID(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static <E extends RuntimeException, V> V on(

@Setter private ObjectReport objectReport;

@Setter private MergeReport mergeReport;

public ConflictException(String message) {
super(message);
this.code = ErrorCode.E1004;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ public enum ErrorCode {
E1522("User `{0}` is not allowed to move organisation `{1}` unit from parent `{2}`"),
E1523("User `{0}` is not allowed to move organisation `{1}` unit to parent `{2}`"),

/* Indicator Type merge */
E1530("At least one source indicator type must be specified"),
E1531("Target indicator type must be specified"),
E1532("Target indicator type cannot be a source indicator type"),
E1533("{0} indicator type does not exist: `{1}`"),

/* Data */
E2000("Query parameters cannot be null"),
E2001("At least one data element, data set or data element group must be specified"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2004-2023, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.feedback;

/**
* An ADT interface for a collection of {@link ErrorMessage}s.
*
* @author david mackessy
*/
public interface ErrorMessageContainer {

boolean hasErrorMessages();

void addErrorMessage(ErrorMessage errorMessage);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2004-2023, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.feedback;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import lombok.Data;
import org.hisp.dhis.merge.MergeType;

/**
* Class representing the state of a merge<br>
*
* <ul>
* <li>It can contain {@link ErrorMessage}s
* <li>It describes the type of merge
* <li>what sources have been deleted, if any
* </ul>
*
* @author david mackessy
*/
@Data
public class MergeReport implements ErrorMessageContainer {

@JsonProperty private final List<ErrorMessage> mergeErrors = new ArrayList<>();
@JsonProperty private MergeType mergeType;
@JsonProperty private Set<String> sourcesDeleted = new HashSet<>();
@JsonProperty private String message;

public MergeReport(MergeType mergeType) {
this.mergeType = mergeType;
}

@Override
public boolean hasErrorMessages() {
return !mergeErrors.isEmpty();
}

@Override
public void addErrorMessage(ErrorMessage errorMessage) {
mergeErrors.add(errorMessage);
}

public void addDeletedSource(String uid) {
sourcesDeleted.add(uid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public interface IndicatorService {

List<Indicator> getIndicatorsWithDataSets();

List<Indicator> getAssociatedIndicators(List<IndicatorType> indicatorTypes);

// -------------------------------------------------------------------------
// IndicatorType
// -------------------------------------------------------------------------
Expand All @@ -71,6 +73,8 @@ public interface IndicatorService {

List<IndicatorType> getAllIndicatorTypes();

List<IndicatorType> getIndicatorTypesByUid(List<String> uids);

// -------------------------------------------------------------------------
// IndicatorGroup
// -------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ public interface IndicatorStore extends IdentifiableObjectStore<Indicator> {
List<Indicator> getIndicatorsWithoutGroups();

List<Indicator> getIndicatorsWithDataSets();

List<Indicator> getAssociatedIndicators(List<IndicatorType> indicatorTypes);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.merge.orgunit;
package org.hisp.dhis.merge;

/**
* Enum for merge strategies.
Expand Down
51 changes: 51 additions & 0 deletions dhis-2/dhis-api/src/main/java/org/hisp/dhis/merge/MergeParams.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2004-2023, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hisp.dhis.merge;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Set;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hisp.dhis.common.UID;

/**
* Encapsulation of web API merge params. Contains source {@link UID}s to be merged and a target
* {@link UID} to be merged in to. Also indicates whether sources should be deleted or not. <br>
* All {@link UID}s should be verified.
*
* @author david mackessy
*/
@Data
@NoArgsConstructor
public class MergeParams {
@JsonProperty private Set<UID> sources;

@JsonProperty private UID target;

@JsonProperty private boolean deleteSources;
}
Loading

0 comments on commit 201df01

Please sign in to comment.