当前位置: 首页>>代码示例>>Java>>正文


Java ParseException类代码示例

本文整理汇总了Java中org.springframework.batch.item.ParseException的典型用法代码示例。如果您正苦于以下问题:Java ParseException类的具体用法?Java ParseException怎么用?Java ParseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParseException类属于org.springframework.batch.item包,在下文中一共展示了ParseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public MyObject read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
	// TODO: Reader business.
	
	final MyObject item = new MyObject("id " + counter, "Name " + counter);
	
	counter++;
	
	if(item.getId().contains("3")){
		throw new CustomSkipableException();
	}
	
	// The step ends when the reader returns null.
	if(counter > 10){
		return null;
	}
	
	return item;
	
}
 
开发者ID:maldiny,项目名称:Spring-Batch-en-Castellano,代码行数:21,代码来源:CustomReader.java

示例2: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
/**
 * 
 */
@Override
public String read()
		throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException
{
	if(i == null)
	{
		Collection<String> emails = email.shouldRemoveEmails();	
		if(emails == null)
			return null;
		
		this.i = emails.iterator();
	}
	
	if(i.hasNext())
		return i.next();
	return null;
}
 
开发者ID:nyla-solutions,项目名称:nyla,代码行数:21,代码来源:EmailShouldRemoveItemReader.java

示例3: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
/**
 * @return the current row (convert if conversion was provided)
 * @see org.springframework.batch.item.ItemReader#read()
 */
@SuppressWarnings("unchecked")
@Override
public T read() throws Exception, UnexpectedInputException, ParseException,
		NonTransientResourceException
{
	//read
	if(index > this.rowCount -1)
		return null;   //end of the sheet
	
	if(this.conversion != null)
		return this.conversion.convert(sheet.getRow(this.index++));
	
	
	return (T)sheet.getRow(this.index++);
}
 
开发者ID:nyla-solutions,项目名称:nyla,代码行数:20,代码来源:ExcelItemReader.java

示例4: read_twoCoursesList

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Test
public void read_twoCoursesList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
    when(daoManagerMock.chekImportedData()).thenReturn(true);
    List<Long> CreatedSapCourcesIds = new ArrayList<Long>();
    CreatedSapCourcesIds.add(100L);
    CreatedSapCourcesIds.add(200L);
    when(daoManagerMock.getAllCreatedSapCourcesIds()).thenReturn(CreatedSapCourcesIds);

    CampusCourseImportTO courseMock1 = mock(CampusCourseImportTO.class);
    CampusCourseImportTO courseMock2 = mock(CampusCourseImportTO.class);
    when(daoManagerMock.getSapCampusCourse(100L)).thenReturn(courseMock1);
    when(daoManagerMock.getSapCampusCourse(200L)).thenReturn(courseMock2);

    synchronizationReaderTestObject.init();
    // The first read delivers the first course
    assertNotNull(synchronizationReaderTestObject.read());
    // The second read delivers the second course
    assertNotNull(synchronizationReaderTestObject.read());
    // The third read delivers null
    assertNull(synchronizationReaderTestObject.read());
}
 
开发者ID:huihoo,项目名称:olat,代码行数:22,代码来源:SynchronizationReaderTest.java

示例5: read_twoStudentsList

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Test
public void read_twoStudentsList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
    List<Student> twoStudentsList = new ArrayList<Student>();
    Student studentMock1 = mock(Student.class);
    Student studentMock2 = mock(Student.class);
    twoStudentsList.add(studentMock1);
    twoStudentsList.add(studentMock2);
    when(daoManagerMock.getAllStudents()).thenReturn(twoStudentsList);
    studentMappingReaderTestObject.init();
    // The first read delivers the first student
    assertNotNull(studentMappingReaderTestObject.read());
    // The second read delivers the second student
    assertNotNull(studentMappingReaderTestObject.read());
    // The third read delivers null
    assertNull(studentMappingReaderTestObject.read());
}
 
开发者ID:huihoo,项目名称:olat,代码行数:17,代码来源:StudentMappingReaderTest.java

示例6: read_twoLecturersList

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Test
public void read_twoLecturersList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
    List<Lecturer> twoLecturersList = new ArrayList<Lecturer>();
    Lecturer lecturerMock1 = mock(Lecturer.class);
    Lecturer lecturerMock2 = mock(Lecturer.class);
    twoLecturersList.add(lecturerMock1);
    twoLecturersList.add(lecturerMock2);
    when(daoManagerMock.getAllLecturers()).thenReturn(twoLecturersList);
    lecturerMappingReaderTestObject.init();
    // The first read delivers the first lecturer
    assertNotNull(lecturerMappingReaderTestObject.read());
    // The second read delivers the second lecturer
    assertNotNull(lecturerMappingReaderTestObject.read());
    // The third read delivers null
    assertNull(lecturerMappingReaderTestObject.read());
}
 
