diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/IPredicate.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/IPredicate.java index 37f183293..317e87b29 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/IPredicate.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/IPredicate.java @@ -1,13 +1,35 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package org.navalplanner.web.orders; /** + * Classes implementing this interface check if object matches a given + * condition, usually comparing to some attributes in concrete class * * @author Diego Pino Garcia * */ public interface IPredicate { - boolean complays(Object object); + boolean accepts(Object object); boolean isEmpty(); } diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/LabelOrderElementPredicate.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/LabelOrderElementPredicate.java index 468870e27..dd89ab447 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/LabelOrderElementPredicate.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/LabelOrderElementPredicate.java @@ -1,9 +1,30 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package org.navalplanner.web.orders; import org.navalplanner.business.labels.entities.Label; import org.navalplanner.business.orders.entities.OrderElement; /** + * Checks if {@link Label} from {@link OrderElement} matches attribute label * * @author Diego Pino Garcia * @@ -17,7 +38,7 @@ public class LabelOrderElementPredicate implements IPredicate { } @Override - public boolean complays(Object object) { + public boolean accepts(Object object) { final OrderElement orderElement = (OrderElement) object; for (Label label : orderElement.getLabels()) { if (this.label != null && equalsLabel(label)) { diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/OrderModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/OrderModel.java index bda3af47e..da9086603 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/OrderModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/OrderModel.java @@ -272,7 +272,7 @@ public class OrderModel implements IOrderModel { reattachOrderElement(orderElement); reattachLabels(); initializeLabels(orderElement.getLabels()); - if (!predicate.complays(orderElement)) { + if (!predicate.accepts(orderElement)) { order.remove(orderElement); } }