当前位置: 首页>>代码示例>>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;未经允许,请勿转载。