Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify handling of readViewDocuments with all sorted views (fixes #463) #467

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
import java.util.stream.StreamSupport;
import java.util.zip.GZIPInputStream;

import org.eclipse.jnosql.mapping.reflection.ClassMapping;
import org.eclipse.jnosql.mapping.reflection.FieldMapping;

import jakarta.nosql.mapping.Column;
import lotus.domino.Database;
import lotus.domino.DateRange;
import lotus.domino.DateTime;
Expand Down Expand Up @@ -105,6 +101,8 @@ public static Object toDominoFriendly(Session session, Object value) throws Note
Instant inst = Instant.from((TemporalAccessor)value);
DateTime dt = session.createDateTime(Date.from(inst));
return dt;
} else if(value == null) {
return null;
} else {
// TODO support other types above
return value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ public ViewNavigatorIterator(ViewNavigator nav, boolean docsOnly, boolean didSki
this.nav = nav;
this.docsOnly = docsOnly;
this.didSkip = didSkip;
this.manualDocumentScan = didKey && nav.getParentView().isCategorized();

// Initially, it seemed like manual scanning was only necessary when looking
// for documents when having searched by key in a categorized view. However,
// it turns out that this is also sometimes needed when looking up by key
// with even a single sorted column, so always do a manual scan when keying.
this.manualDocumentScan = didKey;
}

@Override
Expand Down
11 changes: 11 additions & 0 deletions eclipse/nsfs/nsf-jakartaee-example/odp/Code/Java/model/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public class Person {

@Column("Age")
private Integer age;

@Column("Email")
@MvcBinding @FormParam("email")
private String email;

public String getUnid() {
return unid;
Expand Down Expand Up @@ -233,4 +237,11 @@ public Integer getAge() {
public void setAge(Integer age) {
this.age = age;
}

public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ public String createPerson(
@FormParam("birthday") String birthday,
@FormParam("favoriteTime") String favoriteTime,
@FormParam("added") String added,
@FormParam("customProperty") String customProperty
@FormParam("customProperty") String customProperty,
@FormParam("email") String email
) throws Exception {
transaction.begin();
try {
Person person = new Person();
composePerson(person, firstName, lastName, birthday, favoriteTime, added, customProperty);
person.setEmail(email);

personRepository.save(person);
transaction.commit();
Expand Down Expand Up @@ -621,6 +623,40 @@ public List<ViewInfo> listViews() {
return personRepository.getViewInfo().collect(Collectors.toList());
}

/**
* @see <a href="https://github.com/OpenNTF/org.openntf.xsp.jakartaee/issues/463">Issue #463</a>
*/
@Path("queryByEmail")
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Person> queryByEmail(@QueryParam("q") @NotEmpty String searchValue) {
ViewQuery query = ViewQuery.query().key(searchValue, true);
return personRepository.readViewDocuments("PersonEmail", -1, false, query, null, null).collect(Collectors.toList());
}

/**
* @see <a href="https://github.com/OpenNTF/org.openntf.xsp.jakartaee/issues/463">Issue #463</a>
*/
@Path("queryByEmailOneKey")
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Person> queryByEmailOneKey(@QueryParam("q") @NotEmpty String searchValue, @QueryParam("resort") boolean resort) {
ViewQuery query = ViewQuery.query().key(searchValue, true);
Sorts sorts = resort ? Sorts.sorts().asc("email") : null;
return personRepository.readViewDocuments("PersonEmailOneKey", -1, false, query, sorts, null).collect(Collectors.toList());
}

/**
* @see <a href="https://github.com/OpenNTF/org.openntf.xsp.jakartaee/issues/463">Issue #463</a>
*/
@Path("queryByEmailEntries")
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Person> queryByEmailEntries(@QueryParam("q") @NotEmpty String searchValue) {
ViewQuery query = ViewQuery.query().key(searchValue, true);
return personRepository.readViewEntries("PersonEmail", -1, false, query, null, null).collect(Collectors.toList());
}

private void composePerson(Person person, String firstName, String lastName, String birthday, String favoriteTime, String added, String customProperty) {
person.setFirstName(firstName);
person.setLastName(lastName);
Expand Down
45 changes: 26 additions & 19 deletions eclipse/nsfs/nsf-jakartaee-example/odp/Forms/Person.form
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ AAAAAAAAAAA=
<item name="Body" placeholder="true">
<rawitemdata type="0"/>
</item>
<item name="Email" placeholder="true">
<rawitemdata type="0"/>
</item>
<item name="$Fields">
<textlist>
<text>Email</text>
<text>Body</text>
<text>CustomProperty</text>
<text>Readers</text>
Expand All @@ -62,30 +66,33 @@ AAAAAAACAQAACgAAAAAAAAAACQAAAAAARmlyc3ROYW1lAGIOAQCEAAAAAAAAAAAA3gYAAIr/hf8I
AAEAAAqBAoMEAQCF/xMAAQAACkxhc3QgTmFtZTogAN0GAACK//7/UAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAHgAeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAiv8sAIoAAAUAMAIAAAAAAAACAQAACgAAAAAAAAAACAAAAAAATGFzdE5hbWViDgEAhAAAAAAA
AAAAAN4GAACK/4X/CAABAAAKgQKDBAEAhf8SAAEAAApCaXJ0aGRheTog3QYAAPf/9/8kAAEAAIAA
AKAFaAEAAAAAAAAAAGQAAAAAAAAAAAAAAAAA/v9UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAeAB4AAAAAAAACIACAAAAAAABAgICAQEBAQcEAAAAAAAAAAAAAAAAAAAgLy86sP8U
AAAAAACAAAAAAAAAAAAAAACK/ywAigAABAAwAgAAAAAAAAABAAAKAAAAAAAAAAAIAAAAAABCaXJ0
aGRhedIIAQAAAAAA0ggJAP///wDeBgAA9/+F/wgAAQAACoECgwQBAIX/CAABAAAKgQK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fL7/IAAAAAUAAACdAQAABQAAAAAAAABfQ29weXQOAM58vv8wAAAABQAAAJ0BAAAW
AABDX3V0DQC+fL7/IAAAAAUAAACdAQAABQAAAAAAAABfQ29weQAOAM58vv8wAAAABQAAAJ0BAAAW
AAAAAAAAAENvcHkgYXMgRG9jdW1lbnQgX0xpbmsPAN58vv8oAAAABQAAAJ0BAAAOAAAAAAAAAENv
cHkgYXMgX1RhYmxlEADufL7/IAAAAAUAAACdAQAABgAAAAAAAABQX2FzdGURAP58vv8gAAAABQAA
AJ0BAAAFAAAAAAAAAF9PcGVuABIADn2+/yIAAAAFAAAAnQEAAAgAAAAAAAAAQm9va21hcmsTAB59
AJ0BAAAFAAAAAAAAAF9PcGVuZRIADn2+/yIAAAAFAAAAnQEAAAgAAAAAAAAAQm9va21hcmsTAB59
</rawitemdata>
</item>
</note>
41 changes: 41 additions & 0 deletions eclipse/nsfs/nsf-jakartaee-example/odp/Views/PersonEmail.view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<note class="view" xmlns="http://www.lotus.com/dxl">
<item name="$FormulaClass" sign="true">
<text>1</text>
</item>
<item name="$TITLE" sign="true">
<text>PersonEmail</text>
</item>
<item name="$Index" sign="true">
<text/>
</item>
<item name="$Formula" sign="true" summary="true">
<formula compiled="true">
ZAAFADYAMQAFAAUACQAIAAkABABFbWFpbEZpcnN0TmFtZUxhc3ROYW1lJENvbmZsaWN0JFJFRgAE
AAQAAAAaAAUABABGb3JtAQAGAFBlcnNvbgoCAwAHAA4ACAAJTDFTMlMzUw==
</formula>
</item>
<item name="$Collation" summary="true">
<rawitemdata type="2">
MQADAABEAGYAAAAFAABmAAUACQAAZgAOAAgARW1haWxGaXJzdE5hbWVMYXN0TmFtZQ==
</rawitemdata>
</item>
<item name="$ViewFormat" sign="true" summary="true">
<rawitemdata type="5">
AQADAAAACAAAAFZDAQAFAAUAAAAAAFAAAQEACgAAAAAAAAAAAAICAAAAVkMBAAkACQAAAAAAUAAB
AAAKAAAAAAAAAAAAAgIAAABWQwEACAAIAAAAAABQAAEAAAoAAAAAAAAAAAACAgAAAEVtYWlsRW1h
aWxGaXJzdE5hbWVGaXJzdE5hbWVMYXN0TmFtZUxhc3ROYW1lJgABAAAAAQEACQEAAAoBAQAKAAAB
AK0rAQABAAEAAAAAAAAAAABXQwEBAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAAAAAAAAA
AAAAAAAAV0MBAQAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAFdDAQEA
CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAABCAAAAAAABAP///wAFAP//
/wABAAAAAAAAAAAAAAAAAAEA////AAEA////AAAAAQAAAAAAAQAAAAAAAQAAAAAAAAAIAAAAAAAB
AA==
</rawitemdata>
</item>
<item name="$Comment" sign="true">
<text/>
</item>
<item name="$Flags">
<text>PY</text>
</item>
</note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<note class="view" xmlns="http://www.lotus.com/dxl">
<item name="$FormulaClass" sign="true">
<text>1</text>
</item>
<item name="$TITLE" sign="true">
<text>PersonEmailOneKey</text>
</item>
<item name="$Index" sign="true">
<text/>
</item>
<item name="$Formula" sign="true" summary="true">
<formula compiled="true">
ZAAFADYAMQAFAAUACQAIAAkABABFbWFpbEZpcnN0TmFtZUxhc3ROYW1lJENvbmZsaWN0JFJFRgAE
AAQAAAAaAAUABABGb3JtAQAGAFBlcnNvbgoCAwAHAA4ACAAJTDFTMlMzUw==
</formula>
</item>
<item name="$Collation" summary="true">
<rawitemdata type="2">
EgABAABEAGYAAAAFAEVtYWls
</rawitemdata>
</item>
<item name="$Collation1" summary="true">
<rawitemdata type="2">
IgACAABEAGYAAAAFAABmAAUACQBFbWFpbEZpcnN0TmFtZQ==
</rawitemdata>
</item>
<item name="$ViewFormat" sign="true" summary="true">
<rawitemdata type="5">
AQADAAAACAAAAFZDAREFAAUAAAAAAFAAAQEACgAAAAAAAAAAAAICAAAAVkMAAAkACQAAAAAAUAAB
AAAKAAAAAAAAAAAAAgIAAABWQwAACAAIAAAAAABQAAEAAAoAAAAAAAAAAAACAgAAAEVtYWlsRW1h
aWxGaXJzdE5hbWVGaXJzdE5hbWVMYXN0TmFtZUxhc3ROYW1lJgABAAAAAQEACQEAAAoBAQAKAAAB
AK0rAQABAAEAAAAAAAAAAABXQwEBAAkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAD//wAAAAAAAAAA
AAAAAAAAV0MBAQAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAFdDAQEA
CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAABCAAAAAAABAP///wAFAP//
/wABAAAAAAAAAAAAAAAAAAEA////AAEA////AAAAAQAAAAAAAQAAAAAAAQAAAAAAAAAIAAAAAAAB
AA==
</rawitemdata>
</item>
<item name="$Comment" sign="true">
<text/>
</item>
<item name="$Flags">
<text>PY</text>
</item>
</note>
Loading