ItEr41S15CUImportacionRecursosProductivosItEr40S20: Naval Planner Business' StringUtils replaced by Apache Commons Lang's StringUtils.
Naval Planner Business' StringUtils replaced by Apache Commons Lang's StringUtils.
This commit is contained in:
parent
523aa46263
commit
bedc38de23
4 changed files with 8 additions and 56 deletions
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.business.common;
|
||||
|
||||
/**
|
||||
* String utility methods.
|
||||
*
|
||||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
private StringUtils() {}
|
||||
|
||||
/**
|
||||
* Checks if a string is <code>null</code> or empty ("" after being
|
||||
* trimmed).
|
||||
*/
|
||||
public static boolean isEmpty(String s) {
|
||||
return s == null ? true : s.trim().equals("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims a string if is not <code>null</code>; otherwise, it returns
|
||||
* <code>null</code>.
|
||||
*/
|
||||
public static String trim(String s) {
|
||||
return s == null ? null : s.trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,12 +25,12 @@ import static org.navalplanner.business.i18n.I18nHelper._;
|
|||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.common.StringUtils;
|
||||
import org.navalplanner.business.common.exceptions.CreateUnvalidatedException;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.resources.daos.ICriterionTypeDAO;
|
||||
|
|
@ -84,7 +84,7 @@ public class CriterionSatisfaction extends BaseEntity {
|
|||
Registry.getCriterionTypeDAO();
|
||||
|
||||
/* Get CriterionType. */
|
||||
if (StringUtils.isEmpty(criterionTypeName)) {
|
||||
if (StringUtils.isBlank(criterionTypeName)) {
|
||||
throw new CreateUnvalidatedException(
|
||||
_("criterion type name not specified"));
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ public class CriterionSatisfaction extends BaseEntity {
|
|||
}
|
||||
|
||||
/* Get Criterion. */
|
||||
if (StringUtils.isEmpty(criterionName)) {
|
||||
if (StringUtils.isBlank(criterionName)) {
|
||||
throw new CreateUnvalidatedException(
|
||||
_("criterion name not specified"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ package org.navalplanner.business.resources.entities;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.common.StringUtils;
|
||||
|
||||
/**
|
||||
* This class models a worker.
|
||||
|
|
@ -153,9 +153,9 @@ public class Worker extends Resource {
|
|||
|
||||
private boolean firstLevelValidationsPassed() {
|
||||
|
||||
return !StringUtils.isEmpty(firstName) &&
|
||||
!StringUtils.isEmpty(surname) &&
|
||||
!StringUtils.isEmpty(nif);
|
||||
return !StringUtils.isBlank(firstName) &&
|
||||
!StringUtils.isBlank(surname) &&
|
||||
!StringUtils.isBlank(nif);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.common.StringUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.navalplanner.business.common.exceptions.CreateUnvalidatedException;
|
||||
import org.navalplanner.business.resources.entities.CriterionSatisfaction;
|
||||
import org.navalplanner.business.resources.entities.Machine;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue