use of org.pentaho.platform.repository2.unified.webservices.NodeRepositoryFileDataDto in project pentaho-platform by pentaho.
the class UnifiedRepositoryToWebServiceAdapter method getDataForReadInBatch.
@Override
@SuppressWarnings("unchecked")
public <T extends IRepositoryFileData> java.util.List<T> getDataForReadInBatch(final List<RepositoryFile> files, final Class<T> dataClass) {
List<RepositoryFileDto> fileDtos = new ArrayList<RepositoryFileDto>(files.size());
for (RepositoryFile file : files) {
fileDtos.add(repositoryFileAdapter.marshal(file));
}
if (dataClass.equals(NodeRepositoryFileData.class)) {
List<NodeRepositoryFileDataDto> nodeData = repoWebService.getDataAsNodeForReadInBatch(fileDtos);
List<T> data = new ArrayList<T>(nodeData.size());
for (NodeRepositoryFileDataDto node : nodeData) {
data.add((T) nodeRepositoryFileDataAdapter.unmarshal(node));
}
return data;
} else if (dataClass.equals(SimpleRepositoryFileData.class)) {
List<SimpleRepositoryFileDataDto> nodeData = repoWebService.getDataAsBinaryForReadInBatch(fileDtos);
List<T> data = new ArrayList<T>(nodeData.size());
for (SimpleRepositoryFileDataDto node : nodeData) {
data.add((T) SimpleRepositoryFileDataDto.convert(node));
}
return data;
} else {
throw new IllegalArgumentException();
}
}
Aggregations