-
Notifications
You must be signed in to change notification settings - Fork 72
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 #548 from eclipse/feature/recursion-issue-custom-r…
…epository Feature/recursion issue custom repository
- Loading branch information
Showing
6 changed files
with
192 additions
and
4 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
81 changes: 81 additions & 0 deletions
81
...semistructured/src/test/java/org/eclipse/jnosql/mapping/semistructured/entities/Task.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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Maximillian Arruda | ||
*/ | ||
package org.eclipse.jnosql.mapping.semistructured.entities; | ||
|
||
import jakarta.nosql.Column; | ||
import jakarta.nosql.Entity; | ||
import jakarta.nosql.Id; | ||
|
||
import java.util.Objects; | ||
|
||
@Entity | ||
public class Task { | ||
|
||
public static TaskBuilder builder() { | ||
return new TaskBuilder(); | ||
} | ||
|
||
@Id | ||
private String id; | ||
|
||
@Column | ||
private String description; | ||
|
||
@Column | ||
private boolean active; | ||
|
||
Task(){ | ||
} | ||
|
||
Task(String id, String description, boolean active) { | ||
this.id = id; | ||
this.description = description; | ||
this.active = active; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public boolean isActive() { | ||
return active; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Task task = (Task) o; | ||
return active == task.active && Objects.equals(id, task.id) && Objects.equals(description, task.description); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, description, active); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Task{" + | ||
"id='" + id + '\'' + | ||
", description='" + description + '\'' + | ||
", active=" + active + | ||
'}'; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...uctured/src/test/java/org/eclipse/jnosql/mapping/semistructured/entities/TaskBuilder.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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Maximillian Arruda | ||
*/ | ||
package org.eclipse.jnosql.mapping.semistructured.entities; | ||
|
||
public class TaskBuilder { | ||
|
||
private String id; | ||
private String description; | ||
private boolean active = true; | ||
|
||
public TaskBuilder id(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public TaskBuilder description(String description) { | ||
this.description = description; | ||
return this; | ||
} | ||
|
||
public TaskBuilder active(boolean active) { | ||
this.active = active; | ||
return this; | ||
} | ||
|
||
public Task build() { | ||
return new Task(id, description, active); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
...g-semistructured/src/test/java/org/eclipse/jnosql/mapping/semistructured/query/Tasks.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Maximillian Arruda | ||
*/ | ||
package org.eclipse.jnosql.mapping.semistructured.query; | ||
|
||
import jakarta.data.repository.Query; | ||
import jakarta.data.repository.Repository; | ||
import org.eclipse.jnosql.mapping.semistructured.entities.Task; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface Tasks { | ||
|
||
@Query("from Task where active = true") | ||
List<Task> listActiveTasks(); | ||
|
||
} |