|
|
|
@ -3,7 +3,8 @@ package com.finebi.plugin.custom.component;
|
|
|
|
|
import com.finebi.common.context.OperationContext; |
|
|
|
|
import com.finebi.provider.api.component.AbstractCustomComponentProvider; |
|
|
|
|
import com.finebi.provider.api.component.CustomComponentContext; |
|
|
|
|
import com.finebi.provider.api.component.DataModel; |
|
|
|
|
import com.finebi.provider.api.component.data.DataModel; |
|
|
|
|
import com.finebi.provider.api.component.data.Dimension; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.plugin.transform.ExecuteFunctionRecord; |
|
|
|
|
import com.fr.plugin.transform.FunctionRecorder; |
|
|
|
@ -111,19 +112,19 @@ public class DemoComponentProvider extends AbstractCustomComponentProvider {
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DataModel> process(List<DataModel> dataModels, CustomComponentContext customComponentContext) { |
|
|
|
|
|
|
|
|
|
return dataModels.stream().map(dataModel -> new DataModel() { |
|
|
|
|
@Override |
|
|
|
|
public List<String> getFields() { |
|
|
|
|
public List<Dimension> getFields() { |
|
|
|
|
return dataModel.getFields(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<List<Object>> getColData() { |
|
|
|
|
List<List<Object>> colData = new ArrayList<>(dataModel.getFields().size()); |
|
|
|
|
dataModel.getColData().forEach(d -> colData.add(Collections.singletonList(d.get(0)))); |
|
|
|
|
dataModel.getColData().forEach(d -> colData.add(Collections.singletonList(d.get((int) (Math.random() * d.size()))))); |
|
|
|
|
return colData; |
|
|
|
|
} |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|