
fr.ird.observe.dto.report.ReportOperationConsumer Maven / Gradle / Ivy
package fr.ird.observe.dto.report;
/*-
* #%L
* ObServe Toolkit :: Dto
* %%
* Copyright (C) 2017 - 2021 Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import java.util.Set;
/**
* To consumer a {@link ReportOperation}.
*
* For each operation, create a such object and register it by {@link java.util.ServiceLoader} mechanism.
*
* Created on 21/09/2021.
*
* @author Tony Chemit - [email protected]
* @since 5.0.44
*/
public interface ReportOperationConsumer {
/**
* @return name of the operation, must be unique
*/
default String name() {
return getClass().getSimpleName();
}
DataMatrix consume(String parameters, ReportRequestExecutor requestExecutor, Report report, Set tripId, DataMatrix incoming);
default DataMatrix createTmpMatrix(int positionX, int positionY, int width, int height) {
DataMatrix result = new DataMatrix();
// calcul de la position des résultats de l'opération
DataMatrixPoint location = new DataMatrixPoint(positionX, positionY);
result.setLocation(location);
// calcul de la taille des résultats de l'opération
DataMatrixDimension dim = new DataMatrixDimension(width, height);
result.setDimension(dim);
// creation de la matrice
result.createData();
return result;
}
}