Skip to content

Commit 8a5643b

Browse files
author
Sravan Kottam
committed
Merge remote-tracking branch 'origin/dev' into dev
local copy
2 parents 43f317d + 7a298e8 commit 8a5643b

File tree

7 files changed

+658
-598
lines changed

7 files changed

+658
-598
lines changed

pom.xml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,37 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.marklogic</groupId>
5-
<artifactId>client-api-java</artifactId>
5+
<artifactId>java-client-api</artifactId>
66
<packaging>jar</packaging>
7-
<version>3.0-SNAPSHOT</version>
8-
<name>client-api-java</name>
9-
<url>http://developer.marklogic.com</url>
7+
<version>3.0.1</version>
8+
<name>MarkLogic Java Client API</name>
9+
<description>The official MarkLogic Java client API.</description>
10+
<url>https://github.com/marklogic/java-client-api</url>
11+
<licenses>
12+
<license>
13+
<name>The Apache License, Version 2.0</name>
14+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
15+
</license>
16+
</licenses>
17+
<developers>
18+
<developer>
19+
<name>MarkLogic</name>
20+
<email>java-sig@marklogic.com</email>
21+
<organization>MarkLogic</organization>
22+
<organizationUrl>https://www.marklogic.com</organizationUrl>
23+
</developer>
24+
<developer>
25+
<name>MarkLogic Github Contributors</name>
26+
<email>general@developer.marklogic.com</email>
27+
<organization>Github Contributors</organization>
28+
<organizationUrl>https://github.com/marklogic/java-client-api/graphs/contributors</organizationUrl>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:git@github.com:marklogic/java-client-api.git</connection>
33+
<developerConnection>scm:git:git@github.com:marklogic/java-client-api.git</developerConnection>
34+
<url>git@github.com:marklogic/java-client-api.git</url>
35+
</scm>
1036
<properties>
1137
<javadoc-title>${project.name} ${project.version} ${maven.build.timestamp}</javadoc-title>
1238
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>

