airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRAVATA-2728) Refactoring Experiment Catalog Implementation
Date Mon, 30 Apr 2018 19:55:00 GMT

    [ https://issues.apache.org/jira/browse/AIRAVATA-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16458966#comment-16458966
] 

ASF GitHub Bot commented on AIRAVATA-2728:
------------------------------------------

tilaks26 commented on a change in pull request #191: [AIRAVATA-2728] Refactoring Experiment
Catalog Implementation
URL: https://github.com/apache/airavata/pull/191#discussion_r185091372
 
 

 ##########
 File path: modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
 ##########
 @@ -20,82 +20,413 @@
 */
 package org.apache.airavata.registry.core.repositories.expcatalog;
 
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.model.commons.ErrorModel;
 import org.apache.airavata.model.experiment.ExperimentModel;
-import org.apache.airavata.registry.core.entities.expcatalog.ExperimentEntity;
-import org.apache.airavata.registry.core.repositories.AbstractRepository;
-import org.apache.airavata.registry.core.utils.JPAUtils;
+import org.apache.airavata.model.experiment.UserConfigurationDataModel;
+import org.apache.airavata.model.status.*;
+import org.apache.airavata.registry.core.entities.expcatalog.*;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.ExpCatalogUtils;
 import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.apache.airavata.registry.core.utils.QueryConstants;
+import org.apache.airavata.registry.cpi.*;
 import org.dozer.Mapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
+import java.sql.Timestamp;
+import java.util.*;
 
-public class ExperimentRepository extends AbstractRepository<ExperimentModel, ExperimentEntity,
String> {
+public class ExperimentRepository extends ExpCatAbstractRepository<ExperimentModel, ExperimentEntity,
String> {
     private final static Logger logger = LoggerFactory.getLogger(ExperimentRepository.class);
 
-    public ExperimentRepository(Class<ExperimentModel> thriftGenericClass, Class<ExperimentEntity>
dbEntityGenericClass) {
-        super(thriftGenericClass, dbEntityGenericClass);
+    public ExperimentRepository() {
+        super(ExperimentModel.class, ExperimentEntity.class);
     }
 
-    @Override
-    public ExperimentModel create(ExperimentModel experiment){
-        return update(experiment);
+    protected String saveExperimentModelData(ExperimentModel experimentModel) throws RegistryException
{
+        ExperimentEntity experimentEntity = saveExperiment(experimentModel);
+        return experimentEntity.getExperimentId();
     }
 
-    @Override
-    public ExperimentModel update(ExperimentModel experiment){
-        String experimentId = experiment.getExperimentId();
+    protected ExperimentEntity saveExperiment(ExperimentModel experimentModel) throws RegistryException
{
+        if (experimentModel.getExperimentId() == null || experimentModel.getExperimentId().equals("DO_NOT_SET_AT_CLIENTS"))
{
+            logger.debug("Setting the Experiment's ExperimentId");
+            experimentModel.setExperimentId(ExpCatalogUtils.getID(experimentModel.getExperimentName()));
+        }
+
+        String experimentId = experimentModel.getExperimentId();
         Mapper mapper = ObjectMapperSingleton.getInstance();
-        ExperimentEntity entity = mapper.map(experiment, ExperimentEntity.class);
-
-        if(entity.getUserConfigurationData() != null) {
-            entity.getUserConfigurationData().setExperimentId(experimentId);
-            if (entity.getUserConfigurationData().getComputeResourceSchedulingEntity() !=
null)
-                entity.getUserConfigurationData().getComputeResourceSchedulingEntity().setExperimentId(experimentId);
-        }
-        if(entity.getExperimentInputs() != null)
-            entity.getExperimentInputs().forEach(expIn->expIn.setExperimentId(experimentId));
-        if(entity.getExperimentOutputs() != null)
-            entity.getExperimentOutputs().forEach(expOut->expOut.setExperimentId(experimentId));
-        if(entity.getExperimentErrors() != null)
-            entity.getExperimentErrors().forEach(expErr->expErr.setExperimentId(experimentId));
-        if(entity.getExperimentStatuses() != null)
-            entity.getExperimentStatuses().forEach(expStatus->expStatus.setExperimentId(experimentId));
-
-        if(entity.getProcesses() != null){
-            entity.getProcesses().forEach(process->{
-                process.setExperimentId(experimentId);
 
 Review comment:
   I'm not sure which version you're referring to. But this code is not there in the current
version I've committed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Refactoring Experiment Catalog Implementation
> ---------------------------------------------
>
>                 Key: AIRAVATA-2728
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2728
>             Project: Airavata
>          Issue Type: Improvement
>          Components: Registry API
>            Reporter: Sneha Tilak
>            Assignee: Sneha Tilak
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message