}
try {
registry = RegistryFactory.getDefaultRegistry();
if (!registry.isExist(RegistryModelType.PROJECT, projectId)){
logger.error("Project does not exist in the system. Please provide a valid project ID...");
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
List<Experiment> experiments = new ArrayList<Experiment>();
List<Object> list = registry.get(RegistryModelType.EXPERIMENT, Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId);
if (list != null && !list.isEmpty()) {
for (Object o : list) {
experiments.add((Experiment) o);
}
}
return experiments;
} catch (Exception e) {
logger.error("Error while retrieving the experiments", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the experiments. More info : " + e.getMessage());
throw exception;
}
}