Package com.google.gdata.data.appsforyourdomain.generic

Examples of com.google.gdata.data.appsforyourdomain.generic.GenericEntry


      throws IllegalArgumentException, ServiceException, MalformedURLException, IOException {
    if (users.size() == 0) {
      throw new IllegalArgumentException();
    }

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.LANGUAGE, language);

    for (String user : users) {
      logger.log(Level.INFO,
          "Updating language settings ( language: " + language + " ) for user " + user + " ...");
      updateSettings(user, entry, Constants.LANGUAGE);
View Full Code Here


      throws IllegalArgumentException, ServiceException, MalformedURLException, IOException {
    if (users.size() == 0) {
      throw new IllegalArgumentException();
    }

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.ENABLE, String.valueOf(enable));

    for (String user : users) {
      logger.log(Level.INFO,
          "Updating web clip settings ( enable: " + enable + " ) for user " + user + " ...");
      updateSettings(user, entry, "webclip");
View Full Code Here

      throws IllegalArgumentException, ServiceException, MalformedURLException, IOException {
    if (isBlankOrNullString(user) || isBlankOrNullString(delegationEmail)) {
      throw new IllegalArgumentException();
    }

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.ADDRESS, delegationEmail);

    logger.log(Level.INFO,
        "Adding " + delegationEmail + " as an email delegate for user " + user + " ...");
    insertSettings(user, entry, Constants.DELEGATION);
    logger.log(Level.INFO, "Successfully added an email delegate.");
View Full Code Here

   *     request</li>
   * </ul>
   */
  private void runSample() {

    GenericEntry entry = new GenericEntry();

    entry.addProperty("user", destinationUser);
    entry.addProperty("key", domain);
    entry.addProperty("from", from);
    entry.addProperty("to", to);
    entry.addProperty("subject", subject);
    entry.addProperty("hasTheWord", hasTheWord);
    entry.addProperty("doesNotHaveTheWord", doesNotHaveTheWord);
    entry.addProperty("hasAttachment", hasAttachment);
    entry.addProperty("shouldMarkAsRead", shouldMarkAsRead);
    entry.addProperty("shouldArchive", shouldArchive);
    entry.addProperty("label", label);
    entry.addProperty("forwardTo", forwardTo);
    entry.addProperty("neverSpam", neverSpam);
    entry.addProperty("shouldStar", shouldStar);
    entry.addProperty("shouldTrash", shouldTrash);

    LOGGER.log(Level.INFO, "Inserting 1 gmail filter.");

    GenericEntry[] entries = new GenericEntry[ITEMS_TO_BATCH];
    for (int i = 0; i < ITEMS_TO_BATCH; i ++) {
      GenericEntry newEntry = new GenericEntry();

      newEntry.addProperty("user", destinationUser);
      newEntry.addProperty("key", domain);
      newEntry.addProperty("from", from);
      newEntry.addProperty("to", to);
      newEntry.addProperty("subject", subject);
      newEntry.addProperty("hasTheWord", hasTheWord);
      newEntry.addProperty("doesNotHaveTheWord", doesNotHaveTheWord);
      newEntry.addProperty("hasAttachment", hasAttachment);
      newEntry.addProperty("shouldMarkAsRead", shouldMarkAsRead);
      newEntry.addProperty("shouldArchive", shouldArchive);

      // Apply different label to different filter
      newEntry.addProperty("label", String.valueOf(i));

      entries[i] = newEntry;
    }

    try {
      LOGGER.log(Level.INFO, "Inserting 1 Gmail filter.");
      GenericEntry resultEntry = insertGmailFilter(entry);
      LOGGER.log(Level.INFO, "Insert 1 filter succeeded.");

      LOGGER.log(Level.INFO, "Batch inserting " + ITEMS_TO_BATCH +
          " Gmail filters");
      GenericFeed resultFeed = batchInsertGmailFilters(entries);
View Full Code Here

   * @throws IOException If an error occurs communicating with the GData
   *         service.
   */
  public GenericEntry createAlias(String aliasEmail, String userEmail)
      throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    entry.addProperty("userEmail", userEmail);
    entry.addProperty("aliasEmail", aliasEmail);
    return service.insert(new URL("https://apps-apis.google.com/a/feeds/alias/2.0/" + domain),
        entry);
  }
View Full Code Here

   * @throws IOException If an error occurs communicating with the GData
   *         service.
   */
  public GenericEntry createUser(String email, String password, String firstName, String lastName)
      throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    entry.addProperty("userEmail", email);
    entry.addProperty("password", password);
    entry.addProperty("firstName", firstName);
    entry.addProperty("lastName", lastName);
    return service
        .insert(new URL("https://apps-apis.google.com/a/feeds/user/2.0/" + domain), entry);
  }
View Full Code Here

   *         service.
   */
  public GenericEntry createUser(String email, String password, String firstName, String lastName,
      Map<UserProperty, String> optionalAttributes) throws AppsForYourDomainException,
      MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    entry.addProperty("userEmail", email);
    entry.addProperty("password", password);
    entry.addProperty("firstName", firstName);
    entry.addProperty("lastName", lastName);
    for (Map.Entry<UserProperty, String> mapEntry : optionalAttributes.entrySet()) {
      String value = mapEntry.getValue();
      if (value == null || value.length() == 0) {
        continue;
      }
      switch (mapEntry.getKey()) {
        case HASH_FUNCTION:
          entry.addProperty("name", value);
          break;
        case ADMIN:
          entry.addProperty("isAdmin", value);
          break;
        case SUSPENDED:
          entry.addProperty("isSuspended", value);
          break;
        case CHANGE_PASSWORD_AT_NEXT_LOGIN:
          entry.addProperty("isChangePasswordAtNextLogin", value);
          break;
        case QUOTA:
          entry.addProperty("quotaInGb", value);
          break;
        case IP_WHITELIST:
          entry.addProperty("ipWhitelisted", value);
          break;
        default:
          break;
      }
    }
View Full Code Here

   * @throws IOException If an error occurs communicating with the GData
   *         service.
   */
  public GenericEntry updateUser(String email, Map<String, String> updatedAttributes)
      throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    entry.addProperties(updatedAttributes);
    return service.update(new URL("https://apps-apis.google.com/a/feeds/user/2.0/" + domain + "/"
        + email), entry);
  }
View Full Code Here

   * @throws IOException If an error occurs communicating with the GData
   *         service.
   */
  public GenericEntry updateEmailAddress(String oldEmailAddress, String newEmailAddress)
      throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    entry.addProperty("userEmail", oldEmailAddress);
    entry.addProperty("newEmail", newEmailAddress);
    return service.update(new URL("https://apps-apis.google.com/a/feeds/user/userEmail/2.0/"
        + domain + "/" + oldEmailAddress), entry);
  }
