Skip to content

Commit

Permalink
ID Improvement - Get
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioppires committed Feb 14, 2022
1 parent 3e025da commit 9badb45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.UUID;

@Repository
public interface AvisualizerRepository extends MongoRepository<AvisualizerEntity, UUID> {
public interface AvisualizerRepository extends MongoRepository<AvisualizerEntity, String> {

@Query("{ 'hash' : ?0 }")
List<AvisualizerEntity> findByHash(String hash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String returnSV(String projectID) throws URISyntaxException, IOException
if(StringUtils.isEmpty(projectID)){
return returnFileSV(SV_DEFAULT);
}
Optional<AvisualizerEntity> response= this.repository.findById(UUID.fromString(projectID));
Optional<AvisualizerEntity> response= this.repository.findById(projectID);
if(response.isPresent()){
return response.get().getSv();
}
Expand All @@ -103,7 +103,7 @@ public String returnCV(String projectID) throws URISyntaxException, IOException
if(StringUtils.isEmpty(projectID)){
return returnFileSV(SV_DEFAULT);
}
Optional<AvisualizerEntity> response= this.repository.findById(UUID.fromString(projectID));
Optional<AvisualizerEntity> response= this.repository.findById(projectID);
if(response.isPresent()){
return response.get().getCv();
}
Expand All @@ -114,7 +114,7 @@ public String returnPV(String projectID) throws URISyntaxException, IOException
if(StringUtils.isEmpty(projectID)){
return returnFileSV(SV_DEFAULT);
}
Optional<AvisualizerEntity> response= this.repository.findById(UUID.fromString(projectID));
Optional<AvisualizerEntity> response= this.repository.findById(projectID);
if(response.isPresent()){
return response.get().getPv();
}
Expand Down Expand Up @@ -145,21 +145,14 @@ public AvisualizerEntity saveModel(AvisualizerModel model){
return this.repository.save(entity);
}

public AvisualizerEntity getAllInformation(String projectUUID) throws URISyntaxException, IOException {
Optional<AvisualizerEntity> response = this.repository.findById(UUID.fromString(projectUUID));
public AvisualizerEntity getAllInformation(String projectID) {
Optional<AvisualizerEntity> response = this.repository.findById(projectID);
if(response.isPresent()){
return response.get();
}
return new AvisualizerEntity();
}

private Long processProjectID(Long projectID){
if(Objects.isNull(projectID)){
return -1L;
}
return projectID;
}

public void saveError(ErrorModel model){
ErrorEntity entity = new ErrorEntity();

Expand Down

0 comments on commit 9badb45

Please sign in to comment.