當前位置: 首頁>>代碼示例>>Java>>正文


Java StructuredQueryDefinition類代碼示例

本文整理匯總了Java中com.marklogic.client.query.StructuredQueryDefinition的典型用法代碼示例。如果您正苦於以下問題:Java StructuredQueryDefinition類的具體用法?Java StructuredQueryDefinition怎麽用?Java StructuredQueryDefinition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StructuredQueryDefinition類屬於com.marklogic.client.query包,在下文中一共展示了StructuredQueryDefinition類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getJobExecution

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public JobExecution getJobExecution(Long executionId) {
    JobExecution jobExec = null;
    StructuredQueryBuilder qb = new StructuredQueryBuilder(properties.getSearchOptions());
    StructuredQueryDefinition querydef = qb.valueConstraint("id", executionId.toString());
    QueryManager queryMgr = databaseClient.newQueryManager();
    SearchHandle results = queryMgr.search(querydef, new SearchHandle());
    DocumentDescriptor desc;
    if (results.getTotalResults() > 0L) {
        MatchDocumentSummary[] summaries = results.getMatchResults();
        JAXBHandle<AdaptedJobExecution> handle = new JAXBHandle<>(jaxbContext());
        AdaptedJobExecution aje = summaries[0].getFirstSnippet(handle).get();
        try {
            jobExec = adapter.unmarshal(aje);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }
        desc = databaseClient.newDocumentManager().exists(summaries[0].getUri());
        jobExec.setVersion((int) desc.getVersion());
    }

    return jobExec;

}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:26,代碼來源:MarkLogicJobExecutionDao.java

