aggregator-core/src/main/java/org/arrowhead/wp5/agg/impl/Aggregator.java
public void executeFlexOffer(FlexOffer fo) throws FlexOfferException {		
		boolean hasSchedule = fo.getFlexOfferSchedule() != null;
		
		/* Fix numerical errors in the schedule */
		fo.getFlexOfferSchedule().fixNumericalErrors(fo);
		
		if (hasSchedule && !fo.getFlexOfferSchedule().isCorrect(fo)) {
			throw new FlexOfferException("Trying to execute an invalid flexoffer schedule!");
		};
		
		if (fo instanceof AggregatedFlexOffer) {
			try {
				Collection<FlexOffer> foc = this.agg.Disaggregate((AggregatedFlexOffer)fo);
				for(FlexOffer f : foc) {
					this.executeFlexOffer(f);
				}
			} catch (AggregationException e) {
				throw new FlexOfferException("Execution of flexoffer schedule failed due to the disaggregation error:"+e.getMessage());
			}
		} else {		
			fo.setState(hasSchedule ? FlexOfferState.Assigned : fo.getState());
			
			try {
				this.foLst.onFlexOfferScheduleUpdate(fo);
			} catch(Exception ex) {
					System.out.println("Error passing the schedule to a FOA: "+ex.getMessage());
			};
		}
	}
/* Notifies FOA about the new schedule*/
Notifies FOA about the new schedule
Notifies FOA about the new schedule
public void executeFlexOffer(FlexOffer fo) throws FlexOfferException {		
		boolean hasSchedule = fo.getFlexOfferSchedule() != null;
		/* Fix numerical errors in the schedule */
		fo.getFlexOfferSchedule().fixNumericalErrors(fo);
		if (hasSchedule && !fo.getFlexOfferSchedule().isCorrect(fo)) {
			throw new FlexOfferException("Trying to execute an invalid flexoffer schedule!");
		};
		if (fo instanceof AggregatedFlexOffer) {
			try {
				Collection<FlexOffer> foc = this.agg.Disaggregate((AggregatedFlexOffer)fo);
				for(FlexOffer f : foc) {
					this.executeFlexOffer(f);
				}
			} catch (AggregationException e) {
				throw new FlexOfferException("Execution of flexoffer schedule failed due to the disaggregation error:"+e.getMessage());
			}
		} else {		
			fo.setState(hasSchedule ? FlexOfferState.Assigned : fo.getState());
			try {
				this.foLst.onFlexOfferScheduleUpdate(fo);
			} catch(Exception ex) {
					System.out.println("Error passing the schedule to a FOA: "+ex.getMessage());
			};
		}
	}
public void executeFlexOffer ( FlexOffer fo ) throws FlexOfferException { boolean hasSchedule = fo . getFlexOfferSchedule ( ) != null ; /* Fix numerical errors in the schedule */ fo . getFlexOfferSchedule ( ) . fixNumericalErrors ( fo ) ; if ( hasSchedule && ! fo . getFlexOfferSchedule ( ) . isCorrect ( fo ) ) { throw new FlexOfferException ( "Trying to execute an invalid flexoffer schedule!" ) ; } ; if ( fo instanceof AggregatedFlexOffer ) { try { Collection < FlexOffer > foc = this . agg . Disaggregate ( ( AggregatedFlexOffer ) fo ) ; for ( FlexOffer f : foc ) { this . executeFlexOffer ( f ) ; } } catch ( AggregationException e ) { throw new FlexOfferException ( "Execution of flexoffer schedule failed due to the disaggregation error:" + e . getMessage ( ) ) ; } } else { fo . setState ( hasSchedule ? FlexOfferState . Assigned : fo . getState ( ) ) ; try { this . foLst . onFlexOfferScheduleUpdate ( fo ) ; } catch ( Exception ex ) { System . out . println ( "Error passing the schedule to a FOA: " + ex . getMessage ( ) ) ; } ; } }
Notifies FOA about the new schedule
Notifies FOA about the new schedule