Package ch.entwine.weblounge.common.language

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


    }

    // locale
    else if ("locale".equals(raw)) {
      String language = attrs.getValue("language");
      Language l = LanguageUtils.getLanguage(language);
      if (l == null)
        throw new IllegalStateException("Found content without language");
      if ("true".equals(attrs.getValue("original")))
        pagelet.setOriginalLanguage(l);
      pagelet.modificationCtx.switchTo(l);
View Full Code Here


    }

    // text
    else if ("text".equals(raw)) {
      String id = (String) clipboard.get("text.id");
      Language l = (Language) clipboard.get("language");
      pagelet.setContent(id, getCharacters(), l);
      if (logger.isTraceEnabled())
        logger.trace("Adding " + l.toString().toLowerCase() + " text '" + getCharacters() + "'");
    }

    // property
    else if ("property".equals(raw)) {
      String id = (String) clipboard.get("property.id");
View Full Code Here

   *      java.util.Date)
   */
  protected void setModified(User user, Date date) {
    if (pagelet == null)
      return;
    Language language = (Language) clipboard.get("language");
    pagelet.setModified(user, date, language);
  }
View Full Code Here

      // title, subject and the like
      if ("title".equals(raw) || "subject".equals(raw) || "description".equals(raw) || "coverage".equals(raw) || "rights".equals(raw)) {
        String language = attrs.getValue("language");
        if (language != null) {
          Language l = LanguageUtils.getLanguage(language);
          clipboard.put("language", l);
        } else {
          clipboard.remove("language");
        }
      }
View Full Code Here

        page.setType(getCharacters());
      }

      // Title
      else if ("title".equals(raw)) {
        Language l = (Language) clipboard.get("language");
        page.setTitle(getCharacters(), l);
      }

      // Description
      else if ("description".equals(raw)) {
        Language l = (Language) clipboard.get("language");
        page.setDescription(getCharacters(), l);
      }

      // Coverage
      else if ("coverage".equals(raw)) {
        Language l = (Language) clipboard.get("language");
        page.setCoverage(getCharacters(), l);
      }

      // Rights
      else if ("rights".equals(raw)) {
        Language l = (Language) clipboard.get("language");
        page.setRights(getCharacters(), l);
      }

      // Subject
      else if ("subject".equals(raw)) {
View Full Code Here

   * @return the language name
   */
  protected String getLanguage(WebloungeRequest request) {
    String language = RequestUtils.getParameter(request, LANGUAGE_PARAM);
    if (language == null) {
      Language en = LanguageUtils.getLanguage("en");
      language = request.getLanguage().getDescription(en).toLowerCase();
      if (language == null) {
        language = "english";
      }
    }
View Full Code Here

      addField(HEADER_XML, headerXml, false, false);
    }

    // Resource contents
    for (ResourceContent content : resource.contents()) {
      Language l = content.getLanguage();
      addField(getLocalizedFieldName(CONTENT_XML, l), content.toXml(), false, false);
      addField(getLocalizedFieldName(CONTENT_CREATED, l), IndexUtils.serializeDate(content.getCreationDate()), false, false);
      addField(getLocalizedFieldName(CONTENT_CREATED_BY, l), IndexUtils.serializeUserId(content.getCreator()), false, false);
      addField(CONTENT_SOURCE, content.getSource(), true, false);
      addField(CONTENT_EXTERNAL_REPRESENTATION, content.getExternalLocation(), true, false);
View Full Code Here

    final Resource<?> resource = loadResource(request, resourceId, null, version);
    if (resource == null)
      throw new WebApplicationException(Status.NOT_FOUND);

    // Extract the language
    Language language = null;
    try {
      language = LanguageUtils.getLanguage(languageId);
      if (!resource.supportsLanguage(language)) {
        if (!resource.contents().isEmpty())
          language = resource.getOriginalContent().getLanguage();
View Full Code Here

    // Check the parameters
    if (resourceId == null)
      throw new WebApplicationException(Status.BAD_REQUEST);

    // Extract the language
    Language language;
    try {
      language = LanguageUtils.getLanguage(languageId);
    } catch (UnknownLanguageException e) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }
View Full Code Here

    // Check the parameters
    if (resourceId == null)
      throw new WebApplicationException(Status.BAD_REQUEST);

    // Extract the language
    Language language = LanguageUtils.getLanguage(languageId);
    if (language == null) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }

    // Get the resource
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.