Package com.esri.gpt.framework.collection

Examples of com.esri.gpt.framework.collection.StringSet


       
      } else if (credentials instanceof UsernameCredential) {
        UsernameCredential unCredential = (UsernameCredential)credentials;
        String sBaseDN = userProps.getUserSearchDIT();
        String sFilter = userProps.returnUserLoginSearchFilter(unCredential.getUsername());
        StringSet ssDNs = getQueryFunctions().searchDNs(
                          getConnectedContext(),sBaseDN,sFilter);
        if (ssDNs.size() > 1) {
          throw new IdentityException("Multiple LDAP usernames matched for:"+ unCredential.getUsername());
        } else if (ssDNs.size() == 1) {
          sAuthenticatedDN = ssDNs.iterator().next();
        }
      }
    }

    // Attempt to connect with the supplied credentials.
View Full Code Here


   
    // search for the user
    LdapUserProperties userProps = getConfiguration().getUserProperties();
    String sBaseDN = userProps.getUserSearchDIT();
    String sFilter = userProps.returnUserLoginSearchFilter(sUsername);
    StringSet ssDNs = getQueryFunctions().searchDNs(
                      getConnectedContext(),sBaseDN,sFilter);
   
    // loop through each DN found,
    // attempt to connect with the supplied password
    for (String sDN: ssDNs) {
View Full Code Here

  ResultSet rs = null;
  int nRows = 0;
  boolean cancelTask = false;
 
  // read the file identifer before deletion
  StringSet fids = new StringSet();
  if (cswRemoteRepository.isActive()) {
    StringSet uuids = new StringSet();
    uuids.add(uuid);
    fids = queryFileIdentifiers(uuids);
  }
 
  // delete the database record
  try {
View Full Code Here

  boolean autoCommit = true;
  PreparedStatement st = null;
  int nRows = 0;

  // read the file identifer before deletion
  StringSet fids = new StringSet();
  if (cswRemoteRepository.isActive()) {
    StringSet uuids = new StringSet();
    uuids.add(uuid);
    fids = queryFileIdentifiers(uuids);
  }

  // delete the database record
  try {
View Full Code Here

* @throws SQLException if a database exception occurs
* @throws CatalogIndexException if a document indexing exception occurs
*/
public int deleteUnreferencedRecords(int maxValuesForIndex)
  throws SQLException, CatalogIndexException {
  StringSet uuids = new StringSet();
  PreparedStatement st = null;
  int nRows = 0;
 
  // find unreferenced records
  try {
    StringBuilder sbSql = new StringBuilder();
    sbSql.append("SELECT DOCUUID FROM ").append(getResourceDataTableName());
    sbSql.append(" WHERE DOCUUID NOT IN (SELECT DOCUUID FROM ");
    sbSql.append(getResourceTableName()).append(")");
    logExpression(sbSql.toString());
    Connection con = returnConnection().getJdbcConnection();
    st = con.prepareStatement(sbSql.toString());
    st.setMaxRows(maxValuesForIndex);
    ResultSet rs = st.executeQuery();
    while (rs.next()) {
      uuids.add(rs.getString(1));
    }
  } finally {
    closeStatement(st);
    st = null;
  }
  StringSet fids = new StringSet();
  if (cswRemoteRepository.isActive()) {
    fids = queryFileIdentifiers(uuids);
  }
 
  // delete unreferenced records from the admin table
  try {
    if (uuids.size() > 0) {
      String sMsg = "Deleting "+uuids.size()+" unreferenced documents from table: "+getResourceDataTableName();
      LogUtil.getLogger().info(sMsg);
      StringBuilder sbSql = new StringBuilder();
      sbSql.append("DELETE FROM ").append(getResourceDataTableName());
      sbSql.append(" WHERE DOCUUID IN (").append(uuidsToInClause(uuids)).append(")");
      logExpression(sbSql.toString());
      Connection con = returnConnection().getJdbcConnection();
      st = con.prepareStatement(sbSql.toString());
      nRows = st.executeUpdate();
    }
  } finally {
    closeStatement(st);
  }
 
  // delete unreferenced records from the index
  if (uuids.size() > 0) {
    CatalogIndexAdapter indexAdapter = getCatalogIndexAdapter();
    if (indexAdapter != null) {
      String sMsg = "Deleting "+uuids.size()+" unreferenced documents from the catalog index.";
      LogUtil.getLogger().info(sMsg);
      indexAdapter.deleteDocuments(uuids.toArray(new String[0]));
     
      if (cswRemoteRepository.isActive()) {
        if (fids.size() > 0) cswRemoteRepository.onRecordsDeleted(fids);
      }
    }
  }
 
  return nRows;
View Full Code Here

* @return the approval status (empty string if not found)
* @throws SQLException if a database exception occurs
*/
private StringSet queryFileIdentifiers(StringSet uuids) throws SQLException {
  PreparedStatement st = null;
  StringSet fids = new StringSet();
  try {
    if ((uuids != null) && (uuids.size() > 0)) {
      Connection con = returnConnection().getJdbcConnection();
      StringBuilder sbSql = new StringBuilder();
      sbSql.append("SELECT FILEIDENTIFIER FROM ").append(getResourceTableName());
      sbSql.append(" WHERE DOCUUID IN (").append(uuidsToInClause(uuids)).append(")");
      logExpression(sbSql.toString());
      st = con.prepareStatement(sbSql.toString());
      ResultSet rs = st.executeQuery();
      while (rs.next()) {
        String fid = Val.chkStr(rs.getString(1));
        if (fid.length() > 0) fids.add(rs.getString(1));
      }
    }
  } finally {
    closeStatement(st);
  }
View Full Code Here

* @throws SQLException if a database exception occurs
*/
public StringSet querySiteUuid(String siteUuid) throws SQLException {
  siteUuid = Val.chkStr(siteUuid);
  PreparedStatement st = null;
  StringSet uuids = new StringSet(false,true,true);
  try {
    Connection con = returnConnection().getJdbcConnection();
    String sSql = null;
    if (getIsDbCaseSensitive(this.getRequestContext())) {
      sSql = "SELECT DOCUUID FROM "+getResourceTableName()+
             " WHERE SITEUUID=? AND UPPER(PUBMETHOD)=?";
    } else {
      sSql = "SELECT DOCUUID FROM "+getResourceTableName()+
             " WHERE SITEUUID=? AND PUBMETHOD=?";
    }
    logExpression(sSql);
    st = con.prepareStatement(sSql);
    st.setString(1,siteUuid);
    st.setString(2,
      MmdEnums.PublicationMethod.harvester.toString().toUpperCase());
    ResultSet rs = st.executeQuery();
    while (rs.next()) {
      uuids.add(rs.getString(1));
    }
  } finally {
    closeStatement(st);
  }
  return uuids;
View Full Code Here

* @param maxUuids the maximum number to read
* @return the set of UUIDs
* @throws SQLException if a database exception occurs
*/
public StringSet readUuidsForSynchronization(int maxUuids) throws SQLException {
  StringSet uuids = new StringSet();
  PreparedStatement st = null;
  try {
    Connection con = returnConnection().getJdbcConnection();
    StringBuilder sbSql = new StringBuilder();
    sbSql.append("SELECT DOCUUID FROM ");
    sbSql.append(getResourceTableName());
    sbSql.append(" WHERE ((APPROVALSTATUS = 'approved') OR (APPROVALSTATUS = 'reviewed'))");
    logExpression(sbSql.toString());
    st = con.prepareStatement(sbSql.toString());
    st.setMaxRows(maxUuids);
    ResultSet rs = st.executeQuery();
    while (rs.next()) {
      uuids.add(rs.getString(1));
   
  } finally {
    closeStatement(st);
  }
  if (uuids.size() > 0) onRecordsSynchronized(uuids);
  return uuids;
}
View Full Code Here

     
    } else {
      indexAdapter.deleteDocuments(uuids.toArray(new String[0]));
     
      if (cswRemoteRepository.isActive()) {
        StringSet fids = queryFileIdentifiers(uuids);
        if (fids.size() > 0) cswRemoteRepository.onRecordsDeleted(fids);
      }
    }
  }
  return nRows;
}
View Full Code Here

public void deleteIndex(PublicationRecord record)
  throws CatalogIndexException, SQLException {

  CatalogIndexAdapter indexAdapter = getCatalogIndexAdapter();
  if (indexAdapter!=null) {
    StringSet uuids = new StringSet();
    uuids.add(record.getUuid());
    indexAdapter.deleteDocuments(uuids.toArray(new String[0]));
    if (cswRemoteRepository.isActive()) {
      StringSet fids = queryFileIdentifiers(uuids);
      if (fids.size() > 0) cswRemoteRepository.onRecordsDeleted(fids);
    }
  }

}
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.collection.StringSet

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.