Project

General

Profile

Download (882 Bytes) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.remote.service;
10

    
11
import org.springframework.stereotype.Component;
12

    
13

    
14
public class Utils {
15
	
16
	/**
17
	 * Interprets a string as boolean value with true/TRUE/True or any integer greater 0 being true
18
	 * @param boolString
19
	 * @return
20
	 */
21
	public static Boolean isTrue(String boolString){
22
		// empty string returns null
23
		if (boolString==null || boolString.trim().length()==0){
24
			return null;
25
		}
26
		boolean result = Boolean.parseBoolean(boolString);
27
		try{
28
			if (!result && Integer.valueOf(boolString)>0){
29
				result = true;
30
			}
31
		}catch(Exception e){
32
			result = false;
33
		}
34
		return result;
35
	}
36
}
(6-6/6)