Examples of HrRecord


Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

/**
* Sets owner.
* @param owner harvest repository as owner
*/
public void setOwner(HrRecord owner) {
  _owner = owner!=null? owner: new HrRecord();
}
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

/**
* Sets parent site.
* @param parent parent site
*/
private void setParent(HrRecord parent) {
  _parent = parent != null ? parent : new HrRecord();
}
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

*
*/
public Map<String, HrRecord> readHarvestRecords(StringSet rids,
    RequestContext context) throws SearchException {
  // TODO: Sort out exception issues
  HrRecord record = null;
  PreparedStatement st = null;
  ManagedConnection mcon = null;
  ResultSet rs = null;
  Map<String, HrRecord> mpRidRecords = new
    TreeMap<String, HrRecord>(String.CASE_INSENSITIVE_ORDER)
  Map<String, String> idFields = new
    TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);

  for (String rid : rids) {
    rid = Val.chkStr(rid);
    if (rid.length() < 1) {
      continue;
    }

    String field = "DOCUUID";
    try {
      Integer.parseInt(rid);
      field = "ID";
    } catch (NumberFormatException nfe) {
      if (!UuidUtil.isUuid(rid)) {
        rid = rid.toUpperCase();
        field = "UPPER(TITLE)";
      }
    }
    idFields.put(rid, field);
  }

  // Create sql to query db
  String table = context.getCatalogConfiguration().getResourceTableName();
  String sql = "SELECT PROTOCOL_TYPE, HOST_URL, PROTOCOL, TITLE, " +
      "DOCUUID, ID FROM "
      + table + " WHERE ";
 
  int i = 0;
  int maxEntries = idFields.size();
 
 
  for (Map.Entry<String, String> entry : idFields.entrySet()) {
    sql += entry.getValue() + "= ?";
    if (i >= 0 && i < maxEntries - 1) {
      sql += " or ";
    }
    i++;

  }
 
  sql += " AND ((APPROVALSTATUS = 'approved') OR (APPROVALSTATUS = 'reviewed'))";
  sql += " AND SEARCHABLE = 'true'";

  LOG.info("DB Query " + sql);
  ArrayList<HrRecord> arrHrRecords = new ArrayList<HrRecord>();
  try {
    mcon = context.getConnectionBroker().returnConnection("");
    st = mcon.getJdbcConnection().prepareStatement(sql);
    int parNum = 1;
    for (Map.Entry<String, String> entry : idFields.entrySet()) {
      String field = entry.getValue();
      String rid = entry.getKey();
      if (field.equalsIgnoreCase("ID")) {
        st.setInt(parNum, Val.chkInt(rid, Integer.MIN_VALUE));
      } else {
        st.setString(parNum, rid);
      }
      parNum++;
    }
    rs = st.executeQuery();
  
    while (rs.next()) {
     
      // Assembling records for each id
      record = new HrRecord();
      record.setHostUrl(rs.getString(2));

      String protocolDef = rs.getString(3);
      Protocol protocol = getRequestContext().getApplicationConfiguration()
          .getProtocolFactories().parseProtocol(protocolDef);
      try {
        record.setProtocol(protocol);
      } catch (IllegalArgumentException ex) {
        record.setProtocol(new HarvestProtocolNone());
      }
      record.setName(rs.getString(4));
      record.setUuid(rs.getString(5));
      LOG
          .info("Name = " + record.getName() + "protocol "
              + protocol.toString());
     
      // Attempting to marshall db with ids that have been given
      String id = Val.chkStr(rs.getString("ID"));
      String idValue = Val.chkStr(idFields.get(id));
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

      new HrSelectRequest(context, uuid);
    selectRepositoryRequest.execute();
    HrRecords records = selectRepositoryRequest.getQueryResult().getRecords();

    // get harvest repository record
    HrRecord record = records.size() == 1 ? records.get(0) : null;
    if (record == null) {
      throw new ApplicationException();
    }

    // select and read harvest event record
    HeSelectRequest selectRequest =
      new HeSelectRequest(context, record, getCriteria(), getResult());
    selectRequest.execute();

    getResult().getQueryResult().setUuid(record.getUuid());
    getResult().getQueryResult().setProtocolTypeAsString(record.getProtocol().getKind());
    getResult().getQueryResult().setName(record.getName());
    getResult().getQueryResult().setUrl(record.getHostUrl());
    getResult().getQueryResult().setReportUuid("");

  } catch (NotAuthorizedException e) {
    try {
      ExternalContext ec = getContextBroker().getExternalContext();
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

  try {
    // start view preparation phase
    RequestContext context = onPrepareViewStarted();
    getReportViewer().setRequestContext(context);
    getReportViewer().setMsgBroker(extractMessageBroker());
    getReportViewer().setRecord(new HeRecord(new HrRecord()));

    String uuid = context.getServletRequest().getParameter("uuid");
    if (UuidUtil.isUuid(uuid)) {
      getCriteria().getActionCriteria().setEventUuid(uuid);
      setExternal(true);
    } else {
      // check authorization
      authorizeAction(context);
    }

    String sEventUuid = getCriteria().getActionCriteria().getEventUuid();

    // get uuid of harvest event uuid
    if (!UuidUtil.isUuid(sEventUuid)) {
      throw new ApplicationException();
    }

    // select and read harvest event record
    HeSelectOneRequest selectEventReq =
      new HeSelectOneRequest(context, sEventUuid);
    selectEventReq.execute();
    HeRecords events = selectEventReq.getQueryResult().getRecords();

    // get harvest event record
    HeRecord event = events.size() == 1 ? events.get(0) : null;
    if (event == null) {
      throw new ApplicationException("No requested event found.");
    }

    HrRecord repository = event.getRepository();

    getResult().getQueryResult().setUuid(repository.getUuid());
    getResult().getQueryResult().setProtocolTypeAsString(repository.getProtocol().getKind());
    getResult().getQueryResult().setName(repository.getName());
    getResult().getQueryResult().setUrl(repository.getHostUrl());
    getResult().getQueryResult().setReportUuid(event.getUuid());

    getReportViewer().setRecord(event);

  } catch (NotAuthorizedException e) {
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

   * @throws Exception if an exception occurs
   */
  private void executePut(HttpServletRequest request, HttpServletResponse response,
      RequestContext context, Publisher publisher) throws Exception {
    String xml = null;
    HrRecord record = extractRegistrationInfo(request);

    if (record==null) {
      try {
        xml = this.readInputCharacters(request);
      } catch (IOException e) {
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

   */
  private HrRecord extractRegistrationInfo(HttpServletRequest request) {
    ApplicationContext appCtx = ApplicationContext.getInstance();
    ApplicationConfiguration appCfg = appCtx.getConfiguration();

    HrRecord record = new HrRecord();
    StringAttributeMap attributes = new StringAttributeMap();
    boolean updateContent = true;
    boolean updateDefinition = true;
    boolean autoApprove = true;

    for (String paramName : new EnumerationAdapter<String>(request.getParameterNames())) {
      String paramValue = request.getParameter(paramName);
      if (paramName.equalsIgnoreCase("uuid")) {
        record.setUuid(paramValue);
      }
      if (paramName.equalsIgnoreCase("name")) {
        record.setName(paramValue);
      }
      else if (paramName.equalsIgnoreCase("url")) {
        record.setHostUrl(paramValue);
      }
      else if (paramName.equalsIgnoreCase("soapurl")) {
        attributes.add(new StringAttribute(ArcGISProtocol.SOAP_URL,paramValue));
      }
      else if (paramName.equalsIgnoreCase("protocol")) {
        ProtocolFactory factory = appCfg.getProtocolFactories().get(paramValue);
        if (factory!=null) {
          record.setProtocol(factory.newProtocol());
        }
      }
      else if (paramName.equalsIgnoreCase("frequency")) {
        record.setHarvestFrequency(HarvestFrequency.checkValueOf(paramValue));
      }
      else if (paramName.equalsIgnoreCase("sendNotification")) {
        record.setSendNotification(Val.chkBool(paramValue, false));
      }
      else if (paramName.equalsIgnoreCase("updateContent")) {
        updateContent = Val.chkBool(paramValue, true);
      }
      else if (paramName.equalsIgnoreCase("updateDefinition")) {
        updateDefinition = Val.chkBool(paramValue, true);
      }
      else if (paramName.equalsIgnoreCase("autoApprove")) {
        autoApprove = Val.chkBool(paramValue, true);
      }
      else if (paramName.equalsIgnoreCase("findable")) {
        record.setFindable(Val.chkBool(paramValue, true));
      }
      else if (paramName.equalsIgnoreCase("searchable")) {
        record.setSearchable(Val.chkBool(paramValue, true));
      }
      else if (paramName.equalsIgnoreCase("synchronizable")) {
        record.setSynchronizable(Val.chkBool(paramValue, true));
      }
      else {
        attributes.add(new StringAttribute(paramName,paramValue));
      }
    }

    if (record.getProtocol()==null || record.getProtocol().getKind().equalsIgnoreCase(ProtocolType.None.name())) {
      ProtocolFactory factory = appCfg.getProtocolFactories().get(ProtocolType.RES.name());
      if (factory!=null) {
        record.setProtocol(factory.newProtocol());
      }
    }
   
    if (record.getProtocol()!=null) {
      record.getProtocol().setAttributeMap(attributes);
      ProtocolInvoker.setUpdateDefinition(record.getProtocol(), updateDefinition);
      ProtocolInvoker.setUpdateContent(record.getProtocol(), updateContent);
      ProtocolInvoker.setAutoApprove(record.getProtocol(), autoApprove);
    }

    record = record.getName().length()>0 && record.getHostUrl().length()>0 && record.getProtocol()!=null? record: null;

    return record;
  }
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

          // this is it; do something in overriden method
          onSelect(r);
        }

        // get the one record with the closes due date but not due yet
        HrRecord nextDue = records.findNextDue();
       
        // caluclate duration in milliseconds
        if (nextDue!=null) {
          Date nextHarvestDate = nextDue.getNextHarvestDate();
          duration = nextHarvestDate.getTime() - (new Date()).getTime() ;
          LOGGER.log(Level.INFO,"[SYNCHRONIZER] Next synchronization time : "+nextHarvestDate.toString()+" has been determined based on scheduling of "+nextDue.getUuid()+"/\""+nextDue.getName()+"\" harvesting site.");
        } else {
          duration = autoSelectFrequency;
          LOGGER.log(Level.INFO,"[SYNCHRONIZER] Next synchronization time couldn't been determined at this time.");
        }
       
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

   * Sets harvest repository editor.
   *
   * @param editor harvest repository editor
   */
  public void setEditor(HarvestEditor editor) {
    _editor = editor != null ? editor : new HarvestEditor(new HrRecord());
  }
View Full Code Here

Examples of com.esri.gpt.catalog.harvest.repository.HrRecord

      // check authorization
      authorizeAction(context);
     
      // perform check through the validator
      HrRecord repository = getEditor().getRepository();
      ValidatorFactory validatorFactory = ValidatorFactory.getInstance();
      IValidator validator = validatorFactory.getValidator(repository);
      if (validator!=null && validator.checkConnection(new MessageCollectorAdaptor(extractMessageBroker()))) {
        extractMessageBroker().addSuccessMessage("catalog.harvest.manage.test.success");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.