Package org.osforce.connect.entity.stream

Examples of org.osforce.connect.entity.stream.Activity


 
  @SuppressWarnings("unchecked")
  public void execute(Environment env, Map params, TemplateModel[] loopVars,
      TemplateDirectiveBody body) throws TemplateException, IOException {
    BeanModel activityModel =  (BeanModel) params.get("activity");
    Activity activity = activityModel!=null ? (Activity) activityModel.getWrappedObject() : null;
    Assert.notNull(activity, "Render target activity can not be null!");
    if(Activity.FORMAT_FTL.equals(activity.getFormat())) {
      Object requestModel = env.getDataModel().get("Request");
      String base = ((HttpRequestHashModel) requestModel).getRequest().getContextPath();
      Template template = env.getConfiguration().getTemplate(activity.getDescription());
      Map<Object, Object> model = createModel(activity);
      model.put("base", base);
      String result = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
      env.getOut().write(result);
    } else if(Activity.FORMAT_TXT.equals(activity.getFormat())) {
      String imageBase = params.get("imageBase").toString();
      Assert.notNull(imageBase, "Parameter imageBase can not be null when format is txt...");
      String text = parseFace(imageBase, activity.getDescription());
      text = parseImage(text);
      text = parseLink(text);
      text = parseSpecialChar(text);
      env.getOut().write(text);
    } else if(Activity.FORMAT_HTML.equals(activity.getFormat())) {
      env.getOut().write(activity.getDescription());
    } else {
      env.getOut().write(activity.getDescription());
    }
  }
View Full Code Here


    if(activity.getProjectId()!=null) {
      Project project = projectDao.get(activity.getProjectId());
      activity.setProject(project);
    }
    if(activity.getParentId()!=null) {
      Activity parent = activityDao.get(activity.getParentId());
      activity.setParent(parent);
      //
      parent.setModified(now);
      activityDao.update(parent);
    }
    activity.setModified(now);
    if(activity.getId()==null) {
      activity.setEntered(now);
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long eventId = (Long) context.get("eventId");
    Event event = eventService.getEvent(eventId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(eventId);
    activity.setEntity(Event.NAME);
    activity.setType(Event.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(event.getProjectId());
    activity.setEnteredId(event.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long postId = (Long) context.get("postId");
    Post post = postService.getPost(postId);
    String templateName = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(postId);
    activity.setEntity(Post.NAME);
    activity.setType(Post.NAME);
    activity.setDescription(templateName);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(post.getProjectId());
    activity.setEnteredId(post.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long answerId = (Long) context.get("answerId");
    Answer answer = answerService.getAnswer(answerId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(answerId);
    activity.setEntity(Answer.NAME);
    activity.setType(Answer.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(answer.getQuestion().getProjectId());
    activity.setEnteredId(answer.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long topicId = (Long) context.get("topicId");
    Topic topic = topicService.getTopic(topicId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(topicId);
    activity.setEntity(Topic.NAME);
    activity.setType(Topic.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(topic.getForum().getProjectId());
    activity.setEnteredId(topic.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long replyId = (Long) context.get("replyId");
    Reply reply = replyService.getReply(replyId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(replyId);
    activity.setEntity(Reply.NAME);
    activity.setType(Reply.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(reply.getTopic().getForum().getProjectId());
    activity.setEnteredId(reply.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long questionId = (Long) context.get("questionId");
    Question question = questionService.getQuestion(questionId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(questionId);
    activity.setEntity(Question.NAME);
    activity.setType(Question.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(question.getProjectId());
    activity.setEnteredId(question.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long photoId = (Long) context.get("photoId");
    Photo photo = photoService.getPhoto(photoId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(photoId);
    activity.setEntity(Photo.NAME);
    activity.setType(Photo.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(photo.getAlbum().getProjectId());
    activity.setEnteredId(photo.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

  @Override
  protected void doTask(Map<Object, Object> context) throws Exception {
    Long forumId = (Long) context.get("forumId");
    Forum forum = forumService.getForum(forumId);
    String template = (String) context.get("template");
    Activity activity = new Activity();
    activity.setLinkedId(forumId);
    activity.setEntity(Forum.NAME);
    activity.setType(Forum.NAME);
    activity.setDescription(template);
    activity.setFormat(Activity.FORMAT_FTL);
    activity.setProjectId(forum.getProjectId());
    activity.setEnteredId(forum.getModifiedId());
    activityService.createActivity(activity);
  }
View Full Code Here

TOP

Related Classes of org.osforce.connect.entity.stream.Activity

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.