You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2009/03/31 04:02:10 UTC

svn commit: r760289 - in /webservices/juddi/branches/v3_trunk/uddi-client/src/main/java/org/uddi/api_v3/client/i18n: ./ EntityForLang.java

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