dnet-applications/libs/dnet-wf-service/src/main/java/eu/dnetlib/manager/wf/nodes/aggregation/UpdateApiExtraFieldsNode.java

50 lines
1.1 KiB
Java

package eu.dnetlib.manager.wf.nodes.aggregation;
import org.springframework.beans.factory.annotation.Autowired;
import eu.dnetlib.dsm.DsmService;
import eu.dnetlib.manager.wf.annotations.WfInputParam;
import eu.dnetlib.manager.wf.annotations.WfNode;
import eu.dnetlib.manager.wf.nodes.AbstractJobNode;
@WfNode("updateApiExtraFields")
public class UpdateApiExtraFieldsNode extends AbstractJobNode {
@WfInputParam
private String dsId;
@WfInputParam
private String apiId;
@WfInputParam
private String infoType; // COLLECT, TRANSFORM, DOWNLOAD
@WfInputParam
private String mdId;
@WfInputParam
private long total;
@Autowired
private DsmService dsmService;
@Override
protected void execute() {
switch (infoType.toUpperCase()) {
case "COLLECT":
dsmService.updateUpdateApiCollectionInfo(apiId, mdId, total);
break;
case "AGGREGATOR":
case "TRANSFORM":
dsmService.updateUpdateApiAggregationInfo(apiId, mdId, total);
break;
case "DOWNLOAD":
dsmService.updateUpdateApiDownloadInfo(apiId, mdId, total);
break;
default:
throw new RuntimeException("Invalid infoType: " + infoType);
}
// TODO Auto-generated method stub
}
}