use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceStepHandler method newDataService.
public void newDataService() {
DataServiceMeta dataServiceByStepName = delegate.getDataServiceByStepName(getActiveTrans(), getCurrentStep().getName());
if (dataServiceByStepName != null && !dataServiceByStepName.isUserDefined()) {
delegate.removeDataService(dataServiceByStepName);
}
delegate.createNewDataService(getCurrentStep().getName());
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceStepDeleteExtensionPointPlugin method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
if (object != null && object instanceof StepMeta[]) {
StepMeta[] stepsToBeRemoved = (StepMeta[]) object;
TransMeta trans = stepsToBeRemoved[0].getParentTransMeta();
List<String> stepsToBeRemovedNames = new ArrayList<>(stepsToBeRemoved.length);
for (StepMeta step : stepsToBeRemoved) {
stepsToBeRemovedNames.add(step.getName());
}
List<String> transSteps = Arrays.asList(trans.getStepNames());
List<String> remainingStepNames = ListUtils.subtract(transSteps, stepsToBeRemovedNames);
for (StepMeta stepToBeRemoved : stepsToBeRemoved) {
DataServiceMeta dataService = dataServiceDelegate.getDataServiceByStepName(stepToBeRemoved.getParentTransMeta(), stepToBeRemoved.getName());
if (dataService != null) {
List<String> dataServiceSteps = new ArrayList<>();
for (DataServiceMeta ds : dataServiceDelegate.getDataServices(stepToBeRemoved.getParentTransMeta())) {
dataServiceSteps.add(ds.getStepname());
}
switch(dataServiceDelegate.showRemapConfirmationDialog(dataService, ListUtils.subtract(remainingStepNames, dataServiceSteps))) {
case CANCEL:
throw new KettleException("Steps deletion cancelled by user");
case REMAP:
if (dataServiceDelegate.showRemapStepChooserDialog(dataService, ListUtils.subtract(remainingStepNames, dataServiceSteps), trans) == DataServiceRemapStepChooserDialog.Action.CANCEL) {
throw new KettleException("Steps deletion cancelled by user");
}
break;
case DELETE:
context.getDataServiceDelegate().removeDataService(dataService);
break;
}
}
}
}
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTreeDelegateExtension method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
SpoonTreeDelegateExtension treeDelExt = (SpoonTreeDelegateExtension) extension;
int caseNumber = treeDelExt.getCaseNumber();
if (!(treeDelExt.getTransMeta() instanceof TransMeta)) {
return;
}
TransMeta transMeta = (TransMeta) treeDelExt.getTransMeta();
String[] path = treeDelExt.getPath();
List<TreeSelection> objects = treeDelExt.getObjects();
TreeSelection object = null;
if (path[2].equals(STRING_DATA_SERVICES)) {
switch(caseNumber) {
case 3:
object = new TreeSelection(path[2], DataServiceMeta.class, transMeta);
break;
case 4:
try {
DataServiceMeta dataService = metaStoreUtil.getDataService(path[3], transMeta);
object = new TreeSelection(path[3], dataService, transMeta);
} catch (Exception e) {
// Do Nothing
}
break;
}
}
if (object != null) {
objects.add(object);
}
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceModel method getDataService.
public DataServiceMeta getDataService() {
DataServiceMeta dataService = new DataServiceMeta(transMeta);
dataService.setName(getServiceName());
dataService.setPushDownOptimizationMeta(getPushDownOptimizations());
dataService.setStepname(getServiceStep());
dataService.setStreaming(isStreaming());
dataService.setRowLimit(serviceMaxRows);
dataService.setTimeLimit(serviceMaxTime);
for (PushDownOptimizationMeta pushDownOptimization : pushDownOptimizations) {
pushDownOptimization.getType().init(transMeta, dataService, pushDownOptimization);
}
return dataService;
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceMetaStoreUtil method checkConflict.
public DataServiceMeta checkConflict(DataServiceMeta dataServiceMeta, String ignored) throws MetaStoreException, DataServiceAlreadyExistsException {
TransMeta serviceTrans = dataServiceMeta.getServiceTrans();
// Ensure this output step does not already have a data service
DataServiceMeta stepConflict = getDataServiceByStepName(serviceTrans, dataServiceMeta.getStepname());
if (stepConflict != null && !stepConflict.getName().equals(ignored)) {
throw new DataServiceAlreadyExistsException(dataServiceMeta, getString(PKG, "Messages.SaveError.StepConflict", stepConflict.getStepname(), stepConflict.getName()));
}
String name = dataServiceMeta.getName();
// If name hasn't changed, look no further
if (name.equals(ignored)) {
return dataServiceMeta;
}
// Scan local trans and meta store for conflict
if (getDataServiceNames(serviceTrans).contains(name)) {
throw new DataServiceAlreadyExistsException(dataServiceMeta);
}
// Scan MetaStore for conflict
if (getServiceTransMap(serviceTrans).containsKey(name)) {
throw new DataServiceAlreadyExistsException(dataServiceMeta);
}
return dataServiceMeta;
}
Aggregations