return ProtobufMessages.Trigger.newBuilder()
.setType( ProtobufMessages.Trigger.TriggerType.CRON )
.setCron( _cron.build() )
.build();
} else if ( trigger instanceof IntervalTrigger ) {
IntervalTrigger intTrigger = (IntervalTrigger) trigger;
ProtobufMessages.Trigger.IntervalTrigger.Builder _interval = ProtobufMessages.Trigger.IntervalTrigger.newBuilder()
.setStartTime( intTrigger.getStartTime().getTime() )
.setRepeatLimit( intTrigger.getRepeatLimit() )
.setRepeatCount( intTrigger.getRepeatCount() )
.setPeriod( intTrigger.getPeriod() );
if ( intTrigger.getEndTime() != null ) {
_interval.setEndTime( intTrigger.getEndTime().getTime() );
}
if ( intTrigger.getNextFireTime() != null ) {
_interval.setNextFireTime( intTrigger.getNextFireTime().getTime() );
}
if( intTrigger.getCalendarNames() != null ) {
for( String calendarName : intTrigger.getCalendarNames() ) {
_interval.addCalendarName( calendarName );
}
}
return ProtobufMessages.Trigger.newBuilder()
.setType( ProtobufMessages.Trigger.TriggerType.INTERVAL )