@Override
public ApplicationAdvice appliesTo(final IModel<?> model) {
if(!(model instanceof EntityCollectionModel)) {
return ApplicationAdvice.DOES_NOT_APPLY;
}
final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
// TOFIX: because of Javascript issues, currently only works for standalone views.
if(!entityCollectionModel.isStandalone()) {
return ApplicationAdvice.DOES_NOT_APPLY;
}
final ObjectSpecification elementSpec = entityCollectionModel.getTypeOfSpecification();
List<ObjectAssociation> associations = elementSpec.getAssociations(OF_TYPE_DATE);
return appliesIf(!associations.isEmpty());
}