Skip to content

Upgrading to com.sdl.odata 2.5.4 #7

@ghost

Description

I tried to update to Spring boot <spring.boot.version>1.5.8.RELEASE</spring.boot.version>
and <odata.version>2.5.4</odata.version> in the pom.xml

The only class that seems to require upgrade is AnnotationJPAEntityMapper, asking to implement 2 unimplemented methods.

@Override
public <R> List<R> convertDSEntitiesListToOData(List<Object> arg0, Class<R> arg1, EntityDataModel arg2)
		throws ODataDataSourceException {
	// TODO Auto-generated method stub
	return null;
}


@Override
public List<Object> convertODataEntitiesListToDS(List<Object> arg0, EntityDataModel arg1)
		throws ODataDataSourceException {
	// TODO Auto-generated method stub
	return null;
}

This is not my project and would require some string effort to understand what to do. Hopefully it is not too long to complete. I was hoping this author would find the time for this upgrade !

Am wrong if I interpret those methods like they should call respectively convertDSEntityToOData() and convertODataEntityToDS() for each element of the List ?

I mean, would this code be correct ? :

  @Override
public <T> List<T> convertDSEntitiesListToOData(List<Object> listObj, Class<T> odataEntityClass, EntityDataModel edm)
		throws ODataDataSourceException {

	List<T> res = new ArrayList<>();
	// convertDSEntityToOData(Object jpaEntity, Class<T> odataEntityClass, EntityDataModel entityDataModel)
	for(Object obj: listObj) {
		res.add(  convertDSEntityToOData(obj, odataEntityClass, edm ));
	}
	return res;
}


@Override
public List<Object> convertODataEntitiesListToDS(List<Object> listObj, EntityDataModel edm)
		throws ODataDataSourceException {
	
	List<Object> res = new ArrayList<>();
	// convertODataEntityToDS(Object odataEntity, EntityDataModel entityDataModel)
	for(Object obj: listObj) {
		res.add(convertODataEntityToDS(obj, edm ));
	}
	return res;
}

Thank you,
Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions