Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Text


   */
  public void transformHalfVideoEntry(VideoEntry entry) {
    this.tubeId = (entry.getMediaGroup().getVideoId());
    if (entry.getMediaGroup().getThumbnails() != null
        && entry.getMediaGroup().getThumbnails().size() > 1) {
      this.thumbImageUrl = (new Text(entry.getMediaGroup()
          .getThumbnails().get(1).getUrl()));
    }
    this.title = (new Text(entry.getMediaGroup().getTitle()
        .getPlainTextContent()));

    if (entry.getMediaGroup().getDescription() != null) {
      this.description = (new Text(entry.getMediaGroup().getDescription()
          .getPlainTextContent()));
    }
    this.alias = (new Text(StringHelper.getAliasByLanguage(this.getTitle()
        .getValue())));

    this.authorUrl = (entry.getAuthors().get(0).getUri());
    if (entry.getStatistics() != null) {
      this.viewCount = entry.getStatistics().getViewCount();
    }
    if (entry.getMediaGroup().getDuration() != null) {
      Long duration = entry.getMediaGroup().getDuration();
      int hours = (int) (duration / 3600);
      int remainder = (int) (duration - hours * 3600);
      int minutes = remainder / 60;
      remainder = remainder - minutes * 60;
      int second = remainder;
      this.duration = (duration);
      this.totalTime = (new Text(((hours > 0) ? (hours + ":") : "")
          + ((minutes > 9) ? minutes : ("0" + minutes)) + ":"
          + ((second > 9) ? second : ("0" + second))));
    }
  }
View Full Code Here


      throws MalformedURLException, IOException, ServiceException {
    // core.
    this.tubeId = (videoEntry.getMediaGroup().getVideoId());
    if (videoEntry.getMediaGroup().getThumbnails() != null
        && videoEntry.getMediaGroup().getThumbnails().size() > 1) {
      this.thumbImageUrl = (new Text(videoEntry.getMediaGroup()
          .getThumbnails().get(1).getUrl()));
    }
    this.title = (new Text(videoEntry.getMediaGroup().getTitle()
        .getPlainTextContent()));
    if (videoEntry.getMediaGroup().getDescription() != null) {
      this.description = (new Text(videoEntry.getMediaGroup()
          .getDescription().getPlainTextContent()));
    }
    this.alias = (new Text(StringHelper.getAliasByLanguage(this.getTitle()
        .getValue())));

    this.authorUrl = (videoEntry.getAuthors().get(0).getUri());
    if (videoEntry.getStatistics() != null) {
      this.viewCount = videoEntry.getStatistics().getViewCount();
    }
    if (videoEntry.getMediaGroup().getDuration() != null) {
      Long duration = videoEntry.getMediaGroup().getDuration();
      int hours = (int) (duration / 3600);
      int remainder = (int) (duration - hours * 3600);
      int minutes = remainder / 60;
      remainder = remainder - minutes * 60;
      int second = remainder;
      this.duration = (duration);
      this.totalTime = (new Text(((hours > 0) ? (hours + ":") : "")
          + ((minutes > 9) ? minutes : ("0" + minutes)) + ":"
          + ((second > 9) ? second : ("0" + second))));
    }

    // advanced.

    this.published = (new Date(videoEntry.getPublished().getValue()));
    JavaCacheHandle.initCache();
    if (videoEntry.getMediaGroup().getKeywords() != null) {
      List<Text> listKey = new ArrayList<Text>();
      for (String keyword : videoEntry.getMediaGroup().getKeywords()
          .getKeywords()) {
        Tag tmpTag = null;
        listKey.add(new Text(keyword));
        String tagAlias = keyword;
        tmpTag = TagModel.getByAlias(tagAlias);
        List<Text> listTubeId = new ArrayList<Text>();
        if (tmpTag != null) {
          tmpTag.setCount(tmpTag.getCount() + 1);
          listTubeId.addAll(tmpTag.getListTubeId());
          listTubeId.add(new Text(this.tubeId));
          tmpTag.setListTubeId(listTubeId);
          TagModel.update(tmpTag);
          TagModel.closePM();
        } else {
          tmpTag = new Tag();
          listTubeId.add(new Text(this.tubeId));
          tmpTag.setListTubeId(listTubeId);
          tmpTag.setAlias(tagAlias);
          tmpTag.setCount(1);
          tmpTag.setTitle(new Text(tagAlias));
          TagModel.add(tmpTag);
        }
      }
      this.keywords = listKey;
      JavaCacheHandle.addKeywords(listKey);
View Full Code Here

    if (tmp != null) {
      this.alias = (tmp.text());
    }
    tmp = doc.select("thumbImageUrl");
    if (tmp != null) {
      this.thumbImageUrl = (new Text(tmp.text()));
    }
    tmp = doc.select("title");
    if (tmp != null) {
      this.title = (new Text(tmp.text()));
    }
  }
View Full Code Here

    // if (user != null) {
    String action = req.getParameter("action");
    if (action.equalsIgnoreCase("create")) {
      Category cate = new Category();
      if (req.getParameter("title") != null) {
        cate.setTitle(new Text(req.getParameter("title")));
      }
      if (req.getParameter("description") != null) {
        cate.setDescription(new Text(req.getParameter("description")));
      }
      Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(req);
      List<BlobKey> blobKeys = blobs.get("myFile");
      if (blobKeys != null && blobKeys.size() > 0) {
        cate.setThumbImageUrl(new Text("/image?key="
            + blobKeys.get(0).getKeyString()));
      }
      cate.setCount(0);
      cate.setStatus(1);
      cate.setAlias(StringHelper.getAliasByLanguage(cate.getTitle()
View Full Code Here

        throws TemplateException
    {
        Template template = this.peek(name);
        if (null != template){

            Text source = template.getTemplateSourceHapax();
            String target = template.toString();

            if (null != source && null != target && target.equals(source.getValue()))
                return true;
            else if (null == source)
                throw new TemplateException(String.format("Missing source for '%s'",name));
            else if (null == target)
                throw new TemplateException(String.format("Missing target for '%s'",name));
            else {
                String sourceString = source.getValue();
                if (null == sourceString)
                    throw new TemplateException(String.format("Missing source string for '%s'",name));
                else {
                    System.err.printf("Template Source '%s'%n",name);
                    System.err.println(sourceString);
View Full Code Here

            this.clear();

            final ArrayJson array = (ArrayJson)json;
            for (Json j: array){

                Text v = j.getValue(Text.class);

                if (null != v){

                    this.add(v);
View Full Code Here

    } else if (obj instanceof Date) {
      return DateFormat.getDateTimeInstance(DateFormat.FULL,
          DateFormat.FULL,Locale.US).format((Date) obj);// DateFormat.getInstance().format((Date)
      // obj);
    } else if (obj instanceof Text) {
      Text text = (Text) obj;
      return text.getValue();
    } else if (obj instanceof ShortBlob) {
      ShortBlob sbl = (ShortBlob) obj;
      return Base64.encodeBytes(sbl.getBytes());
    } else if (obj instanceof Blob) {
      Blob sbl = (Blob) obj;
View Full Code Here

              DateFormat.FULL, Locale.US).parse(args);
        } catch (ParseException exc) {
          return parseUsingAppropriateLocale(args);
        }
      } else if (obj == Text.class) {
        return new Text(args);
      } else if (obj == ShortBlob.class) {
        return new ShortBlob(Base64.decode(args));
      } else if (obj == Blob.class) {
        return new Blob(Base64.decode(args));
      } else if (obj == Link.class) {
View Full Code Here

  public Topic() {
  }

  public Topic(String title) {
    this.title = title;
    this.content = new Text("");
    htmlContent = "";
    this.date = new Date();
  }
View Full Code Here

  public Topic(String title, String content, WikiUser gaeUser) {
    this.title = title;
    // renderHtml(content);
    if (content == null) {
      this.content = new Text("");
    } else {
      this.content = new Text(content);
    }
    // setAuthor(gaeUser);
    this.date = new Date();
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Text

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.