use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addTask.
public String addTask(TaskModel task, String processID) throws RegistryException {
try {
TaskResource taskResource = new TaskResource();
task.setTaskId(AiravataUtils.getId("TASK"));
taskResource.setTaskId(task.getTaskId());
taskResource.setParentProcessId(task.getParentProcessId());
taskResource.setTaskType(task.getTaskType().toString());
taskResource.setCreationTime(AiravataUtils.getTime(task.getCreationTime()));
taskResource.setLastUpdateTime(AiravataUtils.getTime(task.getLastUpdateTime()));
taskResource.setTaskDetail(task.getTaskDetail());
taskResource.setSubTaskModel(task.getSubTaskModel());
taskResource.save();
TaskStatus taskStatus = new TaskStatus();
taskStatus.setState(TaskState.CREATED);
taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
addTaskStatus(taskStatus, task.getTaskId());
if (task.getTaskErrors() != null) {
addTaskError(task.getTaskErrors().get(0), task.getTaskId());
}
} catch (Exception e) {
logger.error(processID, "Error while adding task...", e);
throw new RegistryException(e);
}
return task.getTaskId();
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class GatewayRegistry method updateGateway.
public void updateGateway(String gatewayId, Gateway updatedGateway) throws RegistryException {
try {
GatewayResource existingGateway = (GatewayResource) ExpCatResourceUtils.getGateway(gatewayId);
existingGateway.setGatewayApprovalStatus(updatedGateway.getGatewayApprovalStatus().toString());
existingGateway.setGatewayName(updatedGateway.getGatewayName());
existingGateway.setEmailAddress(updatedGateway.getEmailAddress());
existingGateway.setDomain(updatedGateway.getDomain());
existingGateway.setGatewayAcronym(updatedGateway.getGatewayAcronym());
existingGateway.setGatewayUrl(updatedGateway.getGatewayURL());
existingGateway.setGatewayPublicAbstract(updatedGateway.getGatewayPublicAbstract());
existingGateway.setReviewProposalDescription(updatedGateway.getReviewProposalDescription());
existingGateway.setGatewayAdminFirstName(updatedGateway.getGatewayAdminFirstName());
existingGateway.setGetGatewayAdminLastName(updatedGateway.getGatewayAdminLastName());
existingGateway.setGatewayAdminEmail(updatedGateway.getGatewayAdminEmail());
existingGateway.setIdentityServerUserName(updatedGateway.getIdentityServerUserName());
existingGateway.setIdentityServerPasswordToken(updatedGateway.getIdentityServerPasswordToken());
existingGateway.setDeclinedReason(updatedGateway.getDeclinedReason());
existingGateway.setOauthClientId(updatedGateway.getOauthClientId());
existingGateway.setOauthClientSecret(updatedGateway.getOauthClientSecret());
existingGateway.setRequesterUsername(updatedGateway.getRequesterUsername());
existingGateway.save();
} catch (RegistryException e) {
logger.error("Error while updating gateway to registry", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ProjectRegistry method addProject.
public String addProject(Project project, String gatewayId) throws RegistryException {
String projectId;
try {
if (!ExpCatResourceUtils.isUserExist(project.getOwner(), gatewayId)) {
ExpCatResourceUtils.addUser(project.getOwner(), null, gatewayId);
}
ProjectResource projectResource = new ProjectResource();
projectId = getProjectId(project.getName());
projectResource.setId(projectId);
project.setProjectID(projectId);
projectResource.setName(project.getName());
projectResource.setDescription(project.getDescription());
projectResource.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
projectResource.setGatewayId(gatewayId);
WorkerResource worker = new WorkerResource(project.getOwner(), gatewayId);
projectResource.setWorker(worker);
projectResource.save();
ProjectUserResource resource = (ProjectUserResource) projectResource.create(ResourceType.PROJECT_USER);
resource.setProjectId(project.getProjectID());
resource.setUserName(project.getOwner());
resource.save();
} catch (Exception e) {
logger.error("Error while saving project to registry", e);
throw new RegistryException(e);
}
return projectId;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ProjectRegistry method getProjectList.
/**
* Get projects list with pagination and result ordering
* @param fieldName
* @param value
* @param limit
* @param offset
* @param orderByIdentifier
* @param resultOrderType
* @return
* @throws RegistryException
*/
public List<Project> getProjectList(String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
List<Project> projects = new ArrayList<Project>();
try {
if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)) {
workerResource.setUser((String) value);
List<ProjectResource> projectList = workerResource.getProjects();
if (projectList != null && !projectList.isEmpty()) {
for (ProjectResource pr : projectList) {
projects.add(ThriftDataModelConversion.getProject(pr));
}
}
return projects;
}
} catch (Exception e) {
logger.error("Error while retrieving project from registry", e);
throw new RegistryException(e);
}
return projects;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ProjectRegistry method updateProject.
public void updateProject(Project project, String projectId) throws RegistryException {
try {
ProjectResource existingProject = workerResource.getProject(projectId);
existingProject.setDescription(project.getDescription());
existingProject.setName(project.getName());
WorkerResource worker = new WorkerResource(project.getOwner(), project.getGatewayId());
existingProject.setWorker(worker);
existingProject.save();
ProjectUserResource resource = (ProjectUserResource) existingProject.create(ResourceType.PROJECT_USER);
resource.setProjectId(projectId);
resource.setUserName(project.getOwner());
resource.save();
} catch (Exception e) {
logger.error("Error while saving project to registry", e);
throw new RegistryException(e);
}
}
Aggregations