]> git.mxchange.org Git - jcustomer-lib.git/blob - src/org/mxchange/jcustomercore/model/customer/AdminCustomerSessionBeanRemote.java
26a24ec1d846579a89462b28358a9b438c0198b6
[jcustomer-lib.git] / src / org / mxchange / jcustomercore / model / customer / AdminCustomerSessionBeanRemote.java
1 /*
2  * Copyright (C) 2016, 2017 Free Software Foundation
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcustomercore.model.customer;
18
19 import java.io.Serializable;
20 import java.util.List;
21 import javax.ejb.Remote;
22 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
23 import org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException;
24
25 /**
26  * Administrative interface for customer beans
27  * <p>
28  * @author Roland Häder<roland@mxchange.org>
29  */
30 @Remote
31 public interface AdminCustomerSessionBeanRemote extends Serializable {
32
33         /**
34          * Links customer instance with included contact instance and returns an
35          * updated customer instance after success.
36          * <p>
37          * @param customer Customer with included contact insrtance
38          * <p>
39          * @return Updated customer instance
40          * <p>
41          * @throws
42          * org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException
43          * If the customer is already there
44          */
45         Customer linkCustomer (final Customer customer) throws CustomerAlreadyRegisteredException;
46
47         /**
48          * Returns a list of all customers. This method should be used from
49          * administrative beans.
50          * <p>
51          * @return A list of all customers
52          */
53         List<Customer> allCustomers ();
54
55         /**
56          * Adds the given customer instance to database and returns an updated
57          * instance.
58          * <p>
59          * @param customer Customer instance
60          * <p>
61          * @return Updated customer
62          * <p>
63          * @throws
64          * org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException
65          * If the customer is already registered.
66          * @throws org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException If
67          * the given contact data is already added.
68          */
69         Customer addCustomer (final Customer customer) throws CustomerAlreadyRegisteredException, ContactAlreadyAddedException;
70
71         /**
72          * Creates a new (free) customer number.
73          * <p>
74          * @return Free customer number (no free number should not happen)
75          */
76         String createCustomerNumber ();
77
78 }