开发者ID:huihoo,项目名称:olat,代码行数:17,代码来源:LecturerMappingReaderTest.java

示例7: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
/**
 * Reads the next item, jumping to next resource if necessary.
 */
public T read() throws Exception, UnexpectedInputException, ParseException {

    if (noInput) {
        return null;
    }

    // If there is no resource, then this is the first item, set the current
    // resource to 0 and open the first delegate.
    if (currentResource == -1) {
        currentResource = 0;
        delegate.setResource(resources[currentResource]);
        delegate.open(new ExecutionContext());
    }

    return readNextItem();
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:20,代码来源:ExtendedMultiResourceItemReader.java

示例8: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public QueryResult read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
    QueryResult aResult = null;

    if (unreadObjects.hasNext()) {
        aResult = unreadObjects.next();
        if (aResult != null) {
            lastTimestamp = CONVERTER_TIMESTAMP.convert((Calendar) aResult.getPropertyByQueryName("cmis:creationDate").getFirstValue()).get(0);
        } else {
            executeQuery();
            aResult = read();
        }
    } else if (currentQueryResult.getHasMoreItems()) {
        executeQuery();
        aResult = read();
    }

    return aResult;
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:20,代码来源:CmisReader.java

示例9: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public JudgmentIndexingData read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
    
    JudgmentIndexingItem judgmentIndexingItem = judgmentIndexingItems.poll();
    
    if (judgmentIndexingItem == null) {
        return null;
    }
    
    Judgment judgment = judgmentEnrichmentService.findOneAndEnrich(judgmentIndexingItem.getJudgmentId());
    if (judgment == null) {
        return null;
    }
    
    JudgmentIndexingData judgmentIndexingData = new JudgmentIndexingData();
    
    judgmentIndexingData.setJudgment(judgment);
    judgmentIndexingData.setReferencingCount(judgmentIndexingItem.getReferencingCount());
    
    return judgmentIndexingData;
}
 
开发者ID:CeON,项目名称:saos,代码行数:22,代码来源:JudgmentIndexingReader.java

示例10: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public Item read() throws Exception, UnexpectedInputException, ParseException,
		NonTransientResourceException {
	if (readerTransactional){
		businessMetrics.increment(MetricNames.READ_COUNT.getName());
		businessMetrics.submit(MetricNames.READ_GAUGE.getName(), 5);
	} else {
		businessMetrics.incrementNonTransactional(MetricNames.READ_COUNT.getName());
		businessMetrics.submitNonTransactional(MetricNames.READ_GAUGE.getName(), 5);
	}
	Item item = delegate.read();
	if (item != null && item.getActions().contains(Action.FAIL_ON_READ)){
		throw new MetricsTestException(Action.FAIL_ON_READ);
	}
	log.debug("Read item: "+item);
	return item;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:18,代码来源:MetricsTestItemReader.java

示例11: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public Page<Artifact, Artifact> read()
		throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
	MDC.remove(PATIENT);
	Page<Artifact, Artifact> page = super.read();
	while (page != null) {
		Artifact patient = page.getKey().get();
		if (patient.getFile() == null) {
			LOGGER.info("Skip {} as it is not fetched", patient);
			page = super.read();
			continue;
		}
		if (!patient.getExtension().equals("jar")) {
			LOGGER.info("Skip {} as it is not packaged as jar", patient);
			page = super.read();
			continue;
		}
		if (patient.isSnapshot()) {
			LOGGER.info("Skip {} as it is snapshot", patient);
			page = super.read();
			continue;
		}
		LOGGER.info("Processing {}...", patient);
		MDC.put(PATIENT, patient.toString());
		return page;
	}
	return null;
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:29,代码来源:Reader.java

示例12: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public I read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
	if (this.limit <= 0) {
		return null;
	}
	this.limit = this.limit - 1;
	return super.read();
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:9,代码来源:LimitedReader.java

示例13: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public I read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
	@SuppressWarnings("unchecked")
	I request = (I) this.jmsTemplate.receiveAndConvert(this.destination);
	if (request == null) {
		return null;
	}
	return request;
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:10,代码来源:Reader.java

示例14: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public String read() throws Exception, UnexpectedInputException,
        ParseException, NonTransientResourceException {
    if (count < number) {
        return ids[count++];
    }

    return null;
}
 
开发者ID:hosuaby,项目名称:signature-processing,代码行数:10,代码来源:ListIdsItemReader.java

示例15: read

import org.springframework.batch.item.ParseException; //导入依赖的package包/类
@Override
public String read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {

    String str = !strs.isEmpty() ? strs.remove(0) : null;
    log.info("+++ reader {}", str);
    return str;
}
 
开发者ID:przodownikR1,项目名称:springBatchJmsKata,代码行数:8,代码来源:SimpleStringReader.java


注:本文中的org.springframework.batch.item.ParseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。