Skip to content

Commit

Permalink
chore: removed unused parameter and method overloads [DHIS2-15362]
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee committed Nov 7, 2023
1 parent 065f85a commit 0a186f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.hisp.dhis.common.IdSchemes;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.scheduling.JobConfiguration;

/**
* Import/export service for {@link CompleteDataSetRegistration data set completion registrations}.
Expand Down Expand Up @@ -109,17 +108,6 @@ void writeCompleteDataSetRegistrationsJson(
*/
ImportSummary saveCompleteDataSetRegistrationsXml(InputStream in, ImportOptions importOptions);

/**
* Imports {@link CompleteDataSetRegistrations} from an XML payload.
*
* @param in the stream providing the XML payload.
* @param importOptions the options for the import.
* @param jobId the task (optional).
* @return a summary of the import process.
*/
ImportSummary saveCompleteDataSetRegistrationsXml(
InputStream in, ImportOptions importOptions, JobConfiguration jobId);

/**
* Imports {@link CompleteDataSetRegistrations} from a JSON payload.
*
Expand All @@ -129,22 +117,10 @@ ImportSummary saveCompleteDataSetRegistrationsXml(
*/
ImportSummary saveCompleteDataSetRegistrationsJson(InputStream in, ImportOptions importOptions);

/**
* Imports {@link CompleteDataSetRegistrations} from a JSON payload.
*
* @param in the stream providing the XML payload.
* @param importOptions the options for the import.
* @param jobId the task (optional).
* @return a summary of the import process.
*/
ImportSummary saveCompleteDataSetRegistrationsJson(
InputStream in, ImportOptions importOptions, JobConfiguration jobId);

/**
* Validates the given {@link ExportParams}.
*
* @param params the export parameters.
* @throws IllegalQueryException if validation failed.
*/
void validate(ExportParams params);
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.scheduling.JobConfiguration;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.util.Clock;
import org.hisp.dhis.system.util.ValidationUtils;
Expand Down Expand Up @@ -225,15 +224,7 @@ public void writeCompleteDataSetRegistrationsJson(
@Transactional
public ImportSummary saveCompleteDataSetRegistrationsXml(
InputStream in, ImportOptions importOptions) {
return saveCompleteDataSetRegistrationsXml(in, importOptions, null);
}

@Override
@Transactional
public ImportSummary saveCompleteDataSetRegistrationsXml(
InputStream in, ImportOptions importOptions, JobConfiguration jobId) {
return saveCompleteDataSetRegistrations(
importOptions, jobId, () -> readRegistrationsFromXml(in));
return saveCompleteDataSetRegistrations(importOptions, () -> readRegistrationsFromXml(in));
}

@Nonnull
Expand All @@ -247,20 +238,11 @@ private static CompleteDataSetRegistrations readRegistrationsFromXml(InputStream
@Transactional
public ImportSummary saveCompleteDataSetRegistrationsJson(
InputStream in, ImportOptions importOptions) {
return saveCompleteDataSetRegistrationsJson(in, importOptions, null);
}

@Override
@Transactional
public ImportSummary saveCompleteDataSetRegistrationsJson(
InputStream in, ImportOptions importOptions, JobConfiguration jobId) {
return saveCompleteDataSetRegistrations(
importOptions, jobId, () -> readRegistrationsFromJson(in));
return saveCompleteDataSetRegistrations(importOptions, () -> readRegistrationsFromJson(in));
}

private ImportSummary saveCompleteDataSetRegistrations(
ImportOptions importOptions,
JobConfiguration jobId,
Callable<CompleteDataSetRegistrations> deserializeRegistrations) {
BatchHandler<CompleteDataSetRegistration> batchHandler =
batchHandlerFactory.createBatchHandler(CompleteDataSetRegistrationBatchHandler.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ public void execute(JobConfiguration jobConfig, JobProgress progress) {
ImportSummary summary =
switch (contentType) {
case "application/json" -> progress.runStage(
() ->
registrationService.saveCompleteDataSetRegistrationsJson(
input, options, jobConfig));
() -> registrationService.saveCompleteDataSetRegistrationsJson(input, options));
case "application/xml" -> progress.runStage(
() ->
registrationService.saveCompleteDataSetRegistrationsXml(
input, options, jobConfig));
() -> registrationService.saveCompleteDataSetRegistrationsXml(input, options));
default -> {
progress.failedStage("Unknown format: " + contentType);
yield null;
Expand Down

0 comments on commit 0a186f9

Please sign in to comment.