Package ch.entwine.weblounge.common.language

Examples of ch.entwine.weblounge.common.language.Language


   * @throws UnknownLanguageException
   *           if language was not found
   */
  protected Language getLanguage(String languageCode)
      throws UnknownLanguageException {
    Language language = languages.get(languageCode);
    if (language != null)
      return language;
    for (Locale locale : Locale.getAvailableLocales()) {
      if (locale.getISO3Language().equals(languageCode) || locale.getLanguage().equals(languageCode)) {
        language = new LanguageImpl(new Locale(locale.getLanguage(), "", ""));
View Full Code Here


   * @param resource
   *          the resource
   */
  private void removeContents(Resource<?> resource) {
    for (ResourceContent existingContent : resource.contents()) {
      Language language = existingContent.getLanguage();
      resource.removeContent(language);
      try {
        contentRepository.deleteContent(resource.getURI(), resource.getContent(language));
      } catch (IllegalStateException e) {
        logger.warn("Illegal state while deleting the resource {}: {}", resource.getURI(), e.getMessage());
View Full Code Here

    }
    user.initials = XPathHelper.valueOf(userNode, "profile/initials", xpath);
    user.email = XPathHelper.valueOf(userNode, "profile/email", xpath);
    String language = XPathHelper.valueOf(userNode, "profile/language", xpath);
    if (language != null) {
      Language l = LanguageUtils.getLanguage(language);
      user.language = (l != null) ? l : site.getDefaultLanguage();
    }

    // Password
    String password = XPathHelper.valueOf(userNode, "security/password", xpath);
View Full Code Here

    user.email = XPathHelper.valueOf(userNode, "ns:email", xpath);

    // Language
    String language = XPathHelper.valueOf(userNode, "ns:language", xpath);
    if (language != null) {
      Language l = LanguageUtils.getLanguage(language);
      user.language = (l != null) ? l : site.getDefaultLanguage();
    }

    // Password
    String password = XPathHelper.valueOf(userNode, "ns:password", xpath);
View Full Code Here

   * @return the content
   * @see #getLanguage()
   * @see #getLanguageResolution()
   */
  public T get() {
    Language language = getLanguage();
    if (language == null)
      return null;
    return get(getLanguage(), false);
  }
View Full Code Here

    if (language == null)
      throw new IllegalArgumentException("Language must not be null");

    T c = content.get(language);
    if (c == null && !force) {
      Language l = null;
      switch (behavior) {
        case Default:
          l = getDefaultLanguage();
          break;
        case Original:
View Full Code Here

   * @return the modification date in the current language
   * @see #switchTo(Language)
   * @see #switchTo(Language, boolean)
   */
  public Date getModificationDate() {
    Language currentLanguage = getLanguage();
    Date date = null;
    if (currentLanguage != null) {
      Modification c = modifications.get(currentLanguage);
      if (c != null)
        date = c.getDate();
View Full Code Here

   * @return the modifier in the current language
   * @see #switchTo(Language)
   * @see #switchTo(Language, boolean)
   */
  public User getModifier() {
    Language currentLanguage = getLanguage();
    User modifier = null;
    if (currentLanguage != null) {
      Modification c = modifications.get(currentLanguage);
      if (c != null)
        modifier = c.getUser();
View Full Code Here

   * @return <code>true</code> if the object was modified
   * @see #switchTo(Language)
   * @see #switchTo(Language, boolean)
   */
  public boolean isModified() {
    Language currentLanguage = getLanguage();
    Date d = null;
    if (currentLanguage != null) {
      Modification c = modifications.get(currentLanguage);
      if (c != null)
        d = c.getDate();
View Full Code Here

   *         <code>date</code>
   * @see #switchTo(Language)
   * @see #switchTo(Language, boolean)
   */
  public boolean isModifiedAfter(Date date) {
    Language currentLanguage = getLanguage();
    Date d = null;
    if (currentLanguage != null) {
      Modification c = modifications.get(currentLanguage);
      if (c != null)
        d = c.getDate();
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.language.Language

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.