1
|
package eu.dnetlib.enabling.is.sn.resourcestate;
|
2
|
|
3
|
import org.springframework.beans.factory.annotation.Required;
|
4
|
|
5
|
import eu.dnetlib.enabling.tools.OpaqueResource;
|
6
|
import eu.dnetlib.miscutils.coupling.ExternalCondition;
|
7
|
|
8
|
/**
|
9
|
* Ignores pending profiles from notification detection.
|
10
|
*
|
11
|
* @author marko
|
12
|
*
|
13
|
*/
|
14
|
public class ConditionalResourceStateNotificationDetectorFilter extends AbstractResourceStateNotificationDetectorFilter<OpaqueResource> {
|
15
|
|
16
|
/**
|
17
|
* external condition that drives this filter. We accept notification while the external condition is false.
|
18
|
*/
|
19
|
private ExternalCondition inhibitionCondition; // NOPMD
|
20
|
|
21
|
/**
|
22
|
* {@inheritDoc}
|
23
|
* @see eu.dnetlib.enabling.is.sn.resourcestate.AbstractResourceStateNotificationDetectorFilter#accept(java.lang.Object)
|
24
|
*/
|
25
|
@Override
|
26
|
boolean accept(final OpaqueResource resource) {
|
27
|
return !inhibitionCondition.isTrue();
|
28
|
}
|
29
|
|
30
|
public ExternalCondition getInhibitionCondition() {
|
31
|
return inhibitionCondition;
|
32
|
}
|
33
|
|
34
|
@Required
|
35
|
public void setInhibitionCondition(final ExternalCondition inhibitionCondition) { // NOPMD
|
36
|
this.inhibitionCondition = inhibitionCondition;
|
37
|
}
|
38
|
|
39
|
}
|