示例2: addStepExecutions

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public void addStepExecutions(JobExecution jobExecution) {
    List<StepExecution> stepExecutionList = new ArrayList<StepExecution>();
    StructuredQueryBuilder qb = new StructuredQueryBuilder(properties.getSearchOptions());
    String directoryUri = properties.getJobRepositoryDirectory() + "/" +
            jobExecution.getJobInstance().getId() + "/" +
            jobExecution.getId() + "/";
    StructuredQueryDefinition querydef = qb.and(
            qb.collection(properties.getStepExecutionCollection()),
            qb.directory(true, directoryUri)
    );
    QueryManager queryMgr = databaseClient.newQueryManager();
    SearchHandle results = queryMgr.search(querydef, new SearchHandle());
    if (results.getTotalResults() > 0L) {
        MatchDocumentSummary[] summaries = results.getMatchResults();
        JAXBHandle<AdaptedStepExecution> handle = new JAXBHandle<AdaptedStepExecution>(jaxbContext());
        AdaptedStepExecution ase = summaries[0].getFirstSnippet(handle).get();
        StepExecution stepExecution = null;
        try {
            stepExecution = adapter.unmarshal(ase);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }
        stepExecutionList.add(stepExecution);
    }
    jobExecution.addStepExecutions(stepExecutionList);
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:29,代碼來源:MarkLogicStepExecutionDao.java

示例3: findJobExecutions

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public List<JobExecution> findJobExecutions(JobInstance jobInstance) {
    String directory = properties.getJobRepositoryDirectory() + "/" + jobInstance.getId() + "/";
    StructuredQueryBuilder qb = new StructuredQueryBuilder(properties.getSearchOptions());
    StructuredQueryDefinition querydef =
            qb.and(
                    qb.directory(true, directory),
                    qb.collection(properties.getJobExecutionCollection())
            );
    QueryManager queryMgr = databaseClient.newQueryManager();
    SearchHandle results = queryMgr.search(querydef, new SearchHandle());
    MatchDocumentSummary[] summaries = results.getMatchResults();
    List<JobExecution> jobExecutions = new ArrayList<JobExecution>();

    DocumentManager docMgr = databaseClient.newXMLDocumentManager();
    for (MatchDocumentSummary summary : summaries) {
        DocumentDescriptor desc = docMgr.exists(summary.getUri());
        JAXBHandle<AdaptedJobExecution> jaxbHandle = new JAXBHandle<AdaptedJobExecution>(jaxbContext());
        summary.getFirstSnippet(jaxbHandle);
        AdaptedJobExecution aJobExecution = jaxbHandle.get();
        try {
            JobExecution jobExecution = adapter.unmarshal(aJobExecution);
            jobExecution.setVersion((int) desc.getVersion());
            jobExecutions.add(jobExecution);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return jobExecutions;
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:31,代碼來源:MarkLogicJobExecutionDao.java

示例4: findRunningJobExecutions

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public Set<JobExecution> findRunningJobExecutions(String jobName) {
    StructuredQueryBuilder qb = new StructuredQueryBuilder(properties.getSearchOptions());
    StructuredQueryDefinition querydef =
            qb.andNot(
                    qb.and(
                            qb.valueConstraint("jobName", jobName),
                            qb.collection("job-execution")
                    ),
                    qb.range(
                            qb.element(new QName(properties.getBatchNamespace(), "endDateTime")),
                            "xs:dateTime",
                            Operator.GT,
                            "1917-01-01T00:00:00.0"
                    )
            );
    logger.info(querydef.serialize());
    QueryManager queryMgr = databaseClient.newQueryManager();
    SearchHandle results = queryMgr.search(querydef, new SearchHandle());
    Set<JobExecution> jobExecutions = new HashSet<JobExecution>();
    for (MatchDocumentSummary summary : results.getMatchResults()) {
        JAXBHandle<AdaptedJobExecution> handle = new JAXBHandle<>(jaxbContext());
        summary.getFirstSnippet(handle);
        AdaptedJobExecution aje = handle.get();
        try {
            jobExecutions.add(adapter.unmarshal(aje));
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }
    }
    return jobExecutions;
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:34,代碼來源:MarkLogicJobExecutionDao.java

示例5: replicateIssue388Test

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Test
public void replicateIssue388Test() {
	StructuredQueryBuilder qb = new StructuredQueryBuilder("default");
	StructuredQueryDefinition querydef = 
		    qb.and(qb.term("neighborhood"), 
		           qb.valueConstraint("industry", "Real Estate"));
	Fragment frag = new Fragment(querydef.serialize(), new MarkLogicNamespaceProvider().getNamespaces());
	frag.assertElementValue("//search:text", "neighborhood");
	System.out.println(frag.getPrettyXml());
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:11,代碼來源:JavaClientApiIssue388Test.java

示例6: DeleteDocumentsTasklet

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
public DeleteDocumentsTasklet(DatabaseClientProvider databaseClientProvider, StructuredQueryDefinition queryDef) {
    this.databaseClient = databaseClientProvider.getDatabaseClient();
    this.queryDefinition = queryDef;
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:5,代碼來源:DeleteDocumentsTasklet.java

示例7: DocumentItemReader

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
public DocumentItemReader(DatabaseClientProvider databaseClientProvider, StructuredQueryDefinition queryDef) {
    this.databaseClientProvider = databaseClientProvider;
    this.queryDef = queryDef;
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:5,代碼來源:DocumentItemReader.java

示例8: buildQueryBatcher

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public QueryBatcher buildQueryBatcher(DatabaseClient databaseClient, DataMovementManager dataMovementManager) {
	StructuredQueryDefinition query = databaseClient.newQueryManager().newStructuredQueryBuilder().document(documentUris);
	return dataMovementManager.newQueryBatcher(query);
}
 
開發者ID:marklogic-community,項目名稱:ml-javaclient-util,代碼行數:6,代碼來源:DocumentUrisQueryBatcherBuilder.java

示例9: buildQueryBatcher

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
@Override
public QueryBatcher buildQueryBatcher(DatabaseClient databaseClient, DataMovementManager dataMovementManager) {
	StructuredQueryDefinition query = databaseClient.newQueryManager().newStructuredQueryBuilder().collection(collectionUris);
	return dataMovementManager.newQueryBatcher(query);
}
 
開發者ID:marklogic-community,項目名稱:ml-javaclient-util,代碼行數:6,代碼來源:CollectionsQueryBatcherBuilder.java

示例10: applyOnStructuredQuery

import com.marklogic.client.query.StructuredQueryDefinition; //導入依賴的package包/類
/**
 * Apply the given listener on batches on documents matching the given structured query.
 *
 * @param urisReadyListener
 * @param queryDefinition
 * @return
 */
public QueryBatcherJobTicket applyOnStructuredQuery(QueryBatchListener urisReadyListener, StructuredQueryDefinition queryDefinition) {
	return apply(urisReadyListener, dataMovementManager.newQueryBatcher(queryDefinition));
}
 
開發者ID:marklogic-community,項目名稱:ml-javaclient-util,代碼行數:11,代碼來源:QueryBatcherTemplate.java


注:本文中的com.marklogic.client.query.StructuredQueryDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。