View Full Code Here

      ProvisioningApiMultiDomainSampleClient client =
          new ProvisioningApiMultiDomainSampleClient(adminEmail, adminPassword, primaryDomain,
              "multidomain-api-sample-" + primaryDomain);
      long time = System.currentTimeMillis();
      String userEmail = "test-" + time + "@" + secondaryDomain;
      GenericEntry entry = client.createUser(userEmail, "p@ssw0rd", "firstName", "lastName");
      LOGGER.log(Level.INFO, "Created user - " + entry.getProperty("userEmail"));
      entry = client.retrieveUser(userEmail);
      LOGGER.log(Level.INFO, "Retrieved user - " + entry.getProperty("userEmail"));
     
      // create user with optional attributes
      Map<UserProperty, String> optionalAttributes = new HashMap<UserProperty, String>();
      optionalAttributes.put(UserProperty.ADMIN, String.valueOf(true));
      optionalAttributes.put(UserProperty.SUSPENDED, String.valueOf(false));
      optionalAttributes.put(UserProperty.HASH_FUNCTION, "MD5");
      entry =
          client.createUser("test2-" + time + "@" + secondaryDomain,
              "0f359740bd1cda994f8b55330c86d845", "firstName", "lastName", optionalAttributes);
      LOGGER.log(Level.INFO, "Created user with optional attributes- "
          + entry.getProperty("userEmail"));
     
      Map<String, String> updatedAttributes = new HashMap<String, String>();
      updatedAttributes.put("lastName", "Smith");
      updatedAttributes.put("isSuspended", "true");
      entry = client.updateUser(userEmail, updatedAttributes);
      LOGGER.log(Level.INFO, "Updated user - " + entry.getProperty("lastName"));

      List<GenericEntry> users = client.retrieveAllUsers();
      LOGGER.log(Level.INFO, "Retrieved all users - " + users.size());

      // Alias operations
      String aliasEmail = "alias-" + time + "@" + secondaryDomain;
      entry = client.createAlias(aliasEmail, userEmail);
      LOGGER.log(Level.INFO, "Created alias - " + entry.getProperty("aliasEmail"));
      entry = client.retrieveAlias(aliasEmail);
      LOGGER.log(Level.INFO, "Retrieved alias - " + entry.getProperty("aliasEmail"));

      List<GenericEntry> aliases = client.retrieveAllAliases();
      LOGGER.log(Level.INFO, "Retrieved all aliases - " + users.size());

      // cleanup
View Full Code Here

TOP

Related Classes of com.google.gdata.data.appsforyourdomain.generic.GenericEntry

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.