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

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


  public static void runDomainVerificationService(String adminEmail, String password,
      String domainName) {
    try {
      DomainVerificationService client =
          new DomainVerificationService(adminEmail, password, domainName, "test");
      GenericEntry entry = client.retrieveCnameVerificationStatus();
      LOGGER.log(Level.INFO, "Retrieving CNAME verification status: " + entry.getAllProperties());

      entry = client.updateVerifiedStatus(entry, true);
      LOGGER.log(Level.INFO, "Updated CNAME verfication status: " + entry.getAllProperties());

      entry = client.retrieveMxVerificationStatus();
      LOGGER.log(Level.INFO, "Retrieving MX verification status: " + entry.getAllProperties());

      entry = client.updateVerifiedStatus(entry, true);
      LOGGER.log(Level.INFO, "Updating MX verfication status: " + entry.getAllProperties());

    } catch (AuthenticationException e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
    } catch (IllegalArgumentException e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
View Full Code Here


  public static void runEmailManagementService(
      String adminEmail, String password, String domainName) {
    try {
      EmailManagementService client =
          new EmailManagementService(adminEmail, password, domainName, "test");
      GenericEntry entry = client.retrieveOutboundGatewaySettings();
      LOGGER.log(Level.INFO, "Outbound gateway settings" + entry.getAllProperties());
      client.updateOutboundGatewaySettings(AdminSettingsConstants.TEST_EMAIL_ROUTE,
          AdminSettingsConstants.TEST_SMTPMODE);

      GenericFeed feed = client.retrieveEmailRoutingSettings();
      List<GenericEntry> entries = feed.getEntries();
View Full Code Here

   * @throws ServiceException
   */
  public GenericEntry updateOrganizationUser(String customerId, String orgUserEmail,
      String oldOrgUnitPath, String newOrgUnitPath) throws AppsForYourDomainException,
      MalformedURLException, IOException, ServiceException {
    GenericEntry entry = new GenericEntry();
    if (oldOrgUnitPath != null && oldOrgUnitPath.length() != 0) {
      entry.addProperty("oldOrgUnitPath", oldOrgUnitPath);
    }
    entry.addProperty("orgUnitPath", newOrgUnitPath);
    return service.update(new URL("https://apps-apis.google.com/a/feeds/orguser/2.0/" + customerId
        + "/" + orgUserEmail), entry);
  }
View Full Code Here

      OrgManagementSampleClient client =
          new OrgManagementSampleClient(adminEmail, adminPassword, domain, "org-api-sample-"
              + domain);

      GenericEntry entry = null;
      GenericFeed feed = null;

      entry = client.retrieveCustomerId(customerId);
      customerId = entry.getProperty("customerId");
      LOGGER.log(Level.INFO, "Retrieved Customer ID - " + customerId);

      entry =
          client.createOrganizationUnit(customerId, "system", "/", "System Organization", false);
      LOGGER.log(Level.INFO, "Created new OrgUnit - " + entry.getAllProperties());

      entry = client.retrieveOrganizationUnit(customerId, "system");
      LOGGER.log(Level.INFO, "Retrieved OrgUnit - " + entry.getAllProperties());

      List<GenericEntry> allUnits = client.retrieveAllOrganizationUnits(customerId);
      LOGGER.log(Level.INFO, "Retrieved all OrgUnits - " + allUnits.size());

      allUnits = client.retrieveChildOrganizationUnits(customerId, "/");
      LOGGER.log(Level.INFO, "Retrieved all child units  - " + allUnits.size());

      LOGGER.log(Level.INFO, "Updating OrgUnit 'system'");
      Map<OrgUnitProperty, String> attributes = new HashMap<OrgUnitProperty, String>();
      attributes.put(OrgUnitProperty.DESCRIPTION, "testchanged");
      entry = client.updateOrganizationUnit(customerId, "system", attributes);
      LOGGER.log(Level.INFO, "Updated OrgUnit description - " + entry.getAllProperties());

      client.retrieveOrganizaionUser(customerId, user);
      LOGGER.log(Level.INFO, "Retrieved OrgUser - " + entry.getAllProperties());

      entry = client.updateOrganizationUser(customerId, user, "/", "system");
      LOGGER.log(Level.INFO, "Updated OrgUser - " + entry.getAllProperties());

      // For pagination, use retrieveFirstPageOfOrganizationUsers() and
      // retrieveNextPage(feed.getNextLink())

      List<GenericEntry> allUsers = client.retrieveAllOrganizationUsers(customerId);
View Full Code Here

              + "TkQgUEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQ==";

      service = new AuditService(adminEmail, adminPassword, domain, "audit-test-" + domain);

      LOGGER.log(Level.INFO, "\n-------------uploadPublicKey-------------");
      GenericEntry sampleEntry = null;
      sampleEntry = service.uploadPublicKey(sampleKey);
      LOGGER.log(Level.INFO, "UploadedKey - " + sampleEntry.getAllProperties());

      // retrieve all MailboxDump requests with fromDate query.
      LOGGER.log(Level.INFO, "\n------retrieveAllMailboxDumpRequests with fromDate---- ");
      Calendar c = Calendar.getInstance();
      List<GenericEntry> entries = service.retrieveAllMailboxDumpRequests(c.getTime());
      for (GenericEntry sampleEntry2 : entries) {
        MailBoxDumpRequest request = new MailBoxDumpRequest(sampleEntry2);
        LOGGER.log(Level.INFO, "All requests -" + sampleEntry2.getAllProperties().toString());
      }

      /*
       * retrieve all MailboxDump requests without fromDate query. This will
       * retrieve all requests made in the last 3 weeks.
       */
      LOGGER.log(Level.INFO, "\n------------retrieveAllMailboxDumpRequests-------------");
      entries = service.retrieveAllMailboxDumpRequests(null);
      for (GenericEntry sampleEntry2 : entries) {
        MailBoxDumpRequest request = new MailBoxDumpRequest(sampleEntry2);
        LOGGER.log(Level.INFO, "All requests -" + sampleEntry2.getAllProperties().toString());
      }

      // Create MailboxDumpRequest
      MailBoxDumpRequest request = new MailBoxDumpRequest();
      request.setAdminEmailAddress(adminEmail);
      c.add(Calendar.MONTH, -1);
      request.setEndDate(c.getTime());
      c.add(Calendar.MONTH, -1);
      request.setBeginDate(c.getTime());

      request.setPackageContent("FULL_MESSAGE");
      request.setSearchQuery("in:chats");
      request.setIncludeDeleted(false);
      request.setUserEmailAddress(user + "@" + domain);

      LOGGER.log(Level.INFO, "\n-------------createMailboxDumpRequest-------------");
      sampleEntry = service.createMailboxDumpRequest(request);
      LOGGER.log(Level.INFO, "\nCreated request - " + sampleEntry.getAllProperties().toString());
      String createdId = sampleEntry.getProperty("requestId");

      LOGGER.log(Level.INFO, "\n-------------retrieveMailboxDumpRequest-------------");
      sampleEntry = service.retrieveMailboxDumpRequest(user, createdId);
      LOGGER.log(Level.INFO, "\nRetrieved dump request - "
          + sampleEntry.getAllProperties().toString());

      LOGGER.log(Level.INFO, "\n-------------deleteMailboxDumpRequest-------------");
      boolean isDeleted = service.deleteMailboxDumpRequest(user, createdId);
      LOGGER.log(Level.INFO, "Deleted mailbox dump request - " + isDeleted);

      MailMonitor monitor = new MailMonitor();
      c = Calendar.getInstance();
      c.add(Calendar.MONTH, 1);
      monitor.setBeginDate(c.getTime());
      c.add(Calendar.MONTH, 1);
      monitor.setEndDate(c.getTime());
      monitor.setDestUserName(destUser);
      monitor.setIncomingEmailMonitorLevel("FULL_MESSAGE");
      monitor.setOutgoingEmailMonitorLevel("HEADER_ONLY");
      monitor.setChatMonitorLevel("FULL_MESSAGE");
      monitor.setDraftMonitorLevel("FULL_MESSAGE");

      LOGGER.log(Level.INFO, "\n-------------createMailMonitor-------------");
      LOGGER.log(Level.INFO, "\nCreating mail monitor for the user: " + user);
      service.createMailMonitor(user, monitor);

      // Retrieve all monitors for the user
      LOGGER.log(Level.INFO, "\n-------------retrieveMonitors-------------");
      LOGGER.log(Level.INFO, "\nRetrieving monitors for the user: " + user);
      GenericFeed feed = service.retrieveMonitors(user);

      for (GenericEntry entry : feed.getEntries()) {
        monitor = new MailMonitor(entry);
        LOGGER.log(Level.INFO, "Request Id: " + monitor.getRequestId());
        LOGGER.log(Level.INFO, "Destination User: " + monitor.getDestUserName());
        LOGGER.log(Level.INFO, "Monitor Begin Date: " + monitor.getBeginDate());
        LOGGER.log(Level.INFO, "Monitor End Date: " + monitor.getEndDate());
        LOGGER.log(Level.INFO, "Outgoing Email Monitor Level: "
            + monitor.getOutgoingEmailMonitorLevel());
        LOGGER.log(Level.INFO, "Incoming Email Monitor Level: "
            + monitor.getIncomingEmailMonitorLevel());
        LOGGER.log(Level.INFO, "Draft Email Monitor Level: " + monitor.getDraftMonitorLevel());
        LOGGER.log(Level.INFO, "Chat Monitor Level: " + monitor.getChatMonitorLevel());
      }

      // Delete the monitor for the user
      LOGGER.log(Level.INFO, "\n-------------deleteMonitor-------------");
      LOGGER.log(Level.INFO, "Deleting monitor for the user...");
      service.deleteMonitor(user, destUser);

      //Account Info requests
     
      LOGGER.log(Level.INFO, "\n-------------createAccountInfoRequest-------------");
      sampleEntry = service.createAccountInfoRequest(user);
      LOGGER.log(Level.INFO, sampleEntry.getAllProperties().toString());
      AccountInfo info = new AccountInfo(sampleEntry);

      LOGGER.log(Level.INFO, "\n-------------retrieveAccountInfoRequest-------------");
      sampleEntry = service.retrieveAccountInfoRequest(user, info.getRequestId());
      info = new AccountInfo(sampleEntry);
View Full Code Here

    LOGGER.log(Level.INFO, "Creating users for groups sample run");
    createUser(memberUserName, memberFirstName, memberLastName, memberPassword);
    createUser(ownerUserName, ownerFirstName, ownerLastName, ownerPassword);

    GenericFeed groupsFeed = null;
    GenericEntry groupsEntry = null;
    Iterator<GenericEntry> groupsEntryIterator = null;

    LOGGER.log(Level.INFO, "Creating group: " + testGroupId);
    groupsEntry =
        groupService.createGroup(testGroupId, testGroupName,
            testGroupDescription, "");
    LOGGER.log(Level.INFO, "Group created with following properties:\n"
        + groupsEntry.getAllProperties());

    groupsEntry =
        groupService.addMemberToGroup(testGroupId, memberUserName);
    LOGGER.log(Level.INFO, "Added member: \n" + groupsEntry.getAllProperties());

    groupsEntry = groupService.addOwnerToGroup(testGroupId, ownerUserName);
    LOGGER.log(Level.INFO, "Added owner: \n" + groupsEntry.getAllProperties());

    groupsEntry =
        groupService.updateGroup(testGroupId, testGroupName,
            testGroupDescription + "Updated: ", "");
    LOGGER.log(Level.INFO, "Updated group description:\n"
        + groupsEntry.getAllProperties());

    groupsFeed = groupService.retrieveAllMembers(testGroupId);
    groupsEntryIterator = groupsFeed.getEntries().iterator();

    StringBuffer members = new StringBuffer();
View Full Code Here

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

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.FROM, from);
    entry.addProperty(Constants.TO, to);
    entry.addProperty(Constants.SUBJECT, subject);
    entry.addProperty(Constants.HAS_THE_WORD, hasTheWord);
    entry.addProperty(Constants.DOESNT_HAVE_THE_WORD, doesNotHaveTheWord);
    entry.addProperty(Constants.HAS_ATTACHMENT, String.valueOf(hasAttachment));
    entry.addProperty(Constants.SHOULD_MARK_AS_READ, String.valueOf(shouldMarkAsRead));
    entry.addProperty(Constants.SHOULD_ARCHIVE, String.valueOf(shouldArchive));
    entry.addProperty(Constants.LABEL, label);
    entry.addProperty(Constants.FORWARD_TO, forwardTo);
    entry.addProperty(Constants.NEVER_SPAM, String.valueOf(neverSpam));
    entry.addProperty(Constants.SHOULD_STAR, String.valueOf(shouldStar));
    entry.addProperty(Constants.SHOULD_TRASH, String.valueOf(shouldTrash));

    for (String user : users) {
      logger.log(Level.INFO,
          "Creating filter ( " + "from: " + from + ", to: " + to + ", subject: " + subject
              + ", hasTheWord: " + hasTheWord + ", doesNotHaveTheWord: " + doesNotHaveTheWord
View Full Code Here

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

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.NAME, name);
    entry.addProperty(Constants.ADDRESS, address);
    entry.addProperty(Constants.REPLY_TO, replyTo);
    entry.addProperty(Constants.MAKE_DEFAULT, String.valueOf(makeDefault));

    for (String user : users) {
      logger.log(Level.INFO,
          "Creating send-as alias ( " + "name: " + name + ", address: " + address + ", replyTo: "
              + replyTo + ", makeDefault: " + makeDefault + " ) for user " + user + " ...");
View Full Code Here

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

    GenericEntry entry = new GenericEntry();
    entry.addProperty(Constants.LABEL, label);

    for (String user : users) {
      logger.log(Level.INFO, "Creating label ( label: " + label + " ) for user " + user + " ...");
      insertSettings(user, entry, Constants.LABEL);
      logger.log(Level.INFO, "Successfully created label.");
View Full Code Here

      throw new IllegalArgumentException();
    }

    logger.log(Level.INFO, "Getting forwarding settings for user " + user + " ...");

    GenericEntry forwardingEntry = retrieveSettingsEntry(user, Constants.FORWARDING);
    if (forwardingEntry != null) {
      Map<String, String> forwarding = new HashMap<String, String>();
      forwarding.put(Constants.ENABLE, forwardingEntry.getProperty(Constants.ENABLE));
      forwarding.put(Constants.FORWARD_TO, forwardingEntry.getProperty(Constants.FORWARD_TO));
      forwarding.put(Constants.ACTION, forwardingEntry.getProperty(Constants.ACTION));
      return forwarding;
    }

    return null;
  }
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.