本文整理了Java中org.springframework.batch.item.ExecutionContext.entrySet()
方法的一些代码示例,展示了ExecutionContext.entrySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext.entrySet()
方法的具体详情如下:
包路径:org.springframework.batch.item.ExecutionContext
类名称:ExecutionContext
方法名:entrySet
[英]Returns the entry set containing the contents of this context.
[中]返回包含此上下文内容的条目集。
代码示例来源:origin: spring-projects/spring-batch
@Override
public boolean equals(Object obj) {
if (obj instanceof ExecutionContext == false) {
return false;
}
if (this == obj) {
return true;
}
ExecutionContext rhs = (ExecutionContext) obj;
return this.entrySet().equals(rhs.entrySet());
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Initializes a new {@link ExecutionContext} with the contents of another
* {@code ExecutionContext}.
*
* @param executionContext containing the entries to be copied to this current context.
*/
public ExecutionContext(ExecutionContext executionContext) {
this();
if (executionContext == null) {
return;
}
for (Entry<String, Object> entry : executionContext.entrySet()) {
this.map.put(entry.getKey(), entry.getValue());
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : jobExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: spring-projects/spring-batch
/**
* @return a map containing the items from the step {@link ExecutionContext}
*/
public Map<String, Object> getStepExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: spring-projects/spring-batch
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : stepExecution.getJobExecution().getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: spring-projects/spring-batch
private String serializeContext(ExecutionContext ctx) {
Map<String, Object> m = new HashMap<>();
for (Entry<String, Object> me : ctx.entrySet()) {
m.put(me.getKey(), me.getValue());
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
String results = "";
try {
serializer.serialize(m, out);
results = new String(out.toByteArray(), "ISO-8859-1");
}
catch (IOException ioe) {
throw new IllegalArgumentException("Could not serialize the execution context", ioe);
}
return results;
}
代码示例来源:origin: spring-projects/spring-batch
@Override
public void beforeJob(JobExecution jobExecution) {
ExecutionContext jobContext = jobExecution.getExecutionContext();
for (Map.Entry<String, Object> entry : jobExecutionContext.entrySet()) {
jobContext.put(entry.getKey(), entry.getValue());
}
}
} });
代码示例来源:origin: spring-projects/spring-batch
/**
* If there is a cached peek, then retrieve the execution context state from
* that point. If there is no peek cached, then call directly to the
* delegate.
*
* @param executionContext the current context
* @throws ItemStreamException if there is a problem
* @see ItemStream#update(ExecutionContext)
*/
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
if (next != null) {
// Get the last state from the delegate instead of using
// current value.
for (Entry<String, Object> entry : this.executionContext.entrySet()) {
executionContext.put(entry.getKey(), entry.getValue());
}
return;
}
updateDelegate(executionContext);
}
代码示例来源:origin: spring-projects/spring-batch
@Test
public void testDefaultStreamContext() throws Exception {
writer = new FlatFileItemWriter<>();
writer.setResource(new FileSystemResource(outputFile));
writer.setLineAggregator(new PassThroughLineAggregator<>());
writer.afterPropertiesSet();
writer.setSaveState(true);
writer.open(executionContext);
writer.update(executionContext);
assertNotNull(executionContext);
assertEquals(2, executionContext.entrySet().size());
assertEquals(0, executionContext.getLong(ClassUtils.getShortName(FlatFileItemWriter.class) + ".current.count"));
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public Set<String> $keySet(ExecutionContext entity) {
Set<String> result = entity.entrySet().stream().map(x -> x.getKey()).collect(Collectors.toSet());
return result;
}
代码示例来源:origin: org.springframework.batch/spring-batch-core
/**
* @return a map containing the items from the step {@link ExecutionContext}
*/
public Map<String, Object> getStepExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch/spring-batch-core
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : jobExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch/org.springframework.batch.core
private String serializeContext(ExecutionContext ctx) {
Map<String, Object> m = new HashMap<String, Object>();
for (Entry<String, Object> me : ctx.entrySet()) {
m.put(me.getKey(), me.getValue());
}
return serializer.serialize(m);
}
代码示例来源:origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : jobExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch/org.springframework.batch.core
/**
* @return a map containing the items from the step {@link ExecutionContext}
*/
public Map<String, Object> getStepExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core
/**
* @return a map containing the items from the step {@link ExecutionContext}
*/
public Map<String, Object> getStepExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void setItems(Object entity, Iterator<?> items) {
ExecutionContext ec = (ExecutionContext)entity;
Set<String> keySet = ec.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet());
keySet.forEach(key -> ec.remove(key));
items.forEachRemaining(i -> {
Entry e = (Entry)i;
ec.put((String)e.getKey(), e.getValue());
});
}
}
代码示例来源:origin: org.springframework.batch/org.springframework.batch.core
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getJobExecution().getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getJobExecution().getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: org.springframework.batch/spring-batch-core
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<String, Object>();
for (Entry<String, Object> entry : stepExecution.getJobExecution().getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
}
内容来源于网络,如有侵权,请联系作者删除!