juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r760289 - in /webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n: ./ EntityForLang.java
Date Tue, 31 Mar 2009 02:02:10 GMT
Author: kstam
Date: Tue Mar 31 02:02:09 2009
New Revision: 760289

URL: http://svn.apache.org/viewvc?rev=760289&view=rev
Log:
JUDDI-201 adding language utility.

Added:
    webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/
    webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/EntityForLang.java

Added: webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/EntityForLang.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/EntityForLang.java?rev=760289&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/EntityForLang.java
(added)
+++ webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n/EntityForLang.java
Tue Mar 31 02:02:09 2009
@@ -0,0 +1,51 @@
+package org.uddi.api_v3.client.i18n;
+
+import java.util.List;
+
+import org.uddi.api_v3.Address;
+import org.uddi.api_v3.Name;
+
+public class EntityForLang {
+	/** 
+	 * Returns the name in the proper language. If no language is specified
+	 * or if no language is matched return the value of the first name in the list.
+	 * 
+	 * @param nameList - List of names
+	 * @param lang - requested name.
+	 *
+	 * @return - the value of the name in the language matched.
+	 * 
+	 */
+	public static Name get(List<Name> entityList, String lang) {
+		
+		if (lang==null) return entityList.get(0);
+		for (Name entity : entityList) {
+			if (lang.equalsIgnoreCase(entity.getLang())) {
+				return entity;
+			}
+		}
+		return entityList.get(0);
+	}
+	/** 
+	 * Returns the name in the proper language. If no language is specified
+	 * or if no language is matched return the value of the first name in the list.
+	 * 
+	 * @param nameList - List of names
+	 * @param lang - requested name.
+	 *
+	 * @return - the value of the name in the language matched.
+	 * 
+	 */
+	public static Address get(List<Address> entityList, String lang) {
+		
+		if (lang==null) return entityList.get(0);
+		for (Address entity : entityList) {
+			if (lang.equalsIgnoreCase(entity.getLang())) {
+				return entity;
+			}
+		}
+		return entityList.get(0);
+	}
+	
+	
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message