aggregator-manager/src/main/java/org/arrowhead/wp5/aggmanager/impl/resources/AnalyticsResource.java
@POST
	@Path("aggregate")
	@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	public AggregatedFlexOffer[] aggregate(AggregationInput input) {

		if (input == null) {
			logger.error("Empty aggregation input");
			return new AggregatedFlexOffer[] {};
		}

		Collection<FlexOffer> fc = input.getFlexOffers();
		FOAggParameters par = input.getParams();

		if (fc == null || fc.isEmpty()) {
			return new AggregatedFlexOffer[] {};
		}

		/* Setup default aggregation parameters */
		if (par == null) {
			par = this.agg.getAggParameters();
		}

		Collection<AggregatedFlexOffer> agg_fos;
		try {
			agg_fos = this.agg.getAggregator()
					.Aggregate(par, fc);
		} catch (AggregationException e) {
			logger.error("Aggregation error:", e.fillInStackTrace());
			return new AggregatedFlexOffer[] {}; 
		}

		return agg_fos.toArray(new AggregatedFlexOffer[] {});
	}
/* Aggregated a set of flex-offers */
Aggregated a set of flex-offers
Aggregated a set of flex - offers
@POST
	@Path("aggregate")
	@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	public AggregatedFlexOffer[] aggregate(AggregationInput input) {
		if (input == null) {
			logger.error("Empty aggregation input");
			return new AggregatedFlexOffer[] {};
		}
		Collection<FlexOffer> fc = input.getFlexOffers();
		FOAggParameters par = input.getParams();
		if (fc == null || fc.isEmpty()) {
			return new AggregatedFlexOffer[] {};
		}
		/* Setup default aggregation parameters */
		if (par == null) {
			par = this.agg.getAggParameters();
		}
		Collection<AggregatedFlexOffer> agg_fos;
		try {
			agg_fos = this.agg.getAggregator()
					.Aggregate(par, fc);
		} catch (AggregationException e) {
			logger.error("Aggregation error:", e.fillInStackTrace());
			return new AggregatedFlexOffer[] {}; 
		}
		return agg_fos.toArray(new AggregatedFlexOffer[] {});
	}
@ POST @ Path ( "aggregate" ) @ Consumes ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) @ Produces ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) public AggregatedFlexOffer [ ] aggregate ( AggregationInput input ) { if ( input == null ) { logger . error ( "Empty aggregation input" ) ; return new AggregatedFlexOffer [ ] { } ; } Collection < FlexOffer > fc = input . getFlexOffers ( ) ; FOAggParameters par = input . getParams ( ) ; if ( fc == null || fc . isEmpty ( ) ) { return new AggregatedFlexOffer [ ] { } ; } /* Setup default aggregation parameters */ if ( par == null ) { par = this . agg . getAggParameters ( ) ; } Collection < AggregatedFlexOffer > agg_fos ; try { agg_fos = this . agg . getAggregator ( ) . Aggregate ( par , fc ) ; } catch ( AggregationException e ) { logger . error ( "Aggregation error:" , e . fillInStackTrace ( ) ) ; return new AggregatedFlexOffer [ ] { } ; } return agg_fos . toArray ( new AggregatedFlexOffer [ ] { } ) ; }
Aggregated a set of flex-offers
Aggregated a set of flex - offers