BaseAddress:

Hoffentlich alle benötigten Felder und Methoden vorhanden
Z.Z. kein Authoringkit. Da dieser Contenttyp nicht direkt verwendet werden soll, sondern als Basis für weitere Contenttypen dienen soll, wäre wohl ein AK  nötig, daß man von den anderen verwenden und erweitern kann. Ich weiß aber ncoh nicht, wie das geschehen soll.

git-svn-id: https://svn.libreccm.org/ccm/trunk@162 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2009-05-11 11:11:12 +00:00
parent 567ebbffef
commit 87b2b995fa
1 changed files with 56 additions and 23 deletions

View File

@ -19,6 +19,7 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.globalization.LocaleNegotiator;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.domain.DataObjectNotFoundException;
@ -26,6 +27,9 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Locale;
/**
* <p><code>DomainObject</code> class to represent address <code>ContentType</code>
@ -34,11 +38,10 @@ import java.math.BigDecimal;
* This content type represents a generic address which is not country specific.
* It provides methods for creating new address objects, retrieving existing
* objects from the persistent storage and retrieving and setting is properties.</p>
* <p>This class extends {@link com.arsdigita.cms.ContentPage content page} and
* <p>This class extends {@link com.arsdigita.cms.ContentItem content item} and
* adds extended attributes specific for an not country specific address:</p>
*
* @author <a href="mailto:dominik@redhat.com">Dominik Kacprzak</a>
* @version $Revision: #6 $ $Date: 2004/08/17 $
* @author Sören Bernstein
**/
public class BaseAddress extends ContentItem {
@ -171,4 +174,34 @@ public class BaseAddress extends ContentItem {
set(STATE, state);
}
// Convert the iso country code to country names using the current locale
public String getCountryNameFromIsoCode(String isoCountryCode) {
LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null);
java.util.Locale locale = new java.util.Locale("", isoCountryCode);
return locale.getDisplayCountry(negotiatedLocale.getLocale());
}
// Get a sorted list auf all countries
public ArrayList getSortedListOfCountries(Locale inLang) {
Locale[] locales = Locale.getAvailableLocales();
ArrayList <String> countryNames = new ArrayList<String>();
for(Locale locale : locales) {
if(locale.getDisplayCountry(inLang) != null) {
countryNames.add(locale.getDisplayCountry(inLang));
}
}
Collections.sort(countryNames);
return countryNames;
}
}