Example #1
0
  @Override
  protected void initialize() throws ServiceException {
    lock.lock();
    try {
      super.initialize();

      getCachedItem(ID_FOLDER_CALENDAR).setColor(new Color((byte) 8));

      Folder.create(
          ID_FOLDER_NOTIFICATIONS,
          UUIDUtil.generateUUID(),
          this,
          getFolderById(ID_FOLDER_USER_ROOT),
          NOTIFICATIONS_PATH,
          Folder.FOLDER_IS_IMMUTABLE,
          MailItem.Type.UNKNOWN,
          0,
          MailItem.DEFAULT_COLOR_RGB,
          null,
          null,
          null);
    } finally {
      lock.release();
    }
  }
Example #2
0
  @Override
  void ensureSystemFolderExists() throws ServiceException {
    lock.lock();
    try {
      super.ensureSystemFolderExists();
      try {
        getFolderById(ID_FOLDER_NOTIFICATIONS);
      } catch (NoSuchItemException e) {
        Folder.FolderOptions fopt =
            new Folder.FolderOptions().setAttributes(Folder.FOLDER_IS_IMMUTABLE);

        CreateFolder redo =
            new CreateFolder(getId(), NOTIFICATIONS_PATH, ID_FOLDER_USER_ROOT, fopt);

        redo.setFolderIdAndUuid(ID_FOLDER_NOTIFICATIONS, UUIDUtil.generateUUID());
        redo.start(System.currentTimeMillis());
        createFolder(new TracelessContext(redo), NOTIFICATIONS_PATH, ID_FOLDER_USER_ROOT, fopt);
      }
      OfflineProvisioning prov = OfflineProvisioning.getOfflineInstance();
      for (String accountId : prov.getAllAccountIds()) {
        Account acct = prov.get(AccountBy.id, accountId);
        if (acct == null || prov.isGalAccount(acct) || prov.isMountpointAccount(acct)) continue;
        try {
          getFolderByName(null, ID_FOLDER_NOTIFICATIONS, accountId);
        } catch (NoSuchItemException e) {
          createMountpoint(
              null,
              ID_FOLDER_NOTIFICATIONS,
              accountId,
              accountId,
              ID_FOLDER_USER_ROOT,
              null,
              MailItem.Type.UNKNOWN,
              0,
              MailItem.DEFAULT_COLOR_RGB,
              false);
        }
      }
    } finally {
      lock.release();
    }
  }