Package com.google.ytd.model

Examples of com.google.ytd.model.AdminConfig


    }
  }

  private void sendNewSubmissionEmail(String subject, String body) {
    try {
      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      String addressCommaSeparated = adminConfig.getNewSubmissionAddress();
      if (util.isNullOrEmpty(addressCommaSeparated)) {
        throw new IllegalArgumentException(
            "No notification email addresses found in configuration.");
      }
      String[] addresses = addressCommaSeparated.split("\\s*,\\s*");
 
View Full Code Here


    sendNewSubmissionEmail(subject, body);
  }

  private void sendUserModerationEmail(String toAddress, String subject, String body) {
    try {
      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      MailService mailService = MailServiceFactory.getMailService();
      Message message = new Message();

      String fromAddress = adminConfig.getFromAddress();
      if (util.isNullOrEmpty(fromAddress)) {
        throw new IllegalArgumentException("No from address found in configuration.");
      }

      message.setSender(fromAddress);
View Full Code Here

    }
  }

  public void sendUserModerationEmail(VideoSubmission entry, ModerationStatus status) {
    try {
      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      String body;
      switch (status) {
        case APPROVED:
          body = adminConfig.getApprovalEmailText();
          break;

        case REJECTED:
          body = adminConfig.getRejectionEmailText();
          break;

        default:
          throw new IllegalArgumentException(String.format("ModerationStatus %s is not valid.",
              status.toString()));
View Full Code Here

  }

  public void sendUserModerationEmail(PhotoSubmission photoSubmission, PhotoEntry photoEntry,
      com.google.ytd.model.PhotoEntry.ModerationStatus status) {
    try {
      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      String body;
      switch (status) {
        case APPROVED:
          body = adminConfig.getApprovalEmailText();
          break;

        case REJECTED:
          body = adminConfig.getRejectionEmailText();
          break;

        case UNREVIEWED:
          // Let's not send any email when a photo is marked as UNREVIEWED.
          // This differs from the video moderation behavior, but it's arguably
View Full Code Here

        // TODO: Throw a better Exception class here.
        throw new IllegalArgumentException("Unable to retrieve a YouTube username for "
            + "the authenticated user.");
      }

      AdminConfig adminConfig = adminConfigDao.getAdminConfig();
      adminConfig.setYouTubeAuthSubToken(sessionToken);
      adminConfig.setYouTubeUsername(youTubeName);

      pm.makePersistent(adminConfig);

      resp.sendRedirect(util.addNamespaceParamIfNeeded("/admin#configuration"));
    } catch (IllegalArgumentException e) {
View Full Code Here

        submission.setVideoSource(VideoSubmission.VideoSource.MOBILE_SUBMIT);
        submission.setNotifyEmail(email);

        userAuthTokenDao.setUserAuthToken(youTubeName, authSubToken);

        AdminConfig adminConfig = adminConfigDao.getAdminConfig();
        if (adminConfig.getModerationMode() == AdminConfig.ModerationModeType.NO_MOD.ordinal()) {
          // NO_MOD is set, auto approve all submission
          // TODO: This isn't enough, as the normal approval flow (adding the
          // branding, tags, emails,
          // etc.) isn't taking place.
          submission.setStatus(VideoSubmission.ModerationStatus.APPROVED);
View Full Code Here

    this.adminConfigDao = adminConfigDao;
  }

  @Override
  public JSONObject execute() throws JSONException {
    AdminConfig adminConfig = adminConfigDao.getAdminConfig();
    if (adminConfig == null) {
      throw new IllegalStateException("No admin config can be found.");
    }
    JSONObject json = new JSONObject();
    json.put("result", new JSONObject(util.toJson(adminConfig)));
View Full Code Here

      submission.setNotifyEmail(email);
      submission.setPhoneNumber(phoneNumber);

      userAuthTokenDao.setUserAuthToken(youTubeName, authSubToken);

      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      youTubeApiHelper.setAuthSubToken(adminConfig.getYouTubeAuthSubToken());

      if (adminConfig.getModerationMode() == AdminConfig.ModerationModeType.NO_MOD.ordinal()) {
        // NO_MOD is set, auto approve all submission
        // TODO: This isn't enough, as the normal approval flow (adding the branding, tags, emails,
        // etc.) isn't taking place.
        submission.setStatus(VideoSubmission.ModerationStatus.APPROVED);
        youTubeApiHelper.updateModeration(videoId, true);
View Full Code Here

      // This will retrieve video info from the Uploads feed of the user who owns the video.
      // This should always be the freshest data, but it relies on the AuthSub token being valid.
      VideoEntry videoEntry = apiManager.getUploadsVideoEntry(videoId);
      if (videoEntry == null) {
        // Try an unauthenticated request to the specific user's uploads feed next.
        AdminConfig admin = adminConfigDao.getAdminConfig();
        String clientId = admin.getClientId();
        YouTubeApiHelper apiHelper = new YouTubeApiHelper(clientId);
        videoEntry = apiHelper.getUploadsVideoEntry(videoSubmission.getYouTubeName(), videoId);

        if (videoEntry == null) {
          // Fall back on looking for the video in the public feed.
View Full Code Here

TOP

Related Classes of com.google.ytd.model.AdminConfig

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.