This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit f8d1c60eefb988af123ce2b6e49328d54d790920
Author: Benoit TELLIER <[email protected]>
AuthorDate: Fri Nov 10 10:56:36 2023 +0100

    JAMES-2586 Drop unused class: JPASubscription
---
 .../postgres/user/model/JPASubscription.java       | 136 ---------------------
 .../james/mailbox/postgres/JPAMailboxFixture.java  |   3 -
 .../postgres/src/test/resources/persistence.xml    |   1 -
 .../src/main/resources/META-INF/persistence.xml    |   1 -
 4 files changed, 141 deletions(-)

diff --git 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/user/model/JPASubscription.java
 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/user/model/JPASubscription.java
deleted file mode 100644
index 3873871cfa..0000000000
--- 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/user/model/JPASubscription.java
+++ /dev/null
@@ -1,136 +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.james.mailbox.postgres.user.model;
-
-import java.util.Objects;
-
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-
-import org.apache.james.core.Username;
-import org.apache.james.mailbox.store.user.model.Subscription;
-
-/**
- * A subscription to a mailbox by a user.
- */
-@Entity(name = "Subscription")
-@Table(
-    name = "JAMES_SUBSCRIPTION",
-    uniqueConstraints = 
-        @UniqueConstraint(
-                columnNames = {
-                        "USER_NAME", 
-                        "MAILBOX_NAME"})
-)
-@NamedQueries({
-    @NamedQuery(name = JPASubscription.FIND_MAILBOX_SUBSCRIPTION_FOR_USER,
-        query = "SELECT subscription FROM Subscription subscription WHERE 
subscription.username = :userParam AND subscription.mailbox = :mailboxParam"),  
        
-    @NamedQuery(name = JPASubscription.FIND_SUBSCRIPTIONS_FOR_USER,
-        query = "SELECT subscription FROM Subscription subscription WHERE 
subscription.username = :userParam"),
-    @NamedQuery(name = JPASubscription.DELETE_SUBSCRIPTION,
-        query = "DELETE subscription FROM Subscription subscription WHERE 
subscription.username = :userParam AND subscription.mailbox = :mailboxParam")
-})
-public class JPASubscription {
-    public static final String DELETE_SUBSCRIPTION = "deleteSubscription";
-    public static final String FIND_SUBSCRIPTIONS_FOR_USER = 
"findSubscriptionsForUser";
-    public static final String FIND_MAILBOX_SUBSCRIPTION_FOR_USER = 
"findFindMailboxSubscriptionForUser";
-
-    private static final String TO_STRING_SEPARATOR = "  ";
-
-    /** Primary key */
-    @GeneratedValue
-    @Id 
-    @Column(name = "SUBSCRIPTION_ID")
-    private long id;
-    
-    /** Name of the subscribed user */
-    @Basic(optional = false)
-    @Column(name = "USER_NAME", nullable = false, length = 100)
-    private String username;
-    
-    /** Subscribed mailbox */
-    @Basic(optional = false) 
-    @Column(name = "MAILBOX_NAME", nullable = false, length = 100)
-    private String mailbox;
-    
-    /**
-     * Used by JPA
-     */
-    @Deprecated
-    public JPASubscription() {
-
-    }
-    
-    /**
-     * Constructs a user subscription.
-     */
-    public JPASubscription(Subscription subscription) {
-        super();
-        this.username = subscription.getUser().asString();
-        this.mailbox = subscription.getMailbox();
-    }
-
-    public String getMailbox() {
-        return mailbox;
-    }
-
-    public Username getUser() {
-        return Username.of(username);
-    }
-
-    public Subscription toSubscription() {
-        return new Subscription(Username.of(username), mailbox);
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof JPASubscription) {
-            JPASubscription that = (JPASubscription) o;
-
-            return Objects.equals(this.id, that.id);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(id);
-    }
-
-    /**
-     * Renders output suitable for debugging.
-     *
-     * @return output suitable for debugging
-     */
-    public String toString() {
-        return "Subscription ( "
-            + "id = " + this.id + TO_STRING_SEPARATOR
-            + "user = " + this.username + TO_STRING_SEPARATOR
-            + "mailbox = " + this.mailbox + TO_STRING_SEPARATOR
-            + " )";
-    }
-    
-}
diff --git 
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JPAMailboxFixture.java
 
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JPAMailboxFixture.java
index 3262f4ec7c..c254cc88d8 100644
--- 
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JPAMailboxFixture.java
+++ 
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JPAMailboxFixture.java
@@ -35,7 +35,6 @@ import 
org.apache.james.mailbox.postgres.quota.model.MaxGlobalMessageCount;
 import org.apache.james.mailbox.postgres.quota.model.MaxGlobalStorage;
 import org.apache.james.mailbox.postgres.quota.model.MaxUserMessageCount;
 import org.apache.james.mailbox.postgres.quota.model.MaxUserStorage;
-import org.apache.james.mailbox.postgres.user.model.JPASubscription;
 
 import com.google.common.collect.ImmutableList;
 
@@ -48,7 +47,6 @@ public interface JPAMailboxFixture {
         JPAProperty.class,
         JPAUserFlag.class,
         JPAMailboxAnnotation.class,
-        JPASubscription.class,
         JPAAttachment.class
     );
 
@@ -68,7 +66,6 @@ public interface JPAMailboxFixture {
         "JAMES_MAILBOX_ANNOTATION",
         "JAMES_MAILBOX",
         "JAMES_MAIL",
-        "JAMES_SUBSCRIPTION",
         "JAMES_ATTACHMENT");
 
     List<String> QUOTA_TABLES_NAMES = ImmutableList.of(
diff --git a/mailbox/postgres/src/test/resources/persistence.xml 
b/mailbox/postgres/src/test/resources/persistence.xml
index 31f7a7a761..83201af526 100644
--- a/mailbox/postgres/src/test/resources/persistence.xml
+++ b/mailbox/postgres/src/test/resources/persistence.xml
@@ -30,7 +30,6 @@
         
<class>org.apache.james.mailbox.postgres.mail.model.openjpa.JPAMailboxMessage</class>
         
<class>org.apache.james.mailbox.postgres.mail.model.JPAAttachment</class>
         <class>org.apache.james.mailbox.postgres.mail.model.JPAProperty</class>
-        
<class>org.apache.james.mailbox.postgres.user.model.JPASubscription</class>
         
<class>org.apache.james.mailbox.postgres.quota.model.MaxDomainMessageCount</class>
         
<class>org.apache.james.mailbox.postgres.quota.model.MaxDomainStorage</class>
         
<class>org.apache.james.mailbox.postgres.quota.model.MaxGlobalMessageCount</class>
diff --git 
a/server/apps/postgres-app/src/main/resources/META-INF/persistence.xml 
b/server/apps/postgres-app/src/main/resources/META-INF/persistence.xml
index bd9ae808b6..d9e49513f3 100644
--- a/server/apps/postgres-app/src/main/resources/META-INF/persistence.xml
+++ b/server/apps/postgres-app/src/main/resources/META-INF/persistence.xml
@@ -29,7 +29,6 @@
         
<class>org.apache.james.mailbox.postgres.mail.model.openjpa.AbstractJPAMailboxMessage</class>
         
<class>org.apache.james.mailbox.postgres.mail.model.openjpa.JPAMailboxMessage</class>
         <class>org.apache.james.mailbox.postgres.mail.model.JPAProperty</class>
-        
<class>org.apache.james.mailbox.postgres.user.model.JPASubscription</class>
 
         <class>org.apache.james.domainlist.jpa.model.JPADomain</class>
         <class>org.apache.james.mailrepository.jpa.model.JPAUrl</class>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to