Skip to content

Commit 3c4ef58

Browse files
author
chedim
committed
Removes author, adds some comments
1 parent 67fdab6 commit 3c4ef58

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

src/main/java/trycb/ExampleApplication.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import org.springframework.context.annotation.Bean;
66
import org.springframework.web.filter.ForwardedHeaderFilter;
77

8+
/**
9+
* This example application demonstrates using
10+
* Spring Data with Couchbase.
11+
**/
812
@SpringBootApplication
913
public class ExampleApplication {
1014

src/main/java/trycb/config/CouchbaseConfiguration.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
import org.springframework.context.annotation.Configuration;
1111
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration;
1212

13-
/**
14-
* @author : chedim (chedim@couchbaser)
15-
* @file : CouchbaseConfiguration
16-
* @created : Wednesday Mar 16, 2022 20:36:15 EDT
17-
*/
18-
1913
@Configuration
2014
public class CouchbaseConfiguration extends AbstractCouchbaseConfiguration {
2115
public static final String PROFILE_COLLECTION = "profile";
@@ -44,6 +38,7 @@ public String getBucketName() {
4438
public Bucket getCouchbaseBucket(Cluster cluster) throws Exception {
4539
// verify that bucket exists
4640
if (!cluster.buckets().getAllBuckets().containsKey(getBucketName())) {
41+
// create the bucket if it doesn't
4742
cluster.buckets().createBucket(
4843
BucketSettings.create(getBucketName())
4944
.bucketType(BucketType.COUCHBASE)

src/main/java/trycb/controller/IndexController.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
package trycb.controller;
2-
/**
3-
* @author : chedim (chedim@couchbaser)
4-
* @file : IndexController
5-
* @created : Friday Mar 18, 2022 09:54:39 EDT
6-
*/
72

83
import org.springframework.http.HttpHeaders;
94
import org.springframework.http.HttpStatus;
@@ -15,6 +10,7 @@
1510
public class IndexController {
1611
@GetMapping("/")
1712
public ResponseEntity<Void> index() {
13+
// Redirecting to swagger-ui home page
1814
HttpHeaders headers = new HttpHeaders();
1915
headers.add("Location", "/swagger-ui/index.html");
2016
return new ResponseEntity<Void>(headers, HttpStatus.FOUND);

src/main/java/trycb/controller/ProfileController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public ResponseEntity<List<Profile>> listProfiles(
3737
List<Profile> result;
3838

3939
if (query == null || query.length() != 0) {
40+
// Couchbase repoitories support request pagination via PageRequest
4041
PageRequest pageRequest = PageRequest.of(page, pageSize);
4142
result = profileRepository.findAll(pageRequest).toList();
4243
} else {

src/main/java/trycb/repository/ProfileRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
@Repository
1515
public interface ProfileRepository extends PagingAndSortingRepository<Profile, UUID> {
16+
// Repository method that executes a custom SQL++ query
1617
@Query("#{#n1ql.selectEntity} WHERE firstName LIKE '%' || $1 || '%' OR lastName LIKE '%' || $1 || '%' OR address LIKE '%' || $1 || '%' OFFSET $2 * $3 LIMIT $3")
1718
List<Profile> findByText(String query, int pageNum, int pageSize);
1819

0 commit comments

Comments
 (0)