Skip to content

Commit

Permalink
CLI: getObjetcJson method params are now category and path
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Oct 27, 2023
1 parent ce32db4 commit e4962c8
Show file tree
Hide file tree
Showing 89 changed files with 293 additions and 254 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023-09-12 OpenCB
* Copyright 2015-2023-10-27 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023-09-12 OpenCB
* Copyright 2015-2023-10-27 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*/
public class AdminCommandExecutor extends OpencgaCommandExecutor {

public String categoryName = "admin";
public AdminCommandOptions adminCommandOptions;

public AdminCommandExecutor(AdminCommandOptions adminCommandOptions) throws CatalogAuthenticationException {
Expand Down Expand Up @@ -138,7 +139,7 @@ private RestResponse<ObjectMap> installCatalog() throws Exception {
installationParams = new InstallationParams();
RestResponse<ObjectMap> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(installationParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/catalog/install"));
return res;
} else if (commandOptions.jsonFile != null) {
installationParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -167,7 +168,7 @@ private RestResponse<ObjectMap> jwtCatalog() throws Exception {
jWTParams = new JWTParams();
RestResponse<ObjectMap> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(jWTParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/catalog/jwt"));
return res;
} else if (commandOptions.jsonFile != null) {
jWTParams = JacksonUtils.getDefaultObjectMapper()
Expand All @@ -193,7 +194,7 @@ private RestResponse<User> createUsers() throws Exception {
userCreateParams = new UserCreateParams();
RestResponse<User> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(userCreateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/create"));
return res;
} else if (commandOptions.jsonFile != null) {
userCreateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -224,7 +225,7 @@ private RestResponse<User> importUsers() throws Exception {
userImportParams = new UserImportParams();
RestResponse<User> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(userImportParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/import"));
return res;
} else if (commandOptions.jsonFile != null) {
userImportParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -272,7 +273,7 @@ private RestResponse<Group> syncUsers() throws Exception {
groupSyncParams = new GroupSyncParams();
RestResponse<Group> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(groupSyncParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/sync"));
return res;
} else if (commandOptions.jsonFile != null) {
groupSyncParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -308,7 +309,7 @@ private RestResponse<Group> usersUpdateGroups() throws Exception {
userUpdateGroup = new UserUpdateGroup();
RestResponse<Group> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(userUpdateGroup));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/{user}/groups/update"));
return res;
} else if (commandOptions.jsonFile != null) {
userUpdateGroup = JacksonUtils.getDefaultObjectMapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*/
public class AnalysisAlignmentCommandExecutor extends OpencgaCommandExecutor {

public String categoryName = "analysisAlignment";
public AnalysisAlignmentCommandOptions analysisAlignmentCommandOptions;

public AnalysisAlignmentCommandExecutor(AnalysisAlignmentCommandOptions analysisAlignmentCommandOptions) throws CatalogAuthenticationException {
Expand Down Expand Up @@ -134,7 +135,7 @@ private RestResponse<Job> runBwa() throws Exception {
bwaWrapperParams = new BwaWrapperParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(bwaWrapperParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/bwa/run"));
return res;
} else if (commandOptions.jsonFile != null) {
bwaWrapperParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -176,7 +177,7 @@ private RestResponse<Job> runCoverageIndex() throws Exception {
coverageIndexParams = new CoverageIndexParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(coverageIndexParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/coverage/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
coverageIndexParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -215,7 +216,7 @@ private RestResponse<Job> coverageQcGeneCoverageStatsRun() throws Exception {
alignmentGeneCoverageStatsParams = new AlignmentGeneCoverageStatsParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(alignmentGeneCoverageStatsParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/coverage/qc/geneCoverageStats/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentGeneCoverageStatsParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -311,7 +312,7 @@ private RestResponse<Job> runDeeptools() throws Exception {
deeptoolsWrapperParams = new DeeptoolsWrapperParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(deeptoolsWrapperParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/deeptools/run"));
return res;
} else if (commandOptions.jsonFile != null) {
deeptoolsWrapperParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -350,7 +351,7 @@ private RestResponse<Job> runFastqc() throws Exception {
fastqcWrapperParams = new FastqcWrapperParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(fastqcWrapperParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/fastqc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
fastqcWrapperParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -389,7 +390,7 @@ private RestResponse<Job> runIndex() throws Exception {
alignmentIndexParams = new AlignmentIndexParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(alignmentIndexParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentIndexParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -427,7 +428,7 @@ private RestResponse<Job> runPicard() throws Exception {
picardWrapperParams = new PicardWrapperParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(picardWrapperParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/picard/run"));
return res;
} else if (commandOptions.jsonFile != null) {
picardWrapperParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -466,7 +467,7 @@ private RestResponse<Job> runQc() throws Exception {
alignmentQcParams = new AlignmentQcParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(alignmentQcParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/qc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentQcParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -538,7 +539,7 @@ private RestResponse<Job> runSamtools() throws Exception {
samtoolsWrapperParams = new SamtoolsWrapperParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(samtoolsWrapperParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/samtools/run"));
return res;
} else if (commandOptions.jsonFile != null) {
samtoolsWrapperParams = JacksonUtils.getDefaultObjectMapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
*/
public class AnalysisClinicalCommandExecutor extends OpencgaCommandExecutor {

public String categoryName = "analysisClinical";
public AnalysisClinicalCommandOptions analysisClinicalCommandOptions;

public AnalysisClinicalCommandExecutor(AnalysisClinicalCommandOptions analysisClinicalCommandOptions) throws CatalogAuthenticationException {
Expand Down Expand Up @@ -217,7 +218,7 @@ private RestResponse<ClinicalAnalysisAclEntryList> updateAcl() throws Exception
clinicalAnalysisAclUpdateParams = new ClinicalAnalysisAclUpdateParams();
RestResponse<ClinicalAnalysisAclEntryList> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(clinicalAnalysisAclUpdateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -251,7 +252,7 @@ private RestResponse<ObjectMap> updateClinicalConfiguration() throws Exception {
clinicalAnalysisStudyConfiguration = new ClinicalAnalysisStudyConfiguration();
RestResponse<ObjectMap> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(clinicalAnalysisStudyConfiguration));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/clinical/configuration/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisStudyConfiguration = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -288,7 +289,7 @@ private RestResponse<ClinicalAnalysis> create() throws Exception {
clinicalAnalysisCreateParams = new ClinicalAnalysisCreateParams();
RestResponse<ClinicalAnalysis> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(clinicalAnalysisCreateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/create"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisCreateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -467,7 +468,7 @@ private RestResponse<Job> runInterpreterCancerTiering() throws Exception {
cancerTieringInterpretationAnalysisParams = new CancerTieringInterpretationAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(cancerTieringInterpretationAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/cancerTiering/run"));
return res;
} else if (commandOptions.jsonFile != null) {
cancerTieringInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -506,7 +507,7 @@ private RestResponse<Job> runInterpreterExomiser() throws Exception {
exomiserInterpretationAnalysisParams = new ExomiserInterpretationAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(exomiserInterpretationAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/exomiser/run"));
return res;
} else if (commandOptions.jsonFile != null) {
exomiserInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -543,7 +544,7 @@ private RestResponse<Job> runInterpreterTeam() throws Exception {
teamInterpretationAnalysisParams = new TeamInterpretationAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(teamInterpretationAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/team/run"));
return res;
} else if (commandOptions.jsonFile != null) {
teamInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -583,7 +584,7 @@ private RestResponse<Job> runInterpreterTiering() throws Exception {
tieringInterpretationAnalysisParams = new TieringInterpretationAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(tieringInterpretationAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/tiering/run"));
return res;
} else if (commandOptions.jsonFile != null) {
tieringInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -623,7 +624,7 @@ private RestResponse<Job> runInterpreterZetta() throws Exception {
zettaInterpretationAnalysisParams = new ZettaInterpretationAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(zettaInterpretationAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/zetta/run"));
return res;
} else if (commandOptions.jsonFile != null) {
zettaInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -826,7 +827,7 @@ private RestResponse<Job> runRgaIndex() throws Exception {
rgaAnalysisParams = new RgaAnalysisParams();
RestResponse<Job> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(rgaAnalysisParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/rga/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
rgaAnalysisParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -1166,7 +1167,7 @@ private RestResponse<ClinicalAnalysis> update() throws Exception {
clinicalAnalysisUpdateParams = new ClinicalAnalysisUpdateParams();
RestResponse<ClinicalAnalysis> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(clinicalAnalysisUpdateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalyses}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisUpdateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -1241,7 +1242,7 @@ private RestResponse<Interpretation> createInterpretation() throws Exception {
interpretationCreateParams = new InterpretationCreateParams();
RestResponse<Interpretation> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(interpretationCreateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/create"));
return res;
} else if (commandOptions.jsonFile != null) {
interpretationCreateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down Expand Up @@ -1331,7 +1332,7 @@ private RestResponse<Interpretation> updateInterpretation() throws Exception {
interpretationUpdateParams = new InterpretationUpdateParams();
RestResponse<Interpretation> res = new RestResponse<>();
res.setType(QueryType.VOID);
PrintUtils.println(getObjectAsJSON(interpretationUpdateParams));
PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/{interpretation}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
interpretationUpdateParams = JacksonUtils.getDefaultObjectMapper()
Expand Down
Loading

0 comments on commit e4962c8

Please sign in to comment.