You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/20 01:56:47 UTC
[james-project] 19/49: [Refactoring] JPAProperty should not
implement Property
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 92d346e139df717ea7e8156d7b5617a98d2752ff
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Nov 16 10:58:31 2019 +0700
[Refactoring] JPAProperty should not implement Property
---
.../james/mailbox/jpa/mail/model/JPAProperty.java | 33 +++-------------------
.../model/openjpa/AbstractJPAMailboxMessage.java | 5 +++-
2 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
index 1f07100..0eba4df 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAProperty.java
@@ -28,11 +28,12 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.james.mailbox.store.mail.model.Property;
+import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
import org.apache.openjpa.persistence.jdbc.Index;
@Entity(name = "Property")
@Table(name = "JAMES_MAIL_PROPERTY")
-public class JPAProperty implements Property {
+public class JPAProperty {
/** The system unique key */
@Id
@@ -96,34 +97,8 @@ public class JPAProperty implements Property {
this(property.getNamespace(), property.getLocalName(), property.getValue(), order);
}
- /**
- * Gets the local part of the name of the property.
- *
- * @return not null
- */
- @Override
- public String getLocalName() {
- return localName;
- }
-
- /**
- * Gets the namespace for the name.
- *
- * @return not null
- */
- @Override
- public String getNamespace() {
- return namespace;
- }
-
- /**
- * Gets the value for this property.
- *
- * @return not null
- */
- @Override
- public String getValue() {
- return value;
+ public Property toProperty() {
+ return new SimpleProperty(namespace, localName, value);
}
@Override
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
index ebf69f9..6277c72 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java
@@ -63,6 +63,7 @@ import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
import org.apache.openjpa.persistence.jdbc.ElementJoinColumns;
import org.apache.openjpa.persistence.jdbc.Index;
+import com.github.steveash.guavate.Guavate;
import com.google.common.base.Objects;
/**
@@ -356,7 +357,9 @@ public abstract class AbstractJPAMailboxMessage implements MailboxMessage {
*/
@Override
public List<Property> getProperties() {
- return new ArrayList<>(properties);
+ return properties.stream()
+ .map(JPAProperty::toProperty)
+ .collect(Guavate.toImmutableList());
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org