Esempio n. 1
0
 public static StoredQuery getStoredQuery(AdhocQueryRequest req, XDSRegistryBean session)
     throws XDSException {
   String qryId = req.getAdhocQuery().getId();
   if (XDSConstants.XDS_FindDocuments.equals(qryId)) {
     return new FindDocumentsQuery(req, session);
   } else if (XDSConstants.XDS_FindDocumentsByReferenceId.equals(qryId)) {
     return new FindDocumentsByReferenceIdQuery(req, session);
   } else if (XDSConstants.XDS_FindSubmissionSets.equals(qryId)) {
     return new FindSubmissionSetQuery(req, session);
   } else if (XDSConstants.XDS_FindFolders.equals(qryId)) {
     return new FindFoldersQuery(req, session);
   } else if (XDSConstants.XDS_GetAll.equals(qryId)) {
     return new GetAllQuery(req, session);
   } else if (XDSConstants.XDS_GetDocuments.equals(qryId)) {
     return new GetDocumentsQuery(req, session);
   } else if (XDSConstants.XDS_GetFolders.equals(qryId)) {
     return new GetFoldersQuery(req, session);
   } else if (XDSConstants.XDS_GetAssociations.equals(qryId)) {
     return new GetAssociationsQuery(req, session);
   } else if (XDSConstants.XDS_GetDocumentsAndAssociations.equals(qryId)) {
     return new GetDocumentsAndAssociationsQuery(req, session);
   } else if (XDSConstants.XDS_GetSubmissionSets.equals(qryId)) {
     return new GetSubmissionSetsQuery(req, session);
   } else if (XDSConstants.XDS_GetSubmissionSetAndContents.equals(qryId)) {
     return new GetSubmissionSetAndContentsQuery(req, session);
   } else if (XDSConstants.XDS_GetFolderAndContents.equals(qryId)) {
     return new GetFolderAndContentsQuery(req, session);
   } else if (XDSConstants.XDS_GetFoldersForDocument.equals(qryId)) {
     return new GetFoldersForDocumentQuery(req, session);
   } else if (XDSConstants.XDS_GetRelatedDocuments.equals(qryId)) {
     return new GetRelatedDocumentsQuery(req, session);
   }
   throw new XDSException(
       XDSException.XDS_ERR_UNKNOWN_STORED_QUERY_ID, "Unknown Stored Query id:" + qryId, null);
 }
Esempio n. 2
0
 public StoredQuery(AdhocQueryRequest req, XDSRegistryBean session) throws XDSException {
   this.req = req;
   this.session = session;
   queryParam = StoredQueryParam.getQueryParams(req);
   log.info(
       "AdhocQueryRequest " + req.getAdhocQuery().getId() + ": params:" + queryParam.values());
   checkRequiredParameter();
 }
Esempio n. 3
0
  public static void logQuery(
      EventTypeCode eventTypeCode,
      AdhocQueryRequest req,
      String srcUserID,
      String altSrcUserID,
      String srcHostName,
      String destUserID,
      String altDestUserID,
      String destHostName,
      boolean success) {

    if (logger != null && logger.isInstalled()) {
      try {
        AdhocQueryType qry = req.getAdhocQuery();
        String patID = XDSUtil.getQueryPatID(qry.getSlot());
        String homeCommunityID =
            InfosetUtil.getSlotValue(qry.getSlot(), XDSConstants.QRY_HOME_COMMUNITY_ID, null);
        if (srcHostName == null) srcHostName = AuditLogger.localHost().getHostName();
        Calendar timeStamp = logger.timeStamp();
        AuditMessage msg =
            XDSAudit.createQuery(
                eventTypeCode,
                qry.getId(),
                patID,
                homeCommunityID,
                InfosetUtil.marshallObject(req, true).getBytes("UTF-8"),
                srcUserID,
                altSrcUserID,
                srcHostName,
                destUserID,
                altDestUserID,
                destHostName,
                timeStamp,
                success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MinorFailure);
        sendAuditMessage(timeStamp, msg);
      } catch (Exception e) {
        log.warn("Audit log of Stored Query failed!");
        log.debug("AuditLog Exception:", e);
      }
    }
  }
Esempio n. 4
0
 public boolean isLeafClass() {
   return XDSConstants.QUERY_RETURN_TYPE_LEAF.equals(req.getResponseOption().getReturnType());
 }