public void main(IWContext iwc) throws Exception { _iwc = iwc; userID = iwc.getUserId(); if (userID > 0) { user = ((UserBusiness) IBOLookup.getServiceInstance(iwc, UserBusiness.class)).getUser(userID); } imageCircleD = getBundle(iwc).getImage("circleDown.gif"); imageCircleU = getBundle(iwc).getImage("circleUp.gif"); imageBgVert = getBundle(iwc).getImage("bgbeigeVert.gif"); imageBgVertOut = getBundle(iwc).getImage("bgbeigeVert1.gif"); // add(getOverviewForm(iwc)); if (user != null && user.getDateOfBirth() != null) age = new Age(user.getDateOfBirth()); else if (user != null && user.getPersonalID() != null) age = new Age(PIDChecker.getInstance().getDateFromPersonalID(user.getPersonalID())); add(getOverviewForm()); }
protected String getAttributeValue(IWContext iwc, User user, String alias, String type) { if (OpenIDConstants.ATTRIBUTE_ALIAS_EMAIL.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_EMAIL.equals(type)) { Email email = null; try { email = getUserBusiness(iwc).getUsersMainEmail(user); } catch (NoEmailFoundException e) { /*No action...*/ } catch (RemoteException e) { e.printStackTrace(); } return (email != null ? email.getEmailAddress() : ""); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_PERSONAL_ID.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_PERSONAL_ID.equals(type)) { return (user.getPersonalID() != null ? user.getPersonalID() : ""); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_FULL_NAME.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_FULL_NAME.equals(type)) { return user.getName(); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_DATE_OF_BIRTH.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_DATE_OF_BIRTH.equals(type)) { return (user.getDateOfBirth() != null ? new IWTimestamp(user.getDateOfBirth()).toSQLDateString() : ""); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_GENDER.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_GENDER.equals(type)) { return (user.getGender() != null ? (user.getGender().isMaleGender() ? "M" : "F") : ""); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_NICKNAME.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_FRIENDLY_NAME.equals(type)) { return LoginDBHandler.getUserLogin(user).getUserLogin(); } else if (OpenIDConstants.ATTRIBUTE_ALIAS_POSTCODE.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_POSTAL_CODE.equals(type)) { try { Address address = getUserBusiness(iwc).getUsersMainAddress(user); if (address != null) { PostalCode postal = address.getPostalCode(); return postal != null ? postal.getPostalCode() : ""; } } catch (RemoteException re) { re.printStackTrace(); } } else if (OpenIDConstants.ATTRIBUTE_ALIAS_COUNTRY.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_COUNTRY.equals(type)) { try { Address address = getUserBusiness(iwc).getUsersMainAddress(user); if (address != null) { return address.getCountry().getIsoAbbreviation(); } } catch (RemoteException re) { re.printStackTrace(); } } else if (OpenIDConstants.ATTRIBUTE_ALIAS_LANGUAGE.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_LANGUAGE.equals(type)) { if (user.getPreferredLocale() != null) { Locale locale = LocaleUtil.getLocale(user.getPreferredLocale()); return locale.getLanguage() + "-" + locale.getCountry(); } else { try { Address address = getUserBusiness(iwc).getUsersMainAddress(user); if (address != null) { Country country = address.getCountry(); return country.getIsoAbbreviation().toLowerCase() + "-" + country.getIsoAbbreviation(); } } catch (RemoteException re) { re.printStackTrace(); } } } else if (OpenIDConstants.ATTRIBUTE_ALIAS_TIMEZONE.equals(alias) || OpenIDConstants.ATTRIBUTE_TYPE_TIMEZONE.equals(type)) { try { Address address = getUserBusiness(iwc).getUsersMainAddress(user); if (address != null) { Country country = address.getCountry(); Locale locale = new Locale(country.getIsoAbbreviation().toLowerCase(), country.getIsoAbbreviation()); Calendar calendar = new GregorianCalendar(locale); return calendar.getTimeZone().getDisplayName(Locale.ENGLISH); } } catch (RemoteException re) { re.printStackTrace(); } } return ""; }