src/main/java/com/marklogic/client/pojo/PojoRepository.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
* serialized and deserialized, but cannot be written, read, or searched directly. If you
7676
* wish to directly write, read, or search another class, create a new instance of
7777
* PojoRepository specific to that class.
78+
*
79+
* Since PojoRepository stores in JSON format, which limits number precision to 15
80+
* significant digits (IEEE754 double precision), you will lose precision on numbers
81+
* longer than 15 significant digits. If you desire larger numbers with no loss of
82+
* precision, use Strings to persist those numbers.
7883
*/
7984
public interface PojoRepository<T, ID extends Serializable> {
8085
/** Write this instance to the database. Uses the field marked with {@literal @}Id
@@ -249,7 +254,7 @@ public T read(ID id, Transaction transaction)
249254
public PojoPage<T> read(ID[] ids)
250255
throws ForbiddenUserException, FailedRequestException;
251256
/** Within an open transaction,
252-
* read one page of persisted pojos and unmarshall their data into new pojo instances.
257+
* read multiple persisted pojos and unmarshall their data into new pojo instances.
253258
* If at least one instance is found but others are not, ignores the instances not found.
254259
* While this returns a PojoPage, the PageSize will match the number of instances found,
255260
* and will ignore getPageLength(). To paginate, send a smaller set of ids at a time.
@@ -258,9 +263,9 @@ public PojoPage<T> read(ID[] ids)
258263
* @param transaction the transaction in which this read is participating
259264
* (will open a read lock on each document matched that is released when the
260265
* transaction is committed or rolled back)
261-
* @return a page of instances of the correct type populated with the persisted data.
262-
* Since this call may match a large set, only one page of {@link #getPageLength()}
263-
* is returned just like calls to {@link #search(PojoQueryDefinition, long) search}
266+
* @return a set of instances of the correct type populated with the persisted data.
267+
* Since this call produces a finite set, only one page is returned and therefore
268+
* PojoPage pagination methods will not be helpful as they would be from calls to search.
264269
*/
265270
public PojoPage<T> read(ID[] ids, Transaction transaction)
266271
throws ForbiddenUserException, FailedRequestException;

src/test/java/com/marklogic/client/test/BitemporalTest.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
import com.marklogic.client.query.StructuredQueryDefinition;
4242

4343
public class BitemporalTest {
44-
// bootstrap.xqy sets up the "temporal-collection" and required underlying axes
44+
// src/test/resources/bootstrap.xqy is run by src/test/resources/boot-test.sh
45+
// and sets up the "temporal-collection" and required underlying axes
4546
// system-axis and valid-axis which have required underlying range indexes
4647
// system-start, system-end, valid-start, and valid-end
4748
static String temporalCollection = "temporal-collection";
@@ -66,29 +67,29 @@ public void test1() throws Exception {
6667
uniqueTerm + " version1" +
6768
"<system-start></system-start>" +
6869
"<system-end></system-end>" +
69-
"<valid-start>2014-08-19T00:00:00</valid-start>" +
70-
"<valid-end>2014-08-19T00:00:01</valid-end>" +
70+
"<valid-start>2014-08-19T00:00:00Z</valid-start>" +
71+
"<valid-end>2014-08-19T00:00:01Z</valid-end>" +
7172
"</test>";
7273
String version2 = "<test>" +
7374
uniqueTerm + " version2" +
7475
"<system-start></system-start>" +
7576
"<system-end></system-end>" +
76-
"<valid-start>2014-08-19T00:00:02</valid-start>" +
77-
"<valid-end>2014-08-19T00:00:03</valid-end>" +
77+
"<valid-start>2014-08-19T00:00:02Z</valid-start>" +
78+
"<valid-end>2014-08-19T00:00:03Z</valid-end>" +
7879
"</test>";
7980
String version3 = "<test>" +
8081
uniqueTerm + " version3" +
8182
"<system-start></system-start>" +
8283
"<system-end></system-end>" +
83-
"<valid-start>2014-08-19T00:00:03</valid-start>" +
84-
"<valid-end>2014-08-19T00:00:04</valid-end>" +
84+
"<valid-start>2014-08-19T00:00:03Z</valid-start>" +
85+
"<valid-end>2014-08-19T00:00:04Z</valid-end>" +
8586
"</test>";
8687
String version4 = "<test>" +
8788
uniqueTerm + " version4" +
8889
"<system-start></system-start>" +
8990
"<system-end></system-end>" +
90-
"<valid-start>2014-08-19T00:00:05</valid-start>" +
91-
"<valid-end>2014-08-19T00:00:06</valid-end>" +
91+
"<valid-start>2014-08-19T00:00:05Z</valid-start>" +
92+
"<valid-end>2014-08-19T00:00:06Z</valid-end>" +
9293
"</test>";
9394
XMLDocumentManager docMgr = Common.client.newXMLDocumentManager();
9495
StringHandle handle1 = new StringHandle(version1).withFormat(Format.XML);
@@ -112,24 +113,26 @@ public void test1() throws Exception {
112113
DocumentPage termQueryResults = docMgr.search(termQuery, start);
113114
assertEquals("Wrong number of results", 4, termQueryResults.size());
114115

115-
// sleep for 2 seconds
116+
// temporal-collection is configured to automatically advance lsqt every 1 second
117+
// so we'll sleep for 2 seconds to make sure lsqt has advanced beyond the lsqt
118+
// when we inserted our documents
116119
Thread.sleep(2000);
117120
StructuredQueryDefinition currentQuery = sqb.temporalLsqtQuery(temporalCollection, null, 1);
118121
StructuredQueryDefinition currentDocQuery = sqb.and(termQuery, currentQuery);
119122
DocumentPage currentDocQueryResults = docMgr.search(currentDocQuery, start);
120123
assertEquals("Wrong number of results", 4, currentDocQueryResults.size());
121124

122125
StructuredQueryBuilder.Axis validAxis = sqb.axis("valid-axis");
123-
Calendar start1 = DatatypeConverter.parseDateTime("2014-08-19T00:00:00");
124-
Calendar end1 = DatatypeConverter.parseDateTime("2014-08-19T00:00:04");
126+
Calendar start1 = DatatypeConverter.parseDateTime("2014-08-19T00:00:00Z");
127+
Calendar end1 = DatatypeConverter.parseDateTime("2014-08-19T00:00:04Z");
125128
StructuredQueryBuilder.Period period1 = sqb.period(start1, end1);
126129
StructuredQueryDefinition periodQuery1 = sqb.and(sqb.term(uniqueTerm),
127130
sqb.temporalPeriodRange(validAxis, TemporalOperator.ALN_CONTAINED_BY, period1));
128131
DocumentPage periodQuery1Results = docMgr.search(periodQuery1, start);
129132
assertEquals("Wrong number of results", 1, periodQuery1Results.size());
130133

131-
Calendar start2 = DatatypeConverter.parseDateTime("2014-08-19T00:00:04");
132-
Calendar end2 = DatatypeConverter.parseDateTime("2014-08-19T00:00:07");
134+
Calendar start2 = DatatypeConverter.parseDateTime("2014-08-19T00:00:04Z");
135+
Calendar end2 = DatatypeConverter.parseDateTime("2014-08-19T00:00:07Z");
133136
StructuredQueryBuilder.Period period2 = sqb.period(start2, end2);
134137
StructuredQueryDefinition periodQuery2 = sqb.and(sqb.term(uniqueTerm),
135138
sqb.temporalPeriodRange(validAxis, TemporalOperator.ALN_CONTAINED_BY, period2));

0 commit comments

Comments
 (0)