Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into TECH-1580
Browse files Browse the repository at this point in the history
  • Loading branch information
enricocolasante committed Nov 27, 2023
2 parents 516dfc2 + 534dea4 commit 49a4e5d
Show file tree
Hide file tree
Showing 268 changed files with 4,215 additions and 1,963 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/deploy-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
INSTANCE_HOST: 'https://dev.im.dhis2.org'
INSTANCE_NAME: pr-${{ github.event.pull_request.number }}
steps:
- name: Dump context
uses: crazy-max/ghaction-dump-context@v2

- name: Wait for API tests
# Using this fork of the upstream https://github.com/lewagon/wait-on-check-action,
# as it will filter out and check only the latest run of a workflow when checking for the allowed conclusions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import java.util.List;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.program.notification.NotificationTrigger;

/** Created by [email protected] on 20.07.17. */
public interface DataSetNotificationTemplateService {
Expand All @@ -39,7 +38,7 @@ public interface DataSetNotificationTemplateService {

List<DataSetNotificationTemplate> getCompleteNotifications(DataSet dataSet);

List<DataSetNotificationTemplate> getScheduledNotifications(NotificationTrigger trigger);
List<DataSetNotificationTemplate> getScheduledNotifications(DataSetNotificationTrigger trigger);

List<DataSetNotificationTemplate> getAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@
import java.util.List;
import org.hisp.dhis.common.IdentifiableObjectStore;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.program.notification.NotificationTrigger;

/** Created by [email protected] on 13.07.17. */
public interface DataSetNotificationTemplateStore
extends IdentifiableObjectStore<DataSetNotificationTemplate> {
List<DataSetNotificationTemplate> getNotificationsByTriggerType(
DataSet dataSet, DataSetNotificationTrigger trigger);

List<DataSetNotificationTemplate> getScheduledNotifications(NotificationTrigger trigger);
List<DataSetNotificationTemplate> getScheduledNotifications(DataSetNotificationTrigger trigger);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
*/
package org.hisp.dhis.expression;

import static org.hisp.dhis.analytics.DataType.*;
import static org.hisp.dhis.analytics.DataType.BOOLEAN;
import static org.hisp.dhis.analytics.DataType.NUMERIC;

import org.hisp.dhis.analytics.DataType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public enum ErrorCode {
E2206("Max results exceeds the allowed max limit: `{0}`"),
E2207("Data start date must be before data end date"),
E2208("Non-numeric data values encountered during outlier value detection"),
E2209("Data start date not allowed"),
E2210("Data end date not allowed"),
E2211("Algorithm min-max values not allowed"),

/* Followup analysis */
E2300("At least one data element or data set must be specified"),
Expand Down Expand Up @@ -336,6 +339,8 @@ public enum ErrorCode {
/* File resource */
E6100("Filename not present"),
E6101("File type not allowed"),
E6102("File content could not be stored"),
E6103("File resource appears to have no content"),

/* Users */
E6200("Feedback message recipients user group not defined"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import java.net.URI;
import java.util.Map;
import java.util.NoSuchElementException;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* @author Halvdan Hoem Grelland
Expand Down Expand Up @@ -64,7 +66,8 @@ public interface FileResourceContentStore {
* @param bytes the byte array.
* @return the key on success or null if saving failed.
*/
String saveFileResourceContent(FileResource fileResource, byte[] bytes);
@CheckForNull
String saveFileResourceContent(@Nonnull FileResource fileResource, @Nonnull byte[] bytes);

/**
* Save the contents of the File to the file store.
Expand All @@ -73,7 +76,8 @@ public interface FileResourceContentStore {
* @param file the File. Will be consumed upon deletion.
* @return the key on success or null if saving failed.
*/
String saveFileResourceContent(FileResource fileResource, File file);
@CheckForNull
String saveFileResourceContent(@Nonnull FileResource fileResource, @Nonnull File file);

/**
* Save the content of image files.
Expand All @@ -82,8 +86,9 @@ public interface FileResourceContentStore {
* @param imageFile will map image dimension to its associated file.
* @return the key on success or null if saving failed.
*/
@CheckForNull
String saveFileResourceContent(
FileResource fileResource, Map<ImageFileDimension, File> imageFile);
@Nonnull FileResource fileResource, @Nonnull Map<ImageFileDimension, File> imageFile);

/**
* Delete the content bytes of a file resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.time.Duration;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
Expand Down Expand Up @@ -90,9 +89,31 @@ public interface FileResourceService {
*/
List<FileResourceOwner> findOwnersByStorageKey(@CheckForNull String storageKey);

void saveFileResource(FileResource fileResource, File file);
/**
* Creates the provided file resource and stores the file content asynchronously.
*
* @param fileResource the resource to create
* @param file the content stored asynchronously
*/
void asyncSaveFileResource(FileResource fileResource, File file);

/**
* Creates the provided file resource and stores the content asynchronously.
*
* @param fileResource the resource to create
* @param bytes the content stored asynchronously
* @return the UID of the created file resource
*/
String asyncSaveFileResource(FileResource fileResource, byte[] bytes);

String saveFileResource(FileResource fileResource, byte[] bytes);
/**
* Creates the provided file resource and stores the content synchronously.
*
* @param fileResource the resource to create
* @param bytes the content stored asynchronously
* @return the UID of the created file resource
*/
String syncSaveFileResource(FileResource fileResource, byte[] bytes) throws ConflictException;

void deleteFileResource(String uid);

Expand All @@ -101,10 +122,6 @@ public interface FileResourceService {
@Nonnull
InputStream getFileResourceContent(FileResource fileResource) throws ConflictException;

@Nonnull
InputStream getFileResourceContent(FileResource fileResource, Duration timeout)
throws ConflictException;

/** Copy fileResource content to outputStream and Return File content length */
void copyFileResourceContent(FileResource fileResource, OutputStream outputStream)
throws IOException, NoSuchElementException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,16 @@
*/
package org.hisp.dhis.fileresource.events;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
* @Author Zubair Asghar.
*/
@Getter
@RequiredArgsConstructor
public class BinaryFileSavedEvent {
private String fileResource;

private byte[] bytes;

public BinaryFileSavedEvent(String fileResource, byte[] bytes) {
this.fileResource = fileResource;
this.bytes = bytes;
}

public String getFileResource() {
return fileResource;
}

public byte[] getBytes() {
return bytes;
}
private final String fileResource;
private final byte[] bytes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,18 @@
*/
package org.hisp.dhis.fileresource.events;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.hisp.dhis.fileresource.FileResourceDomain;

/**
* @Author Zubair Asghar.
*/
@Getter
@RequiredArgsConstructor
public class FileDeletedEvent {
private String storageKey;

private String contentType;

private FileResourceDomain domain;

public FileDeletedEvent(String storageKey, String contentType, FileResourceDomain domain) {
this.storageKey = storageKey;
this.contentType = contentType;
this.domain = domain;
}

public String getStorageKey() {
return storageKey;
}

public String getContentType() {
return contentType;
}

public FileResourceDomain getDomain() {
return domain;
}
private final String storageKey;
private final String contentType;
private final FileResourceDomain domain;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,16 @@
package org.hisp.dhis.fileresource.events;

import java.io.File;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
* @Author Zubair Asghar.
*/
@Getter
@RequiredArgsConstructor
public class FileSavedEvent {
private String fileResource;

private File file;

public FileSavedEvent(String fileResource, File file) {
this.fileResource = fileResource;
this.file = file;
}

public String getFileResource() {
return fileResource;
}

public File getFile() {
return file;
}
private final String fileResource;
private final File file;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,17 @@

import java.io.File;
import java.util.Map;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.hisp.dhis.fileresource.ImageFileDimension;

/**
* @Author Zubair Asghar.
*/
@Getter
@RequiredArgsConstructor
public class ImageFileSavedEvent {
private String fileResource;

private Map<ImageFileDimension, File> imageFiles;

public ImageFileSavedEvent(String fileResource, Map<ImageFileDimension, File> imageFiles) {
this.fileResource = fileResource;
this.imageFiles = imageFiles;
}

public String getFileResource() {
return fileResource;
}

public Map<ImageFileDimension, File> getImageFiles() {
return imageFiles;
}
private final String fileResource;
private final Map<ImageFileDimension, File> imageFiles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,21 @@ public boolean isDescendant(Collection<OrganisationUnit> ancestors) {
return ancestors.stream()
.filter(Objects::nonNull)
.map(OrganisationUnit::getUid)
.anyMatch(uid -> StringUtils.contains(path, uid));
.anyMatch(uid -> StringUtils.contains(this.getPath(), uid));
}

/**
* Indicates whether this org unit is a descendant of the given ancestor org unit.
*
* @param ancestor the ancestor org unit.
* @return true if this org unit is a descendant of the ancestor.
*/
public boolean isDescendant(OrganisationUnit ancestor) {
if (ancestor == null) {
return false;
}

return StringUtils.contains(this.getPath(), ancestor.getUid());
}

public Set<OrganisationUnit> getChildrenThisIfEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import java.util.HashSet;
import java.util.Set;
import org.hisp.dhis.common.*;
import org.hisp.dhis.common.BaseDimensionalItemObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DimensionItemType;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.MetadataObject;
import org.hisp.dhis.common.coordinate.CoordinateObject;
import org.hisp.dhis.common.coordinate.CoordinateUtils;
import org.locationtech.jts.geom.Geometry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,6 @@ List<OrganisationUnit> getOrganisationUnitByCoordinate(
*/
boolean isInUserHierarchy(String uid, Set<OrganisationUnit> organisationUnits);

boolean isDescendant(OrganisationUnit organisationUnit, Set<OrganisationUnit> ancestors);

boolean isDescendant(OrganisationUnit organisationUnit, OrganisationUnit ancestor);

/**
* Indicates whether the given organisation unit is part of the hierarchy of the data view
* organisation units of the current user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import java.io.Serializable;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
import org.hisp.dhis.programrule.ProgramRule;
import org.hisp.dhis.programrule.ProgramRuleVariable;
import org.hisp.dhis.rules.DataItem;
import org.hisp.dhis.rules.models.*;
import org.hisp.dhis.rules.models.Rule;
import org.hisp.dhis.rules.models.RuleEnrollment;
import org.hisp.dhis.rules.models.RuleEvent;
import org.hisp.dhis.rules.models.RuleVariable;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;

/**
Expand Down
Loading

0 comments on commit 49a4e5d

Please sign in to comment.