Package com.google.enterprise.connector.notes.client

Examples of com.google.enterprise.connector.notes.client.NotesView


          }

          //Otherwise our checkpoint should be the UNID of the
          //current document in the doclist
          checkPointUnid = ncdoc.getUNID();
          NotesView docidvw = db.getView(NCCONST.VIEWINDEXED);

          // We need to iterate through the doclist and clean up
          // the pre-fetched documents and file system objects
          String indexedDocUnid = "";
          for (Iterator<String> ci = unidList.iterator(); ci.hasNext();) {
View Full Code Here


      if (null != formDoc) {
        formDoc.recycle();
      }
      formDoc = null;
    }
    NotesView vw = cdb.getView(NCCONST.VIEWTEMPLATES);
    templateDoc = vw.getDocumentByKey(TemplateName, true);
    formsdc = templateDoc.getResponses();

    // Parse any configured MetaFields once per template load.
    Vector templateMetaFields =
        templateDoc.getItemValue(NCCONST.TITM_METAFIELDS);
    metaFields = new ArrayList<MetaField>(templateMetaFields.size());
    for (Object o : templateMetaFields) {
      metaFields.add(new MetaField((String) o));
    }
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest("template MetaFields: '" + templateMetaFields
          + "'; parsed MetaFields: " + metaFields);
    }
    vw.recycle();
  }
View Full Code Here

      ns = ncs.createNotesSession();
      NotesDatabase cdb = ns.getDatabase(
          ncs.getServer(), ncs.getDatabase());

      // Reset the last update date for each configured database
      NotesView incrawlView = cdb.getView(NCCONST.VIEWINCRAWL);
      incrawlView.refresh();
      NotesDocument srcDoc = incrawlView.getFirstDocument();
      while (null != srcDoc) {
        LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
            "Connector starting - Resetting crawl document found " +
            "in INCRAWL state " + srcDoc.getUniversalID());
        srcDoc.replaceItemValue(NCCONST.NCITM_STATE, NCCONST.STATENEW);
        NotesDocument prevDoc = srcDoc;
        srcDoc = incrawlView.getNextDocument(prevDoc);

        // Don't save this until we have the next doc in the view.
        // Otherwise an exception will result
        prevDoc.save();
        prevDoc.recycle();
      }
      incrawlView.recycle();
    } catch (Exception e) {
      LOGGER.logp(Level.SEVERE, CLASS_NAME, METHOD,
          "Error resetting crawl document.", e);
    } finally {
      ncs.closeNotesSession(ns);
View Full Code Here

      ns = ncs.createNotesSession();
      NotesDatabase cdb = ns.getDatabase(
          ncs.getServer(), ncs.getDatabase());

      // Reset the last update date for each configured database
      NotesView srcdbView = cdb.getView(NCCONST.VIEWDATABASES);
      srcdbView.refresh();
      NotesDocument srcdbDoc = srcdbView.getFirstDocument();
      while (null != srcdbDoc) {
        LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
            "Connector reset - Resetting database last update date for "
            + srcdbDoc.getItemValue(NCCONST.DITM_DBNAME));
        srcdbDoc.removeItem(NCCONST.DITM_LASTUPDATE);
        srcdbDoc.removeItem(NCCONST.DITM_ACLTEXT);
        srcdbDoc.save(true);
        NotesDocument prevDoc = srcdbDoc;
        srcdbDoc = srcdbView.getNextDocument(prevDoc);
        prevDoc.recycle();
      }
      srcdbView.recycle();

      // Reset last cache update date time for directory update
      if (ncs.getUserGroupManager().resetLastCacheUpdate()) {
        LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
            "Last cache update date time is reset");
