Skip to content

Commit

Permalink
Merge pull request #5515 from angel-ramoscardona/BACKLOG-39390
Browse files Browse the repository at this point in the history
[BACKLOG-39390, BACKLOG-39800] Fixed missing scheduler xml's cron job…
  • Loading branch information
e-cuellar authored Feb 1, 2024
2 parents e2e37c8 + 92bdf26 commit a92d75f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public File performExport( RepositoryFile exportRepositoryFile ) throws ExportEx
zos.close();

// clean up
exportManifest = null;
initManifest();
zos = null;

return exportFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public ZipExportProcessor( String path, IUnifiedRepository repository, boolean w

this.exportHandlerList = new ArrayList<>();

initManifest();
}

protected void initManifest() {
this.exportManifest = new ExportManifest();

// set created by and create date in manifest information
Expand All @@ -96,7 +100,7 @@ public ZipExportProcessor( String path, IUnifiedRepository repository, boolean w

exportManifest.getManifestInformation().setExportBy( session.getName() );
exportManifest.getManifestInformation().setExportDate(
dateFormat.format( todaysDate ) + " " + timeFormat.format( todaysDate ) );
dateFormat.format( todaysDate ) + " " + timeFormat.format( todaysDate ) );
exportManifest.getManifestInformation().setManifestVersion( "2" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,24 @@ private static List<JobScheduleParam> fromSchedulerToBindingRequestJobParameters
}

private static SimpleJobTrigger fromSchedulerToBindingRequestJobTrigger( ISimpleJobTrigger incomingJobTrigger ) {
SimpleJobTrigger outgoingJobTrigger = new SimpleJobTrigger();
SimpleJobTrigger outgoingJobTrigger = null;
if ( incomingJobTrigger != null ) {
outgoingJobTrigger = new SimpleJobTrigger();
outgoingJobTrigger.setRepeatCount( incomingJobTrigger.getRepeatCount() );
outgoingJobTrigger.setRepeatInterval( incomingJobTrigger.getRepeatInterval() );
}
return outgoingJobTrigger;
}

private static CronJobTrigger fromSchedulerToBindingRequestCronJobTrigger( ICronJobTrigger incomingCronJobTrigger ) {
CronJobTrigger outgoingCronJobTrigger = new CronJobTrigger();
CronJobTrigger outgoingCronJobTrigger = null;
if ( incomingCronJobTrigger != null ) {
outgoingCronJobTrigger = new CronJobTrigger();
outgoingCronJobTrigger.setCronString( incomingCronJobTrigger.getCronString() );
outgoingCronJobTrigger.setDuration( incomingCronJobTrigger.getDuration() );
outgoingCronJobTrigger.setEndTime( XmlGregorianCalendarConverter.asXMLGregorianCalendar( incomingCronJobTrigger.getEndTime() ) );
outgoingCronJobTrigger.setStartTime( XmlGregorianCalendarConverter.asXMLGregorianCalendar( incomingCronJobTrigger.getStartTime() ) );
outgoingCronJobTrigger.setUiPassParam( incomingCronJobTrigger.getUiPassParam() );
}
return outgoingCronJobTrigger;
}
Expand Down Expand Up @@ -133,15 +139,27 @@ private static List<IJobScheduleParam> fromBindingToSchedulerRequestJobParameter
private static ISimpleJobTrigger fromBindingToSchedulerRequestJobTrigger(
SimpleJobTrigger incomingSimpleJobTrigger ) {
IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
return scheduler.createSimpleJobTrigger( new Date(), null, incomingSimpleJobTrigger.getRepeatCount(),
incomingSimpleJobTrigger.getRepeatInterval() );
ISimpleJobTrigger outgoingJobTrigger = null;
if ( incomingSimpleJobTrigger != null ) {
outgoingJobTrigger = scheduler.createSimpleJobTrigger(
new Date(),
null,
incomingSimpleJobTrigger.getRepeatCount(),
incomingSimpleJobTrigger.getRepeatInterval() );
}
return outgoingJobTrigger;
}

private static ICronJobTrigger fromBindingToSchedulerRequestCronJobTrigger( CronJobTrigger incomingCronJobTrigger ) {
IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
ICronJobTrigger outgoingCronJobTrigger = scheduler.createCronJobTrigger();
ICronJobTrigger outgoingCronJobTrigger = null;
if( incomingCronJobTrigger != null ) {
outgoingCronJobTrigger = scheduler.createCronJobTrigger();
outgoingCronJobTrigger.setCronString( incomingCronJobTrigger.getCronString() );
outgoingCronJobTrigger.setDuration( incomingCronJobTrigger.getDuration() );
outgoingCronJobTrigger.setEndTime( XmlGregorianCalendarConverter.asDate( incomingCronJobTrigger.getEndTime() ) );
outgoingCronJobTrigger.setStartTime( XmlGregorianCalendarConverter.asDate( incomingCronJobTrigger.getStartTime() ) );
outgoingCronJobTrigger.setUiPassParam( incomingCronJobTrigger.getUiPassParam() );
}
return outgoingCronJobTrigger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class JobScheduleRequest {

protected String actionClass;
protected ComplexJobTriggerProxy complexJobTrigger;
@XmlElement( namespace = "http://www.pentaho.com/schema/" )
@XmlElement
protected CronJobTrigger cronJobTrigger;
protected long duration;
protected String inputFile;
Expand All @@ -89,7 +89,7 @@ public class JobScheduleRequest {
@XmlElement( nillable = true )
protected List<JobScheduleParam> jobParameters;
protected String outputFile;
@XmlElement( namespace = "http://www.pentaho.com/schema/" )
@XmlElement
protected SimpleJobTrigger simpleJobTrigger;
protected String timeZone;
protected JobState jobState;
Expand Down

0 comments on commit a92d75f

Please sign in to comment.