Examples of AdminConfig


Examples of com.dbxml.db.admin.AdminConfig

      Admin admin = Admin.getInstance();

      switch ( action ) {
         case ACTION_DETACH:
            try {
               AdminConfig cfg = admin.getAdminConfig();
               cfg.removeFileSystem(label);
               cfg.save();
               return REMOVE_SELF;
            }
            catch ( Exception e ) {
               admin.addMessage(e.getMessage());
            }
View Full Code Here

Examples of com.dbxml.db.admin.AdminConfig

            ico = ServerNCIcon;
            return REFRESH_SELF;

         case ACTION_DETACH:
            try {
               AdminConfig cfg = Admin.getInstance().getAdminConfig();
               cfg.removeDriverConfig(label);
               cfg.save();
               return REMOVE_SELF;
            }
            catch ( Exception e ) {
               Admin.getInstance().addMessage(e.getMessage());
            }
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

    String maxPhotoSizeMb = getParam("maxPhotoSizeMb");
    String photoSubmissionEnabled = getParam("photoSubmissionEnabled");
    String recaptchaPrivateKey = getParam("recaptchaPrivateKey");
    String recaptchaPublicKey = getParam("recaptchaPublicKey");

    AdminConfig adminConfig = adminConfigDao.getAdminConfig();

    // Use the name of the App Engine isntance for the client id.
    adminConfig.setClientId(Util.CLIENT_ID_PREFIX + SystemProperty.applicationId.get());

    if (developerKey != null) {
      adminConfig.setDeveloperKey(developerKey);
    }

    if (defaultTag != null) {
      adminConfig.setDefaultTag(defaultTag);
    }

    if (linkBackText != null) {
      adminConfig.setLinkBackText(linkBackText);
    }

    if (!util.isNullOrEmpty(moderationMode)) {
      adminConfig.setModerationMode(Integer.parseInt(moderationMode));
    }

    if (!util.isNullOrEmpty(brandingMode)) {
      adminConfig.setBrandingMode(Integer.parseInt(brandingMode));
    }

    if (!util.isNullOrEmpty(submissionMode)) {
      adminConfig.setSubmissionMode(Integer.parseInt(submissionMode));
    }

    if (newSubmissionAddress != null) {
      adminConfig.setNewSubmissionAddress(newSubmissionAddress);
    }

    if (loginInstruction != null) {
      adminConfig.setLoginInstruction(loginInstruction);
    }

    if (postSubmitMessage != null) {
      adminConfig.setPostSubmitMessage(postSubmitMessage);
    }

    if (moderationEmail != null) {
      adminConfig.setModerationEmail(moderationEmail.equalsIgnoreCase("true"));
    }

    if (fromAddress != null) {
      adminConfig.setFromAddress(fromAddress);
    }

    if (approvalEmailText != null) {
      adminConfig.setApprovalEmailText(approvalEmailText);
    }

    if (rejectionEmailText != null) {
      adminConfig.setRejectionEmailText(rejectionEmailText);
    }

    if (privateKeyBytes != null) {
      privateKeyBytes = privateKeyBytes.replace("-----BEGIN PRIVATE KEY-----", "");
      privateKeyBytes = privateKeyBytes.replace("-----END PRIVATE KEY-----", "");
      privateKeyBytes = privateKeyBytes.replace("\n", "");

      try {
        adminConfig.setPrivateKeyBytes(Base64.decode(privateKeyBytes));
      } catch (Base64DecoderException e) {
        LOG.log(Level.WARNING, "", e);
        adminConfig.setPrivateKeyBytes(new byte[0]);
      }
    }

    if (maxPhotoSizeMb != null) {
      adminConfig.setMaxPhotoSizeMb(Integer.parseInt(maxPhotoSizeMb));
    }

    if (photoSubmissionEnabled != null) {
      adminConfig.setPhotoSubmissionEnabled(photoSubmissionEnabled.equalsIgnoreCase("true"));
    }

    if (recaptchaPrivateKey != null) {
      adminConfig.setRecaptchaPrivateKey(recaptchaPrivateKey);
    }

    if (recaptchaPublicKey != null) {
      adminConfig.setRecaptchaPublicKey(recaptchaPublicKey);
    }

    adminConfig.setUpdated(new Date());
    adminConfig = adminConfigDao.save(adminConfig);

    return json;
  }
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

  }

  @Override
  @SuppressWarnings("unchecked")
  public AdminConfig getAdminConfig() {
    AdminConfig adminConfig = null;

    PersistenceManager pm = pmf.getPersistenceManager();

    try {
      Query query = pm.newQuery(AdminConfig.class);
      List<AdminConfig> adminConfigs = (List<AdminConfig>) query.execute();
      if (adminConfigs.size() > 0) {
        adminConfig = pm.detachCopy(adminConfigs.get(0));
      } else {
        LOG.info("No admin config found in datastore.  Creating a new one.");
        adminConfig = new AdminConfig();
        pm.makePersistent(adminConfig);
        adminConfig = pm.detachCopy(adminConfig);
      }
    } catch (JDOObjectNotFoundException e) {
      // this path can only occur when there is model class errors (model binary
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

  }

  @Override
  public boolean isUploadOnly() {
    boolean uploadOnly = false;
    AdminConfig adminConfig = getAdminConfig();
    if (adminConfig.getSubmissionMode() == AdminConfig.SubmissionModeType.NEW_ONLY.ordinal()) {
      uploadOnly = true;
    }
    return uploadOnly;
  }
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

        break;
    }
  }

  private void onApproved(VideoSubmission submission) {
    AdminConfig adminConfig = adminConfigDao.getAdminConfig();

    // Send notify email
    if (submission.getNotifyEmail() != null && adminConfig.isModerationEmail()) {
      emailUtil.sendUserModerationEmail(submission, ModerationStatus.APPROVED);
    }

  }
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

   
    return json;
  }

  private boolean onRejected(VideoSubmission submission) {
    AdminConfig adminConfig = adminConfigDao.getAdminConfig();
    boolean success = false;

    // Set the YouTubeApiHelper with the admin auth token
    String token = adminConfig.getYouTubeAuthSubToken();
    if (util.isNullOrEmpty(token)) {
      LOG.warning(String.format("No AuthSub token found in admin config."));
    } else {
      adminYouTubeApi.setAuthSubToken(token);
    }

    // TODO: Handle removing the branding if a video goes from APPROVED to
    // REJECTED.

    // Remove video to YouTube playlist if it is in one.
    if (submission.isInPlaylist()) {
      if (removeFromPlaylist(submission)) {
        success = true;
        submission.setIsInPlaylist(false);
        submission = submissionDao.save(submission);
      }
    }

    // Notify the submitter of rejection if there is a notify email
    if (adminConfig.isModerationEmail()
        && !util.isNullOrEmpty(submission.getNotifyEmail())) {
      emailUtil.sendUserModerationEmail(submission, ModerationStatus.REJECTED);
    }
   
    return success;
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

   
    return success;
  }

  private boolean onApproved(VideoSubmission submission) {
    AdminConfig adminConfig = adminConfigDao.getAdminConfig();
    boolean success = false;

    // Turn branding on if applicable
    if (adminConfig.getBrandingMode() == BrandingModeType.ON.ordinal()) {
      String linkBackText = adminConfig.getLinkBackText();
      if (!util.isNullOrEmpty(linkBackText) && !util.isNullOrEmpty(submission.getArticleUrl())) {
        String prependText = linkBackText.replace("ARTICLE_URL", submission
            .getArticleUrl());

        if (!submission.getVideoDescription().contains(prependText)) {
          // We only want to update the video if the text isn't already there.
          updateVideoDescription(submission, prependText, adminConfig
              .getDefaultTag());
        }
      }

      // Flip the moderation bit to approved for new upload
      if (submission.getVideoSource() == VideoSource.NEW_UPLOAD) {
        adminYouTubeApi.updateModeration(submission.getVideoId(), true);
      }
    }

    // Add video to YouTube playlist if it isn't in it already.
    if (!submission.isInPlaylist()) {
      if (addToPlaylist(submission)) {
        success = true;
        submission.setIsInPlaylist(true);
        submission = submissionDao.save(submission);
      }
    }

    // Notify the submitter of approval if there is a notify email
    if (adminConfig.isModerationEmail()
        && (submission.getNotifyEmail() != null)) {
      emailUtil.sendUserModerationEmail(submission, ModerationStatus.APPROVED);
    }
   
    return success;
View Full Code Here

Examples of com.google.ytd.model.AdminConfig

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

      AdminConfig adminConfig = adminConfigDao.getAdminConfig();
      adminConfig.setPicasaAuthSubToken(sessionToken);
      adminConfig.setPicasaUsername(picasaUsername);

      pm.makePersistent(adminConfig);

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

Examples of com.google.ytd.model.AdminConfig

 
          submission.setViewCount(viewCount);
          submission.setVideoSource(VideoSubmission.VideoSource.EXISTING_VIDEO);
          submission.setNotifyEmail(email);
 
          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);
           
            // Add video to YouTube playlist if it isn't in it already.
            // This code is kind of ugly and is mostly copy/pasted from UpdateVideoSubmissionStatus
            // TODO: It should be refactored into a common helper method somewhere...
            if (!submission.isInPlaylist()) {
              Assignment assignment = assignmentDao.getAssignmentById(assignmentId);
 
              if (assignment == null) {
                log.warning(String.format("Couldn't find assignment id '%d' for video id '%s'.",
                    assignmentId, videoId));
              } else {
                String playlistId = assignment.getPlaylistId();
                if (util.isNullOrEmpty(playlistId)) {
                  log.warning(String.format("Assignment id '%d' doesn't have an associated playlist.",
                      assignmentId));
                } else {
                  apiManager.setAuthSubToken(adminConfig.getYouTubeAuthSubToken());
                  if (apiManager.insertVideoIntoPlaylist(playlistId, videoId)) {
                    submission.setIsInPlaylist(true);
                  }
                }
              }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.