View Full Code Here

      // dependency on the operating system's settings for date
      // formats.
      NotesDateTime pollTime = ns.createDateTime("1/1/1900");
      pollTime.setNow();

      NotesView templateView = cdb.getView(NCCONST.VIEWTEMPLATES);
      NotesView srcdbView = cdb.getView(NCCONST.VIEWDATABASES);
      srcdbView.refresh();
      NotesView vwSubmitQ = cdb.getView(NCCONST.VIEWSUBMITQ);
      NotesView vwCrawlQ = cdb.getView(NCCONST.VIEWCRAWLQ);

      // TODO: Make this loop shutdown aware

      NotesDocument srcdbDoc = srcdbView.getFirstDocument();
      while (null != srcdbDoc) {
        vwSubmitQ.refresh();
        vwCrawlQ.refresh();
        int qDepth = vwSubmitQ.getEntryCount() + vwCrawlQ.getEntryCount();
        LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
            "Total documents in crawl and submit queues is: " + qDepth);
        if (vwSubmitQ.getEntryCount() + vwCrawlQ.getEntryCount() > maxDepth) {
          LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
              "Queue threshold reached.  Suspending polling. size/max="
              + qDepth + "/" + maxDepth);
          srcdbDoc.recycle();
          break;
        }
        LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
            "Source Database Config Document " +
            srcdbDoc.getItemValue(NCCONST.DITM_DBNAME));
        pollSourceDatabase(ns, cdb, srcdbDoc, templateView, pollTime);
        NotesDocument prevDoc = srcdbDoc;
        srcdbDoc = srcdbView.getNextDocument(prevDoc);
        prevDoc.recycle();
      }
      vwSubmitQ.recycle();
      vwCrawlQ.recycle();
      pollTime.recycle();
      templateView.recycle();
      srcdbView.recycle();
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, CLASS_NAME, e);
View Full Code Here

  @VisibleForTesting
  List<String> getViewUnids(NotesDatabase db, String viewName) {
    long timeStart = System.currentTimeMillis();
    List<String> unidList = new LinkedList<String>();
    NotesView view = null;
    try {
      if (!db.isOpen()) {
        LOGGER.warning("Cannot open database: " + getDatabaseFilePath(db));
        return unidList;
      }
      LOGGER.log(Level.FINEST,
          "Initialize UNID cache for {0} view in database {1}",
          new Object[] {viewName, db.getFilePath()});
      view = db.getView(viewName);
      view.refresh();

      NotesDocument doc = view.getFirstDocument();
      while (doc != null) {
        unidList.add(doc.getUniversalID());
        NotesDocument docNext = view.getNextDocument(doc);
        doc.recycle();
        doc = docNext;
      }
    } catch (RepositoryException e) {
      LOGGER.log(Level.WARNING, "Unable to build the UNID cache for "
View Full Code Here

  void updateUsers(List<String> userUnids) {
    final String METHOD = "updateUsers";
    LOGGER.entering(CLASS_NAME, METHOD);

    long timeStart = System.currentTimeMillis();
    NotesView serverAccessView = null;
    try {
      String userSelectionFormula = connectorSession.getUserSelectionFormula();
      String userNameFormula = connectorSession.getUserNameFormula();
      if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD,
            "User selection formula is: " + userSelectionFormula
            + "\nUser name formula is: " + userNameFormula);
      }
      serverAccessView = directoryDatabase.getView(
          NCCONST.DIRVIEW_SERVERACCESS);
      serverAccessView.refresh();

      int count = 0;
      for (String unid : userUnids) {
        NotesDocument personDoc = getDocumentByUnid(directoryDatabase, unid);
        if (personDoc == null) {
View Full Code Here

  @VisibleForTesting
  void updateRoles() {
    final String METHOD = "updateRoles";
    LOGGER.entering(CLASS_NAME, METHOD);

    NotesView connectorCrawlDatabaseView = null;
    NotesDocument connectorCrawlDatabaseDoc = null;
    try {
      connectorCrawlDatabaseView =
          connectorDatabase.getView(NCCONST.VIEWDATABASES);

      if (connectorCrawlDatabaseView == null) {
        return;
      }

      connectorCrawlDatabaseView.refresh();

      Set<String> replicaIds = new LinkedHashSet<String>();
      for (connectorCrawlDatabaseDoc =
               connectorCrawlDatabaseView.getFirstDocument();
           connectorCrawlDatabaseDoc != null;
           connectorCrawlDatabaseDoc = getNextDocument(
               connectorCrawlDatabaseView, connectorCrawlDatabaseDoc)) {
        NotesDatabase crawlDatabase = null;
        String databaseName = null;
View Full Code Here

  @VisibleForTesting
  void checkUserDeletions() {
    final String METHOD = "checkUserDeletions";
    LOGGER.entering(CLASS_NAME, METHOD);

    NotesView usersView = null;
    Statement stmt = null;
    ArrayList<Long> usersToDelete = new ArrayList<Long>();
    try {
      String userSelectionFormula = connectorSession.getUserSelectionFormula();

      // TODO: why do we have to use this view and an abbreviated
      // full name as opposed to just using the people/groups view
      // we use elsewhere?
      usersView = directoryDatabase.getView(NCCONST.DIRVIEW_VIMUSERS);
      usersView.refresh();
      stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
          ResultSet.CONCUR_READ_ONLY);
      ResultSet rs = stmt.executeQuery("select userid,notesname from "
          + userTableName);
      while (rs.next()) {
        long userId;
        String fullName;
        try {
          userId = rs.getLong(1);
          fullName = rs.getString(2);
        } catch (SQLException e) {
          LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD,
              "Failure reading user table data", e);
          continue;
        }
        try {
          String abbrevFormula = String.format("@Name([ABBREVIATE];\"%s\")",
              fullName);
          String key = notesSession.evaluate(abbrevFormula).elementAt(0)
              .toString();
          NotesDocument notesUserDoc = usersView.getDocumentByKey(key);
          if (notesUserDoc == null) {
            // This person or group no longer exists. Remove them
            LOGGER.logp(Level.INFO, CLASS_NAME, METHOD,
                "User no longer exists in source directory"
                + " and will be deleted: " + key);
View Full Code Here

  @VisibleForTesting
  void checkGroupDeletions() {
    final String METHOD = "checkGroupDeletions";
    LOGGER.entering(CLASS_NAME, METHOD);

    NotesView groupView = null;
    ArrayList<Long> groupsToDelete = new ArrayList<Long>();
    Statement stmt = null;
    try {
      groupView = directoryDatabase.getView(NCCONST.DIRVIEW_VIMGROUPS);
      groupView.refresh();
      stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
          ResultSet.CONCUR_READ_ONLY);
      ResultSet rs = stmt.executeQuery(
          "select groupid,groupname,pseudogroup from " + groupTableName);
      while (rs.next()) {
        long groupId;
        String groupName;
        boolean pseudoGroup = false;
        try {
          groupId = rs.getLong(1);
          groupName = rs.getString(2);
          pseudoGroup = rs.getBoolean(3);
        } catch (SQLException e) {
          LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD,
              "Failure reading group table data", e);
          continue;
        }

        if (pseudoGroup) {
          if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD,
                "Skipping deletion check for pseudo-group: " + groupName);
          }
          continue;
        }
        try {
          if (Util.isCanonical(groupName)) {
            NotesName notesGroupName = notesSession.createName(groupName);
            groupName = notesGroupName.getAbbreviated();
          }
          NotesDocument notesGroupDoc = groupView.getDocumentByKey(groupName);
          if (notesGroupDoc == null) {
            // This group no longer exists.
            LOGGER.logp(Level.INFO, CLASS_NAME, METHOD,
                "Group no longer exists in source directory"
                + " and will be deleted: " + groupName);
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.notes.client.NotesView

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.