Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 93D46200AC8 for ; Mon, 23 May 2016 16:42:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 92E15160A05; Mon, 23 May 2016 14:42:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E8DC7160A0E for ; Mon, 23 May 2016 16:42:37 +0200 (CEST) Received: (qmail 12728 invoked by uid 500); 23 May 2016 14:42:37 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 12675 invoked by uid 99); 23 May 2016 14:42:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2016 14:42:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D2E41DFDEF; Mon, 23 May 2016 14:42:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: skolbachev@apache.org To: commits@cayenne.apache.org Date: Mon, 23 May 2016 14:42:37 -0000 Message-Id: <4b28fb61423844dcb06ecc2c0063866c@git.apache.org> In-Reply-To: <60111bfad75b486cb9789851fb95d5da@git.apache.org> References: <60111bfad75b486cb9789851fb95d5da@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] cayenne git commit: cleanup Protostuff module archived-at: Mon, 23 May 2016 14:42:39 -0000 cleanup Protostuff module Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/0c26497d Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/0c26497d Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/0c26497d Branch: refs/heads/master Commit: 0c26497d120ad13dc5bef81f0653621dc85b675b Parents: 7783be1 Author: Savva Kolbachev Authored: Mon May 2 17:23:21 2016 +0300 Committer: Savva Kolbachev Committed: Mon May 23 17:23:08 2016 +0300 ---------------------------------------------------------------------- cayenne-protostuff/pom.xml | 17 +- .../rop/client/ProtostuffClientModule.java | 32 -- .../rop/client/ProtostuffModule.java | 44 +++ .../ProtostuffROPSerializationService.java | 7 +- .../ProtostuffROPSerializationServiceIT.java | 4 +- .../protostuff/persistent/ClientMtTable1.java | 20 +- .../protostuff/persistent/ClientMtTable2.java | 20 +- .../rop/protostuff/persistent/MtTable1.java | 14 +- .../rop/protostuff/persistent/MtTable2.java | 14 +- .../persistent/auto/_ClientMtTable1.java | 382 +++++++++---------- .../persistent/auto/_ClientMtTable2.java | 126 +++--- .../protostuff/persistent/auto/_MtTable1.java | 154 ++++---- .../protostuff/persistent/auto/_MtTable2.java | 68 ++-- .../cayenne/rop/ROPSerializationService.java | 5 + 14 files changed, 462 insertions(+), 445 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/pom.xml ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/pom.xml b/cayenne-protostuff/pom.xml index a26baab..76af8a4 100644 --- a/cayenne-protostuff/pom.xml +++ b/cayenne-protostuff/pom.xml @@ -38,11 +38,6 @@ io.protostuff - protostuff-api - ${protostuff.version} - - - io.protostuff protostuff-collectionschema ${protostuff.version} @@ -52,7 +47,7 @@ org.apache.cayenne - cayenne-client + cayenne-server ${project.version} @@ -66,14 +61,16 @@ io.protostuff - protostuff-api - - - io.protostuff protostuff-collectionschema + org.apache.cayenne + cayenne-client + ${project.version} + test + + junit junit test http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffClientModule.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffClientModule.java b/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffClientModule.java deleted file mode 100644 index 80b81f5..0000000 --- a/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffClientModule.java +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ -package org.apache.cayenne.configuration.rop.client; - -import org.apache.cayenne.di.Binder; -import org.apache.cayenne.di.Module; -import org.apache.cayenne.rop.ROPSerializationService; -import org.apache.cayenne.rop.protostuff.ProtostuffROPSerializationServiceProvider; - -public class ProtostuffClientModule implements Module { - - @Override - public void configure(Binder binder) { - binder.bind(ROPSerializationService.class).toProvider(ProtostuffROPSerializationServiceProvider.class); - } -} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffModule.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffModule.java b/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffModule.java new file mode 100644 index 0000000..b4a89e5 --- /dev/null +++ b/cayenne-protostuff/src/main/java/org/apache/cayenne/configuration/rop/client/ProtostuffModule.java @@ -0,0 +1,44 @@ +/***************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ****************************************************************/ +package org.apache.cayenne.configuration.rop.client; + +import org.apache.cayenne.di.Binder; +import org.apache.cayenne.di.Module; +import org.apache.cayenne.rop.ROPSerializationService; +import org.apache.cayenne.rop.protostuff.ProtostuffROPSerializationServiceProvider; + +/** + * A DI module that uses Protostuff Object Graph Serialization as Cayenne {@link ROPSerializationService}. + * + * + * Note the you usually have to add -Dprotostuff.runtime.collection_schema_on_repeated_fields=true as VM option + * because Cayenne objects might have cyclic collection fields. + * + * @since 4.0 + */ +public class ProtostuffModule implements Module { + + public ProtostuffModule() { + } + + @Override + public void configure(Binder binder) { + binder.bind(ROPSerializationService.class).toProvider(ProtostuffROPSerializationServiceProvider.class); + } +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/main/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationService.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/main/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationService.java b/cayenne-protostuff/src/main/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationService.java index 599b9c0..39cdbc9 100644 --- a/cayenne-protostuff/src/main/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationService.java +++ b/cayenne-protostuff/src/main/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationService.java @@ -28,6 +28,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +/** + * This {@link ROPSerializationService} implementation uses Protostuff {@link GraphIOUtil} to (de)serialize + * Cayenne object graph. + */ public class ProtostuffROPSerializationService implements ROPSerializationService { @Override @@ -57,11 +61,10 @@ public class ProtostuffROPSerializationService implements ROPSerializationServic Wrapper result = schema.newMessage(); GraphIOUtil.mergeFrom(serializedObject, result, schema); return objectClass.cast(result.data); - } private class Wrapper { - public Object data; + private Object data; public Wrapper(Object data) { this.data = data; http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationServiceIT.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationServiceIT.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationServiceIT.java index d2c73bb..b077056 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationServiceIT.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/ProtostuffROPSerializationServiceIT.java @@ -21,7 +21,7 @@ package org.apache.cayenne.rop.protostuff; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.configuration.rop.client.ClientLocalRuntime; import org.apache.cayenne.configuration.rop.client.ClientRuntime; -import org.apache.cayenne.configuration.rop.client.ProtostuffClientModule; +import org.apache.cayenne.configuration.rop.client.ProtostuffModule; import org.apache.cayenne.configuration.server.ServerRuntime; import org.apache.cayenne.rop.ROPSerializationService; import org.apache.cayenne.rop.protostuff.persistent.ClientMtTable1; @@ -60,7 +60,7 @@ public class ProtostuffROPSerializationServiceIT { ClientRuntime clientRuntime = new ClientLocalRuntime( new ServerRuntime("cayenne-protostuff.xml").getInjector(), Collections.emptyMap(), - new ProtostuffClientModule()); + new ProtostuffModule()); ObjectContext context = clientRuntime.newContext(); http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable1.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable1.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable1.java index 6b7853b..7a07d5f 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable1.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable1.java @@ -1,12 +1,12 @@ package org.apache.cayenne.rop.protostuff.persistent; -import org.apache.cayenne.rop.protostuff.persistent.auto._ClientMtTable1; - -/** - * A persistent class mapped as "MtTable1" Cayenne entity. - */ -public class ClientMtTable1 extends _ClientMtTable1 { - - private static final long serialVersionUID = 1L; - -} +import org.apache.cayenne.rop.protostuff.persistent.auto._ClientMtTable1; + +/** + * A persistent class mapped as "MtTable1" Cayenne entity. + */ +public class ClientMtTable1 extends _ClientMtTable1 { + + private static final long serialVersionUID = 1L; + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable2.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable2.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable2.java index 15d1119..c17b1c1 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable2.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/ClientMtTable2.java @@ -1,12 +1,12 @@ package org.apache.cayenne.rop.protostuff.persistent; -import org.apache.cayenne.rop.protostuff.persistent.auto._ClientMtTable2; - -/** - * A persistent class mapped as "MtTable2" Cayenne entity. - */ -public class ClientMtTable2 extends _ClientMtTable2 { - - private static final long serialVersionUID = 1L; - -} +import org.apache.cayenne.rop.protostuff.persistent.auto._ClientMtTable2; + +/** + * A persistent class mapped as "MtTable2" Cayenne entity. + */ +public class ClientMtTable2 extends _ClientMtTable2 { + + private static final long serialVersionUID = 1L; + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable1.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable1.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable1.java index 21b1f3f..db169a2 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable1.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable1.java @@ -1,9 +1,9 @@ package org.apache.cayenne.rop.protostuff.persistent; -import org.apache.cayenne.rop.protostuff.persistent.auto._MtTable1; - -public class MtTable1 extends _MtTable1 { - - private static final long serialVersionUID = 1L; - -} +import org.apache.cayenne.rop.protostuff.persistent.auto._MtTable1; + +public class MtTable1 extends _MtTable1 { + + private static final long serialVersionUID = 1L; + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable2.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable2.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable2.java index 7f3888f..aa23626 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable2.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/MtTable2.java @@ -1,9 +1,9 @@ package org.apache.cayenne.rop.protostuff.persistent; -import org.apache.cayenne.rop.protostuff.persistent.auto._MtTable2; - -public class MtTable2 extends _MtTable2 { - - private static final long serialVersionUID = 1L; - -} +import org.apache.cayenne.rop.protostuff.persistent.auto._MtTable2; + +public class MtTable2 extends _MtTable2 { + + private static final long serialVersionUID = 1L; + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java index 74febc7..150cb0e 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java @@ -1,191 +1,191 @@ -package org.apache.cayenne.rop.protostuff.persistent.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.Property; -import org.apache.cayenne.rop.protostuff.persistent.ClientMtTable2; -import org.apache.cayenne.util.PersistentObjectList; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Date; -import java.util.List; - -/** - * A generated persistent class mapped as "MtTable1" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable1 extends PersistentObject { - - public static final Property DATE_ATTRIBUTE = new Property("dateAttribute"); - public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); - public static final Property OLD_DATE_ATTRIBUTE = new Property("oldDateAttribute"); - public static final Property SERVER_ATTRIBUTE = new Property("serverAttribute"); - public static final Property TIME_ATTRIBUTE = new Property("timeAttribute"); - public static final Property TIMESTAMP_ATTRIBUTE = new Property("timestampAttribute"); - public static final Property> TABLE2ARRAY = new Property>("table2Array"); - - protected LocalDate dateAttribute; - protected String globalAttribute; - protected Date oldDateAttribute; - protected String serverAttribute; - protected LocalTime timeAttribute; - protected LocalDateTime timestampAttribute; - protected List table2Array; - - public LocalDate getDateAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "dateAttribute", false); - } - - return dateAttribute; - } - public void setDateAttribute(LocalDate dateAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "dateAttribute", false); - } - - Object oldValue = this.dateAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "dateAttribute", oldValue, dateAttribute); - } - - this.dateAttribute = dateAttribute; - } - - public String getGlobalAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - } - - return globalAttribute; - } - public void setGlobalAttribute(String globalAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - } - - Object oldValue = this.globalAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute); - } - - this.globalAttribute = globalAttribute; - } - - public Date getOldDateAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "oldDateAttribute", false); - } - - return oldDateAttribute; - } - public void setOldDateAttribute(Date oldDateAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "oldDateAttribute", false); - } - - Object oldValue = this.oldDateAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "oldDateAttribute", oldValue, oldDateAttribute); - } - - this.oldDateAttribute = oldDateAttribute; - } - - public String getServerAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "serverAttribute", false); - } - - return serverAttribute; - } - public void setServerAttribute(String serverAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "serverAttribute", false); - } - - Object oldValue = this.serverAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "serverAttribute", oldValue, serverAttribute); - } - - this.serverAttribute = serverAttribute; - } - - public LocalTime getTimeAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "timeAttribute", false); - } - - return timeAttribute; - } - public void setTimeAttribute(LocalTime timeAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "timeAttribute", false); - } - - Object oldValue = this.timeAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "timeAttribute", oldValue, timeAttribute); - } - - this.timeAttribute = timeAttribute; - } - - public LocalDateTime getTimestampAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "timestampAttribute", false); - } - - return timestampAttribute; - } - public void setTimestampAttribute(LocalDateTime timestampAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "timestampAttribute", false); - } - - Object oldValue = this.timestampAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "timestampAttribute", oldValue, timestampAttribute); - } - - this.timestampAttribute = timestampAttribute; - } - - public List getTable2Array() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList(this, "table2Array"); - } - - return table2Array; - } - public void addToTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList(this, "table2Array"); - } - - this.table2Array.add(object); - } - public void removeFromTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList(this, "table2Array"); - } - - this.table2Array.remove(object); - } - -} +package org.apache.cayenne.rop.protostuff.persistent.auto; + +import org.apache.cayenne.PersistentObject; +import org.apache.cayenne.exp.Property; +import org.apache.cayenne.rop.protostuff.persistent.ClientMtTable2; +import org.apache.cayenne.util.PersistentObjectList; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; +import java.util.List; + +/** + * A generated persistent class mapped as "MtTable1" Cayenne entity. It is a good idea to + * avoid changing this class manually, since it will be overwritten next time code is + * regenerated. If you need to make any customizations, put them in a subclass. + */ +public abstract class _ClientMtTable1 extends PersistentObject { + + public static final Property DATE_ATTRIBUTE = new Property("dateAttribute"); + public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); + public static final Property OLD_DATE_ATTRIBUTE = new Property("oldDateAttribute"); + public static final Property SERVER_ATTRIBUTE = new Property("serverAttribute"); + public static final Property TIME_ATTRIBUTE = new Property("timeAttribute"); + public static final Property TIMESTAMP_ATTRIBUTE = new Property("timestampAttribute"); + public static final Property> TABLE2ARRAY = new Property>("table2Array"); + + protected LocalDate dateAttribute; + protected String globalAttribute; + protected Date oldDateAttribute; + protected String serverAttribute; + protected LocalTime timeAttribute; + protected LocalDateTime timestampAttribute; + protected List table2Array; + + public LocalDate getDateAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "dateAttribute", false); + } + + return dateAttribute; + } + public void setDateAttribute(LocalDate dateAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "dateAttribute", false); + } + + Object oldValue = this.dateAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "dateAttribute", oldValue, dateAttribute); + } + + this.dateAttribute = dateAttribute; + } + + public String getGlobalAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "globalAttribute", false); + } + + return globalAttribute; + } + public void setGlobalAttribute(String globalAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "globalAttribute", false); + } + + Object oldValue = this.globalAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute); + } + + this.globalAttribute = globalAttribute; + } + + public Date getOldDateAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "oldDateAttribute", false); + } + + return oldDateAttribute; + } + public void setOldDateAttribute(Date oldDateAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "oldDateAttribute", false); + } + + Object oldValue = this.oldDateAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "oldDateAttribute", oldValue, oldDateAttribute); + } + + this.oldDateAttribute = oldDateAttribute; + } + + public String getServerAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "serverAttribute", false); + } + + return serverAttribute; + } + public void setServerAttribute(String serverAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "serverAttribute", false); + } + + Object oldValue = this.serverAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "serverAttribute", oldValue, serverAttribute); + } + + this.serverAttribute = serverAttribute; + } + + public LocalTime getTimeAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "timeAttribute", false); + } + + return timeAttribute; + } + public void setTimeAttribute(LocalTime timeAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "timeAttribute", false); + } + + Object oldValue = this.timeAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "timeAttribute", oldValue, timeAttribute); + } + + this.timeAttribute = timeAttribute; + } + + public LocalDateTime getTimestampAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "timestampAttribute", false); + } + + return timestampAttribute; + } + public void setTimestampAttribute(LocalDateTime timestampAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "timestampAttribute", false); + } + + Object oldValue = this.timestampAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "timestampAttribute", oldValue, timestampAttribute); + } + + this.timestampAttribute = timestampAttribute; + } + + public List getTable2Array() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "table2Array", true); + } else if (this.table2Array == null) { + this.table2Array = new PersistentObjectList(this, "table2Array"); + } + + return table2Array; + } + public void addToTable2Array(ClientMtTable2 object) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "table2Array", true); + } else if (this.table2Array == null) { + this.table2Array = new PersistentObjectList(this, "table2Array"); + } + + this.table2Array.add(object); + } + public void removeFromTable2Array(ClientMtTable2 object) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "table2Array", true); + } else if (this.table2Array == null) { + this.table2Array = new PersistentObjectList(this, "table2Array"); + } + + this.table2Array.remove(object); + } + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java index 2faf6ef..b4432a1 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java @@ -4,66 +4,66 @@ import org.apache.cayenne.PersistentObject; import org.apache.cayenne.ValueHolder; import org.apache.cayenne.exp.Property; import org.apache.cayenne.rop.protostuff.persistent.ClientMtTable1; -import org.apache.cayenne.util.PersistentObjectHolder; - -/** - * A generated persistent class mapped as "MtTable2" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable2 extends PersistentObject { - - public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); - public static final Property TABLE1 = new Property("table1"); - - protected String globalAttribute; - protected ValueHolder table1; - - public String getGlobalAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - } - - return globalAttribute; - } - public void setGlobalAttribute(String globalAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - } - - Object oldValue = this.globalAttribute; - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute); - } - - this.globalAttribute = globalAttribute; - } - - public ClientMtTable1 getTable1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table1", true); - } else if (this.table1 == null) { - this.table1 = new PersistentObjectHolder(this, "table1"); - } - - return (ClientMtTable1) table1.getValue(); - } - public void setTable1(ClientMtTable1 table1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table1", true); - } else if (this.table1 == null) { - this.table1 = new PersistentObjectHolder(this, "table1"); - } - - // note how we notify ObjectContext of change BEFORE the object is actually - // changed... this is needed to take a valid current snapshot - Object oldValue = this.table1.getValueDirectly(); - if (objectContext != null) { - objectContext.propertyChanged(this, "table1", oldValue, table1); - } - - this.table1.setValue(table1); - } - -} +import org.apache.cayenne.util.PersistentObjectHolder; + +/** + * A generated persistent class mapped as "MtTable2" Cayenne entity. It is a good idea to + * avoid changing this class manually, since it will be overwritten next time code is + * regenerated. If you need to make any customizations, put them in a subclass. + */ +public abstract class _ClientMtTable2 extends PersistentObject { + + public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); + public static final Property TABLE1 = new Property("table1"); + + protected String globalAttribute; + protected ValueHolder table1; + + public String getGlobalAttribute() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "globalAttribute", false); + } + + return globalAttribute; + } + public void setGlobalAttribute(String globalAttribute) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "globalAttribute", false); + } + + Object oldValue = this.globalAttribute; + // notify objectContext about simple property change + if(objectContext != null) { + objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute); + } + + this.globalAttribute = globalAttribute; + } + + public ClientMtTable1 getTable1() { + if(objectContext != null) { + objectContext.prepareForAccess(this, "table1", true); + } else if (this.table1 == null) { + this.table1 = new PersistentObjectHolder(this, "table1"); + } + + return (ClientMtTable1) table1.getValue(); + } + public void setTable1(ClientMtTable1 table1) { + if(objectContext != null) { + objectContext.prepareForAccess(this, "table1", true); + } else if (this.table1 == null) { + this.table1 = new PersistentObjectHolder(this, "table1"); + } + + // note how we notify ObjectContext of change BEFORE the object is actually + // changed... this is needed to take a valid current snapshot + Object oldValue = this.table1.getValueDirectly(); + if (objectContext != null) { + objectContext.propertyChanged(this, "table1", oldValue, table1); + } + + this.table1.setValue(table1); + } + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java index 0eb33bd..edc4630 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java @@ -8,80 +8,80 @@ import java.util.List; import org.apache.cayenne.CayenneDataObject; import org.apache.cayenne.exp.Property; -import org.apache.cayenne.rop.protostuff.persistent.MtTable2; - -/** - * Class _MtTable1 was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _MtTable1 extends CayenneDataObject { - - private static final long serialVersionUID = 1L; - - public static final String TABLE1_ID_PK_COLUMN = "TABLE1_ID"; - - public static final Property DATE_ATTRIBUTE = new Property("dateAttribute"); - public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); - public static final Property OLD_DATE_ATTRIBUTE = new Property("oldDateAttribute"); - public static final Property SERVER_ATTRIBUTE = new Property("serverAttribute"); - public static final Property TIME_ATTRIBUTE = new Property("timeAttribute"); - public static final Property TIMESTAMP_ATTRIBUTE = new Property("timestampAttribute"); - public static final Property> TABLE2ARRAY = new Property>("table2Array"); - - public void setDateAttribute(LocalDate dateAttribute) { - writeProperty("dateAttribute", dateAttribute); - } - public LocalDate getDateAttribute() { - return (LocalDate)readProperty("dateAttribute"); - } - - public void setGlobalAttribute(String globalAttribute) { - writeProperty("globalAttribute", globalAttribute); - } - public String getGlobalAttribute() { - return (String)readProperty("globalAttribute"); - } - - public void setOldDateAttribute(Date oldDateAttribute) { - writeProperty("oldDateAttribute", oldDateAttribute); - } - public Date getOldDateAttribute() { - return (Date)readProperty("oldDateAttribute"); - } - - public void setServerAttribute(String serverAttribute) { - writeProperty("serverAttribute", serverAttribute); - } - public String getServerAttribute() { - return (String)readProperty("serverAttribute"); - } - - public void setTimeAttribute(LocalTime timeAttribute) { - writeProperty("timeAttribute", timeAttribute); - } - public LocalTime getTimeAttribute() { - return (LocalTime)readProperty("timeAttribute"); - } - - public void setTimestampAttribute(LocalDateTime timestampAttribute) { - writeProperty("timestampAttribute", timestampAttribute); - } - public LocalDateTime getTimestampAttribute() { - return (LocalDateTime)readProperty("timestampAttribute"); - } - - public void addToTable2Array(MtTable2 obj) { - addToManyTarget("table2Array", obj, true); - } - public void removeFromTable2Array(MtTable2 obj) { - removeToManyTarget("table2Array", obj, true); - } - @SuppressWarnings("unchecked") - public List getTable2Array() { - return (List)readProperty("table2Array"); - } - - -} +import org.apache.cayenne.rop.protostuff.persistent.MtTable2; + +/** + * Class _MtTable1 was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MtTable1 extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String TABLE1_ID_PK_COLUMN = "TABLE1_ID"; + + public static final Property DATE_ATTRIBUTE = new Property("dateAttribute"); + public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); + public static final Property OLD_DATE_ATTRIBUTE = new Property("oldDateAttribute"); + public static final Property SERVER_ATTRIBUTE = new Property("serverAttribute"); + public static final Property TIME_ATTRIBUTE = new Property("timeAttribute"); + public static final Property TIMESTAMP_ATTRIBUTE = new Property("timestampAttribute"); + public static final Property> TABLE2ARRAY = new Property>("table2Array"); + + public void setDateAttribute(LocalDate dateAttribute) { + writeProperty("dateAttribute", dateAttribute); + } + public LocalDate getDateAttribute() { + return (LocalDate)readProperty("dateAttribute"); + } + + public void setGlobalAttribute(String globalAttribute) { + writeProperty("globalAttribute", globalAttribute); + } + public String getGlobalAttribute() { + return (String)readProperty("globalAttribute"); + } + + public void setOldDateAttribute(Date oldDateAttribute) { + writeProperty("oldDateAttribute", oldDateAttribute); + } + public Date getOldDateAttribute() { + return (Date)readProperty("oldDateAttribute"); + } + + public void setServerAttribute(String serverAttribute) { + writeProperty("serverAttribute", serverAttribute); + } + public String getServerAttribute() { + return (String)readProperty("serverAttribute"); + } + + public void setTimeAttribute(LocalTime timeAttribute) { + writeProperty("timeAttribute", timeAttribute); + } + public LocalTime getTimeAttribute() { + return (LocalTime)readProperty("timeAttribute"); + } + + public void setTimestampAttribute(LocalDateTime timestampAttribute) { + writeProperty("timestampAttribute", timestampAttribute); + } + public LocalDateTime getTimestampAttribute() { + return (LocalDateTime)readProperty("timestampAttribute"); + } + + public void addToTable2Array(MtTable2 obj) { + addToManyTarget("table2Array", obj, true); + } + public void removeFromTable2Array(MtTable2 obj) { + removeToManyTarget("table2Array", obj, true); + } + @SuppressWarnings("unchecked") + public List getTable2Array() { + return (List)readProperty("table2Array"); + } + + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java ---------------------------------------------------------------------- diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java index 682e272..db226a8 100644 --- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java +++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java @@ -2,37 +2,37 @@ package org.apache.cayenne.rop.protostuff.persistent.auto; import org.apache.cayenne.CayenneDataObject; import org.apache.cayenne.exp.Property; -import org.apache.cayenne.rop.protostuff.persistent.MtTable1; - -/** - * Class _MtTable2 was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _MtTable2 extends CayenneDataObject { - - private static final long serialVersionUID = 1L; - - public static final String TABLE2_ID_PK_COLUMN = "TABLE2_ID"; - - public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); - public static final Property TABLE1 = new Property("table1"); - - public void setGlobalAttribute(String globalAttribute) { - writeProperty("globalAttribute", globalAttribute); - } - public String getGlobalAttribute() { - return (String)readProperty("globalAttribute"); - } - - public void setTable1(MtTable1 table1) { - setToOneTarget("table1", table1, true); - } - - public MtTable1 getTable1() { - return (MtTable1)readProperty("table1"); - } - - -} +import org.apache.cayenne.rop.protostuff.persistent.MtTable1; + +/** + * Class _MtTable2 was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _MtTable2 extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String TABLE2_ID_PK_COLUMN = "TABLE2_ID"; + + public static final Property GLOBAL_ATTRIBUTE = new Property("globalAttribute"); + public static final Property TABLE1 = new Property("table1"); + + public void setGlobalAttribute(String globalAttribute) { + writeProperty("globalAttribute", globalAttribute); + } + public String getGlobalAttribute() { + return (String)readProperty("globalAttribute"); + } + + public void setTable1(MtTable1 table1) { + setToOneTarget("table1", table1, true); + } + + public MtTable1 getTable1() { + return (MtTable1)readProperty("table1"); + } + + +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/0c26497d/cayenne-server/src/main/java/org/apache/cayenne/rop/ROPSerializationService.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/main/java/org/apache/cayenne/rop/ROPSerializationService.java b/cayenne-server/src/main/java/org/apache/cayenne/rop/ROPSerializationService.java index 486b0e9..99cccbf 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/rop/ROPSerializationService.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/rop/ROPSerializationService.java @@ -22,6 +22,11 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +/** + * ROP serialization service + * + * @since 4.0 + */ public interface ROPSerializationService { byte[] serialize(Object object) throws IOException;