String workflowInstanceId, String templateName) throws RegistryException {
if (provenanceRegistry != null){
provenanceRegistry.addWorkflowInstance(experimentId,workflowInstanceId, templateName);
}else {
if (!isExperimentExists(experimentId, true)){
throw new ExperimentDoesNotExistsException(experimentId);
}
if (isWorkflowInstanceExists(workflowInstanceId)){
throw new WorkflowInstanceAlreadyExistsException(workflowInstanceId);
}
ExperimentResource experiment = jpa.getWorker().getExperiment(experimentId);