accounting-lib/src/main/java/org/gcube/accounting/datamodel/deprecationmanagement/DeprecatedWarningAction.java

33 lines
1001 B
Java

/**
*
*/
package org.gcube.accounting.datamodel.deprecationmanagement;
import java.io.Serializable;
import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.decorators.FieldAction;
import org.gcube.documentstore.exception.InvalidValueException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class DeprecatedWarningAction implements FieldAction {
private static Logger logger = LoggerFactory.getLogger(DeprecatedWarningAction.class);
/**
* {@inheritDoc}
*/
@Override
public Comparable<? extends Serializable> validate(String key, Comparable<? extends Serializable> value, UsageRecord usageRecord) throws InvalidValueException {
logger.trace("The field {} is deprecated for {}. Anyway the field will be included in the SingleUsageRecord. The field can be lost during aggregation.",
key, usageRecord.getClass().getSimpleName());
return value;
}
}