-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from icgc-argo/feature/regionProgram
Feature/regionProgram
- Loading branch information
Showing
13 changed files
with
1,717 additions
and
1,814 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 30 additions & 32 deletions
62
src/main/java/org/icgc/argo/program_service/model/dto/ProgramDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
package org.icgc.argo.program_service.model.dto; | ||
|
||
import java.util.Set; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
public class ProgramDTO { | ||
|
||
private String shortName; | ||
|
||
private String description; | ||
|
||
private String name; | ||
|
||
private String website; | ||
|
||
private Set<InstitutionDTO> programInstitutions; | ||
|
||
private Set<CountryDTO> programCountries; | ||
|
||
private Set<RegionDTO> processingRegions; | ||
|
||
private Set<CancerDTO> programCancers; | ||
|
||
private Set<PrimarySiteDTO> programPrimarySites; | ||
} | ||
package org.icgc.argo.program_service.model.dto; | ||
|
||
import java.util.Set; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
public class ProgramDTO { | ||
|
||
private String shortName; | ||
|
||
private String description; | ||
|
||
private String name; | ||
|
||
private String website; | ||
|
||
private Set<InstitutionDTO> programInstitutions; | ||
|
||
private Set<CountryDTO> programCountries; | ||
|
||
private Set<CancerDTO> programCancers; | ||
|
||
private Set<PrimarySiteDTO> programPrimarySites; | ||
} |
62 changes: 30 additions & 32 deletions
62
src/main/java/org/icgc/argo/program_service/model/dto/ProgramsDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
package org.icgc.argo.program_service.model.dto; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
public class ProgramsDTO { | ||
|
||
private String shortName; | ||
|
||
private String description; | ||
|
||
private String name; | ||
|
||
private String website; | ||
|
||
private List<String> institutions; | ||
|
||
private List<String> countries; | ||
|
||
private List<String> regions; | ||
|
||
private List<String> cancerTypes; | ||
|
||
private List<String> primarySites; | ||
} | ||
package org.icgc.argo.program_service.model.dto; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
public class ProgramsDTO { | ||
|
||
private String shortName; | ||
|
||
private String description; | ||
|
||
private String name; | ||
|
||
private String website; | ||
|
||
private List<String> institutions; | ||
|
||
private List<String> countries; | ||
|
||
private List<String> cancerTypes; | ||
|
||
private List<String> primarySites; | ||
} |
68 changes: 33 additions & 35 deletions
68
src/main/java/org/icgc/argo/program_service/model/dto/builder/ProgramDTOBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,33 @@ | ||
package org.icgc.argo.program_service.model.dto.builder; | ||
|
||
import org.icgc.argo.program_service.model.dto.ProgramDTO; | ||
import org.icgc.argo.program_service.model.entity.ProgramEntity; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ProgramDTOBuilder { | ||
|
||
@Autowired CancerDTOBuilder canerDtoBuilder; | ||
@Autowired CountryDTOBuilder countryDTOBuilder; | ||
@Autowired InstitutionDTOBuilder institutionDTOBuilder; | ||
@Autowired PrimarySiteDTOBuilder primarySiteDTOBuilder; | ||
@Autowired RegionDTOBuilder regionDTOBuilder; | ||
|
||
public ProgramDTO convertEntityToDTO(ProgramEntity programEntity) { | ||
ProgramDTO programDTO = new ProgramDTO(); | ||
programDTO.setName(programEntity.getName()); | ||
programDTO.setWebsite(programEntity.getWebsite()); | ||
programDTO.setShortName(programEntity.getShortName()); | ||
programDTO.setDescription(programEntity.getDescription()); | ||
programDTO.setProcessingRegions( | ||
regionDTOBuilder.convertEntityToDTO(programEntity.getProgramRegions())); | ||
programDTO.setProgramCancers( | ||
canerDtoBuilder.convertEntityToDTO(programEntity.getProgramCancers())); | ||
programDTO.setProgramCountries( | ||
countryDTOBuilder.convertEntityToDTO(programEntity.getProgramCountries())); | ||
programDTO.setProgramPrimarySites( | ||
primarySiteDTOBuilder.convertEntityToDTO(programEntity.getProgramPrimarySites())); | ||
programDTO.setProgramInstitutions( | ||
institutionDTOBuilder.convertEntityToDTO(programEntity.getProgramInstitutions())); | ||
return programDTO; | ||
} | ||
} | ||
package org.icgc.argo.program_service.model.dto.builder; | ||
|
||
import org.icgc.argo.program_service.model.dto.ProgramDTO; | ||
import org.icgc.argo.program_service.model.entity.ProgramEntity; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ProgramDTOBuilder { | ||
|
||
@Autowired CancerDTOBuilder canerDtoBuilder; | ||
@Autowired CountryDTOBuilder countryDTOBuilder; | ||
@Autowired InstitutionDTOBuilder institutionDTOBuilder; | ||
@Autowired PrimarySiteDTOBuilder primarySiteDTOBuilder; | ||
@Autowired RegionDTOBuilder regionDTOBuilder; | ||
|
||
public ProgramDTO convertEntityToDTO(ProgramEntity programEntity) { | ||
ProgramDTO programDTO = new ProgramDTO(); | ||
programDTO.setName(programEntity.getName()); | ||
programDTO.setWebsite(programEntity.getWebsite()); | ||
programDTO.setShortName(programEntity.getShortName()); | ||
programDTO.setDescription(programEntity.getDescription()); | ||
programDTO.setProgramCancers( | ||
canerDtoBuilder.convertEntityToDTO(programEntity.getProgramCancers())); | ||
programDTO.setProgramCountries( | ||
countryDTOBuilder.convertEntityToDTO(programEntity.getProgramCountries())); | ||
programDTO.setProgramPrimarySites( | ||
primarySiteDTOBuilder.convertEntityToDTO(programEntity.getProgramPrimarySites())); | ||
programDTO.setProgramInstitutions( | ||
institutionDTOBuilder.convertEntityToDTO(programEntity.getProgramInstitutions())); | ||
return programDTO; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 63 additions & 68 deletions
131
...in/java/org/icgc/argo/program_service/repositories/query/ProgramSpecificationBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,63 @@ | ||
/* | ||
* Copyright (c) 2020 The Ontario Institute for Cancer Research. All rights reserved | ||
* | ||
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0. | ||
* You should have received a copy of the GNU Affero General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* | ||
*/ | ||
|
||
package org.icgc.argo.program_service.repositories.query; | ||
|
||
import static javax.persistence.criteria.JoinType.LEFT; | ||
|
||
import java.util.UUID; | ||
import javax.persistence.criteria.Root; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
import org.icgc.argo.program_service.model.entity.ProgramEntity; | ||
import org.icgc.argo.program_service.model.join.*; | ||
|
||
@Setter | ||
@Accessors(chain = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
public class ProgramSpecificationBuilder extends AbstractSpecificationBuilder<ProgramEntity, UUID> { | ||
|
||
private boolean fetchCancers; | ||
private boolean fetchPrimarySites; | ||
private boolean fetchInstitutions; | ||
private boolean fetchCountries; | ||
private boolean fetchRegions; | ||
|
||
@Override | ||
protected Root<ProgramEntity> setupFetchStrategy(Root<ProgramEntity> root) { | ||
if (fetchCancers) { | ||
root.fetch(ProgramEntity.Fields.programCancers, LEFT) | ||
.fetch(ProgramCancer.Fields.cancer, LEFT); | ||
} | ||
if (fetchPrimarySites) { | ||
root.fetch(ProgramEntity.Fields.programPrimarySites, LEFT) | ||
.fetch(ProgramPrimarySite.Fields.primarySite, LEFT); | ||
} | ||
if (fetchInstitutions) { | ||
root.fetch(ProgramEntity.Fields.programInstitutions, LEFT) | ||
.fetch(ProgramInstitution.Fields.institution, LEFT); | ||
} | ||
if (fetchCountries) { | ||
root.fetch(ProgramEntity.Fields.programCountries, LEFT) | ||
.fetch(ProgramCountry.Fields.country, LEFT); | ||
} | ||
if (fetchRegions) { | ||
root.fetch(ProgramEntity.Fields.programRegions, LEFT) | ||
.fetch(ProgramRegion.Fields.region, LEFT); | ||
} | ||
return root; | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2020 The Ontario Institute for Cancer Research. All rights reserved | ||
* | ||
* This program and the accompanying materials are made available under the terms of the GNU Affero General Public License v3.0. | ||
* You should have received a copy of the GNU Affero General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* | ||
*/ | ||
|
||
package org.icgc.argo.program_service.repositories.query; | ||
|
||
import static javax.persistence.criteria.JoinType.LEFT; | ||
|
||
import java.util.UUID; | ||
import javax.persistence.criteria.Root; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
import org.icgc.argo.program_service.model.entity.ProgramEntity; | ||
import org.icgc.argo.program_service.model.join.*; | ||
|
||
@Setter | ||
@Accessors(chain = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
public class ProgramSpecificationBuilder extends AbstractSpecificationBuilder<ProgramEntity, UUID> { | ||
|
||
private boolean fetchCancers; | ||
private boolean fetchPrimarySites; | ||
private boolean fetchInstitutions; | ||
private boolean fetchCountries; | ||
|
||
@Override | ||
protected Root<ProgramEntity> setupFetchStrategy(Root<ProgramEntity> root) { | ||
if (fetchCancers) { | ||
root.fetch(ProgramEntity.Fields.programCancers, LEFT) | ||
.fetch(ProgramCancer.Fields.cancer, LEFT); | ||
} | ||
if (fetchPrimarySites) { | ||
root.fetch(ProgramEntity.Fields.programPrimarySites, LEFT) | ||
.fetch(ProgramPrimarySite.Fields.primarySite, LEFT); | ||
} | ||
if (fetchInstitutions) { | ||
root.fetch(ProgramEntity.Fields.programInstitutions, LEFT) | ||
.fetch(ProgramInstitution.Fields.institution, LEFT); | ||
} | ||
if (fetchCountries) { | ||
root.fetch(ProgramEntity.Fields.programCountries, LEFT) | ||
.fetch(ProgramCountry.Fields.country, LEFT); | ||
} | ||
return root; | ||
} | ||
} |
Oops, something went wrong.