From afbd97b2aaae07fad3d99d525726b5386af9e11b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 23 Apr 2016 12:45:31 +0200 Subject: [PATCH] More rewrites toward jaddressbook-core/lib dependencies. Later, if project-specific methods are needed, extend the generic interface and use it everywhere. But for now, this is not needed. --- lib/jaddressbook-core.jar | Bin 0 -> 34086 bytes .../addressbook/AddressbookLoadedEvent.java | 35 --- .../addressbook/LoadedAddressbookEvent.java | 51 ---- .../sharing/AddressbookSharingEvent.java | 43 ---- .../sharing/EndedAddressbookSharingEvent.java | 58 ----- .../StartedAddressbookSharingEvent.java | 58 ----- .../events/sharing/type/SharingType.java | 36 --- .../AddressbookNameAlreadyUsedException.java | 43 ---- .../AddressbookNotFoundException.java | 43 ---- ...serAlreadySharingAddressbookException.java | 44 ---- .../jjobs/model/addressbook/Addressbook.java | 134 ---------- .../model/addressbook/UserAddressbook.java | 237 ------------------ .../addressbook/entry/AddressbookEntry.java | 107 -------- .../entry/UserAddressbookEntry.java | 178 ------------- .../addressbook/shared/AddressbookShare.java | 234 ----------------- .../shared/ShareableAddressbook.java | 106 -------- .../addressbook/status/AddressbokStatus.java | 60 ----- .../addressbook/AddressbookIdValidator.java | 10 +- 18 files changed, 5 insertions(+), 1472 deletions(-) create mode 100644 lib/jaddressbook-core.jar delete mode 100644 src/org/mxchange/jjobs/events/addressbook/AddressbookLoadedEvent.java delete mode 100644 src/org/mxchange/jjobs/events/addressbook/LoadedAddressbookEvent.java delete mode 100644 src/org/mxchange/jjobs/events/sharing/AddressbookSharingEvent.java delete mode 100644 src/org/mxchange/jjobs/events/sharing/EndedAddressbookSharingEvent.java delete mode 100644 src/org/mxchange/jjobs/events/sharing/StartedAddressbookSharingEvent.java delete mode 100644 src/org/mxchange/jjobs/events/sharing/type/SharingType.java delete mode 100644 src/org/mxchange/jjobs/exceptions/AddressbookNameAlreadyUsedException.java delete mode 100644 src/org/mxchange/jjobs/exceptions/AddressbookNotFoundException.java delete mode 100644 src/org/mxchange/jjobs/exceptions/UserAlreadySharingAddressbookException.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/Addressbook.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/UserAddressbook.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/entry/AddressbookEntry.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/entry/UserAddressbookEntry.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/shared/AddressbookShare.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/shared/ShareableAddressbook.java delete mode 100644 src/org/mxchange/jjobs/model/addressbook/status/AddressbokStatus.java diff --git a/lib/jaddressbook-core.jar b/lib/jaddressbook-core.jar new file mode 100644 index 0000000000000000000000000000000000000000..ddd1e07fb502a3bdbf20a0e79c14e4980ed2732e GIT binary patch literal 34086 zcmeHQX>c6Jb$$aZFpI^21i<@VQlyB31bFBqDUu)viXcINBtS|OO~XrINUXTnC9w;M z)O}NOWZAkcOO|Dwwjx;;b&!@KSx)S-ONrtfwo@*r;>nwo{KHkLq>_BEyJx3o zcJ{zQ%jJly9Zb)3zkYqae*L}IJ-c_7hayB_q948R@OIMvRZ)m`b@a8Z?Cjpw`ad5M z?aoI1dqiz}`qg`mBRc=4poqGrYXK<&v66`-mOO*n=y#oZ|SGwXEvDbj`|mGGmVt!_>&p*8DMQRE*)114FUoQM*9Yh5o45 z#s&vR>~#8YDs^liHBu<;vZ872>+EDET_F3_rIOINDnM>!spQf_v5|PPP#vxrE2+$> z2BnL)(AT}3%nBS5drHg|w^rDB8jU{(}?RFT^qYD zX3&*|b1J!j2Gugb)&wL{YtP|p?SYIz)5W8Bs%c_Pgd@Hf(QmW-z6x2WuO5vLZ{DPp`egW?LLUrBX%HdDq1wP^?;ouJC&b2`mX zG+Xf(vXCm8-lVc`;--w4T%~xpT9C111VzRGS&lW!JCGMWF#O09AjH2Nh)|N;aVBzY z`1Z=VJ!llyK%SZ`ThY+7AXPc4&HY+SZcxuS#H*Trf(WY4t=Q^=nqW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4G5<-d(2gkUXWx+uNDT;gwtz@PwELgDNIZ9Vp(A8(~*9^CA z#VH)UTY7qS_T#LazJ0y@&cNe%i!E3`>)}8V5KoRI3kwrO&~OQ^#ym3cJRN7wN33b> zsJaCXlHbhdoKJ-;tfkQAIb0Otlg`00L|;8ufjIG8oDl`hs!DSeT7p#k&wt`MZ)A|# z{#?Z8Q=_D$&3EFt9-og6mm6Cn@ESti(7sT|xU#I?4qYw8G31HoO)KAW4%cHEa+B;T zdI#~Ped<(yw?!F!3z!?d|X<#2Oi%3?1vR;Q9bT}?NoQtGm{PLPwVRVZ>{I6<-N z6SKA#mBatmh=bF^<@Hr(De?wYi=Y*%uMxp173w7QYH^bK6!#=`w*ZUK97~bgTreov zfJQe?kCS|};EtNh1F=b{r9*0c-JTIP@vwFZG& zgqHf$Lm`r@JtUtfm87nT7b3sXL;hE#l4q1yexcay2mV%E;~~8kZeE2eHt4$-g;?ir z7R!I!aCa7`@1D0^i0o2_s%XOxi;|UdK_QB(JQOXg=L%Ou?(9;CI)CF>{^M%6W*pSn zrI){WoWCjgo5yY*-xx<8%B)a&CgqUKW348oDETw-e-qg$%k#HiT{IKbDfQvh=I$nw zA6M;gzmV+D+W+}qH|t+Pz!xrGK-R$@bCqiWf7bpFmbzKLj)NIX%Gw#_T8Vj;hk;+9 z$o}tSy7`{LL6T$2x6tOG&NsoNH`c<+oP9+ukh|Yq*3CT$tI=3< zS5u!>a30oq2DBgbb+cZQ9Cy|tKR+}VIIR3=m7D#qPmCk`U`)no@(Ms=IF<+hZ?T9T J;!`;2{{SukW+VUr literal 0 HcmV?d00001 diff --git a/src/org/mxchange/jjobs/events/addressbook/AddressbookLoadedEvent.java b/src/org/mxchange/jjobs/events/addressbook/AddressbookLoadedEvent.java deleted file mode 100644 index 6833c2b..0000000 --- a/src/org/mxchange/jjobs/events/addressbook/AddressbookLoadedEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.addressbook; - -import java.io.Serializable; -import org.mxchange.jjobs.model.addressbook.Addressbook; - -/** - * An interface for an event if an address book has been loaded - *

- * @author Roland Haeder - */ -public interface AddressbookLoadedEvent extends Serializable { - - /** - * Getter for address book instance - *

- * @return Address book instance - */ - Addressbook getAddressbook (); -} diff --git a/src/org/mxchange/jjobs/events/addressbook/LoadedAddressbookEvent.java b/src/org/mxchange/jjobs/events/addressbook/LoadedAddressbookEvent.java deleted file mode 100644 index 765e38d..0000000 --- a/src/org/mxchange/jjobs/events/addressbook/LoadedAddressbookEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.addressbook; - -import org.mxchange.jjobs.model.addressbook.Addressbook; - -/** - * An event fired when an address book has been loaded - *

- * @author Roland Haeder - */ -public class LoadedAddressbookEvent implements AddressbookLoadedEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 1L; - - /** - * Adress book instance causing this event - */ - private final Addressbook addressbook; - - /** - * Constructor with address book instance - *

- * @param addressbook Address book instance - */ - public LoadedAddressbookEvent (final Addressbook addressbook) { - this.addressbook = addressbook; - } - - @Override - public Addressbook getAddressbook () { - return this.addressbook; - } -} diff --git a/src/org/mxchange/jjobs/events/sharing/AddressbookSharingEvent.java b/src/org/mxchange/jjobs/events/sharing/AddressbookSharingEvent.java deleted file mode 100644 index 8210fa4..0000000 --- a/src/org/mxchange/jjobs/events/sharing/AddressbookSharingEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.sharing; - -import java.io.Serializable; -import org.mxchange.jjobs.events.sharing.type.SharingType; -import org.mxchange.jjobs.model.addressbook.shared.ShareableAddressbook; - -/** - * An interface for address book sharing events - *

- * @author Roland Haeder - */ -public interface AddressbookSharingEvent extends Serializable { - - /** - * Getter for address book share instance - *

- * @return Address book share instance - */ - ShareableAddressbook getShareableAddressbook (); - - /** - * Getter for sharing type enum - *

- * @return Sharing type enum - */ - SharingType getSharingType (); -} diff --git a/src/org/mxchange/jjobs/events/sharing/EndedAddressbookSharingEvent.java b/src/org/mxchange/jjobs/events/sharing/EndedAddressbookSharingEvent.java deleted file mode 100644 index 3cc3b7f..0000000 --- a/src/org/mxchange/jjobs/events/sharing/EndedAddressbookSharingEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.sharing; - -import org.mxchange.jjobs.events.sharing.type.SharingType; -import org.mxchange.jjobs.model.addressbook.shared.ShareableAddressbook; - -/** - * An event fired when a user ends sharing address books - *

- * @author Roland Haeder - */ -public class EndedAddressbookSharingEvent implements AddressbookSharingEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 152_896_748_186_018_497L; - - /** - * Shared address book entry - */ - private final ShareableAddressbook shareableAddressbook; - - /** - * Constructor with address book share entry - *

- * @param share Address book share entry - */ - public EndedAddressbookSharingEvent (final ShareableAddressbook share) { - this.shareableAddressbook = share; - } - - @Override - public ShareableAddressbook getShareableAddressbook () { - return this.shareableAddressbook; - } - - @Override - public SharingType getSharingType () { - // Started sharing - return SharingType.ENDED; - } -} diff --git a/src/org/mxchange/jjobs/events/sharing/StartedAddressbookSharingEvent.java b/src/org/mxchange/jjobs/events/sharing/StartedAddressbookSharingEvent.java deleted file mode 100644 index abcf6c1..0000000 --- a/src/org/mxchange/jjobs/events/sharing/StartedAddressbookSharingEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.sharing; - -import org.mxchange.jjobs.events.sharing.type.SharingType; -import org.mxchange.jjobs.model.addressbook.shared.ShareableAddressbook; - -/** - * An event fired when a user starts sharing address books - *

- * @author Roland Haeder - */ -public class StartedAddressbookSharingEvent implements AddressbookSharingEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 152_896_748_186_018_497L; - - /** - * Shared address book entry - */ - private final ShareableAddressbook shareableAddressbook; - - /** - * Constructor with address book share entry - *

- * @param share Address book share entry - */ - public StartedAddressbookSharingEvent (final ShareableAddressbook share) { - this.shareableAddressbook = share; - } - - @Override - public ShareableAddressbook getShareableAddressbook () { - return this.shareableAddressbook; - } - - @Override - public SharingType getSharingType () { - // Started sharing - return SharingType.STARTED; - } -} diff --git a/src/org/mxchange/jjobs/events/sharing/type/SharingType.java b/src/org/mxchange/jjobs/events/sharing/type/SharingType.java deleted file mode 100644 index 40d4db3..0000000 --- a/src/org/mxchange/jjobs/events/sharing/type/SharingType.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.events.sharing.type; - -/** - * An enumeration for sharing types - *

- * @author Roland Haeder - */ -public enum SharingType { - - /** - * Sharing has been started - */ - STARTED, - - /** - * Sharing has been ended - */ - ENDED; - -} diff --git a/src/org/mxchange/jjobs/exceptions/AddressbookNameAlreadyUsedException.java b/src/org/mxchange/jjobs/exceptions/AddressbookNameAlreadyUsedException.java deleted file mode 100644 index 81d8844..0000000 --- a/src/org/mxchange/jjobs/exceptions/AddressbookNameAlreadyUsedException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jjobs.model.addressbook.Addressbook; - -/** - * An exception thrown when the user has already used the name. - *

- * @author Roland Haeder - */ -public class AddressbookNameAlreadyUsedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 58_169_748_928_767_381L; - - /** - * Constructor with address book instance - *

- * @param addressbook Address book instance - */ - public AddressbookNameAlreadyUsedException (final Addressbook addressbook) { - super(MessageFormat.format("User {0} has already used the name {1}.", addressbook.getAddressbookUser(), addressbook.getAddressbookName())); //NOI18N - } - -} diff --git a/src/org/mxchange/jjobs/exceptions/AddressbookNotFoundException.java b/src/org/mxchange/jjobs/exceptions/AddressbookNotFoundException.java deleted file mode 100644 index 8325e28..0000000 --- a/src/org/mxchange/jjobs/exceptions/AddressbookNotFoundException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.exceptions; - -import java.text.MessageFormat; - -/** - * An exception thrown when the address book's id number is not valid, so no - * address book can be found. - *

- * @author Roland Haeder - */ -public class AddressbookNotFoundException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_986_976_417_658_920L; - - /** - * Creates an exception with given id number that could not be found. - *

- * @param addressbookId Address book id number - */ - public AddressbookNotFoundException (final Long addressbookId) { - super(MessageFormat.format("Address book with id number {0} does not exist.", addressbookId)); - } - -} diff --git a/src/org/mxchange/jjobs/exceptions/UserAlreadySharingAddressbookException.java b/src/org/mxchange/jjobs/exceptions/UserAlreadySharingAddressbookException.java deleted file mode 100644 index b57ffb2..0000000 --- a/src/org/mxchange/jjobs/exceptions/UserAlreadySharingAddressbookException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jjobs.model.addressbook.Addressbook; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown whent the address book is already shared with given user - *

- * @author Roland Haeder - */ -public class UserAlreadySharingAddressbookException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 58_528_177_571_976_034L; - - /** - * Constructor with address book being already shared with sharee - *

- * @param addressbook Address book instance - * @param sharee User instance the address book is being shared with - */ - public UserAlreadySharingAddressbookException (final Addressbook addressbook, final User sharee) { - super(MessageFormat.format("Address book id {0} owned by user {1} is already shared with user {2}", addressbook.getAddressbookId(), addressbook.getAddressbookUser().getUserId(), sharee.getUserId())); - } -} diff --git a/src/org/mxchange/jjobs/model/addressbook/Addressbook.java b/src/org/mxchange/jjobs/model/addressbook/Addressbook.java deleted file mode 100644 index 61eafbb..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/Addressbook.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jjobs.model.addressbook.status.AddressbokStatus; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for addressbooks - *

- * @author Roland Haeder - */ -public interface Addressbook extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getAddressbookId (); - - /** - * Setter for id number - *

- * @param addressbookId Id number - */ - void setAddressbookId (final Long addressbookId); - - /** - * Getter for addressbook creation timestamp - *

- * @return Addressbook creation timestamp - */ - Calendar getAddressbookCreated (); - - /** - * Setter for addressbook creation timestamp - *

- * @param addressbookCreated Addressbook creation timestamp - */ - void setAddressbookCreated (final Calendar addressbookCreated); - - /** - * Getter for addressbook's name - *

- * @return Addressbook's name - */ - String getAddressbookName (); - - /** - * Setter for addressbook's name - *

- * @param addressbookName Addressbook's name - */ - void setAddressbookName (final String addressbookName); - - /** - * Getter for addressbook status - *

- * @return Addressbook status - */ - AddressbokStatus getAddressbookStatus (); - - /** - * Setter for addressbook status - *

- * @param addressbookStatus Addressbook status - */ - void setAddressbookStatus (final AddressbokStatus addressbookStatus); - - /** - * Getter for addressbook's user (owner) - *

- * @return Addressbook's user (owner) - */ - User getAddressbookUser (); - - /** - * Setter for addressbook's user (owner) - *

- * @param addressbookUser Addressbook's user (owner) - */ - void setAddressbookUser (final User addressbookUser); - - /** - * Getter for last locked timestamp - *

- * @return Last locked timestamp - */ - Calendar getAddressbookLastLocked (); - - /** - * Setter for last locked timestamp - *

- * @param addressbookLastLocked Last locked timestamp - */ - void setAddressbookLastLocked (final Calendar addressbookLastLocked); - - /** - * Getter for last locked reason - *

- * @return Last locked reason - */ - String getAddressbookLastLockedReason (); - - /** - * Getter for last locked reason - *

- * @param addressbookLastLockedReason Last locked reason - */ - void setAddressbookLastLockedReason (final String addressbookLastLockedReason); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jjobs/model/addressbook/UserAddressbook.java b/src/org/mxchange/jjobs/model/addressbook/UserAddressbook.java deleted file mode 100644 index 272dcac..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/UserAddressbook.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import org.mxchange.jjobs.model.addressbook.status.AddressbokStatus; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for user addressbooks - *

- * @author Roland Haeder - */ -@Entity (name = "addressbooks") -@Table (name = "addressbooks") -@NamedQueries ( - { - @NamedQuery (name = "AllUsersAddressbooks", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookUser = :param ORDER BY a.addressbookId ASC"), - @NamedQuery (name = "SearchUserAddressbookName", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookUser = :user AND LOWER(a.addressbookName) LIKE LOWER(:name)"), - @NamedQuery (name = "SearchAddressbookById", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookId = :id") - } -) -public class UserAddressbook implements Addressbook { - - /** - * Serial number - */ - private static final long serialVersionUID = 176_573_148_678_169L; - - /** - * When this address book has been created - */ - @Basic (optional = false) - @Temporal (value = TemporalType.TIMESTAMP) - @Column (name = "addressbook_created", nullable = false, updatable = false) - private Calendar addressbookCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "addressbook_id", nullable = false, updatable = false) - private Long addressbookId; - - /** - * Last locked timestamp - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "addressbook_last_locked") - private Calendar addressbookLastLocked; - - /** - * Last locked timestamp - */ - @Lob - @Column (name = "addressbook_last_locked_reason") - private String addressbookLastLockedReason; - - /** - * Name for this address book - */ - @Basic (optional = false) - @Column (name = "addressbook_name", length = 50, nullable = false) - private String addressbookName; - - /** - * Adress book status - */ - @Basic (optional = false) - @Enumerated (EnumType.STRING) - @Column (name = "addressbook_status", nullable = false, length = 10) - private AddressbokStatus addressbookStatus; - - /** - * Connection to "users" table - */ - @JoinColumn (name = "addressbook_user_id", nullable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User addressbookUser; - - /** - * Public constructor with address book name - *

- * @param addressbookName Address book name - * @param addressbookUser User instance - * @param addressbookCreated When this entry has been created - */ - public UserAddressbook (final String addressbookName, final User addressbookUser, final Calendar addressbookCreated) { - // Call default constructor - this(); - - // Set name, user instance and creation timestamp - this.addressbookName = addressbookName; - this.addressbookUser = addressbookUser; - this.addressbookCreated = addressbookCreated; - } - - /** - * Default constructor - */ - public UserAddressbook () { - // Set status to UNLOCKED - this.addressbookStatus = AddressbokStatus.UNLOCKED; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Addressbook other = (Addressbook) object; - - if (!Objects.equals(this.getAddressbookName(), other.getAddressbookName())) { - return false; - } else if (!Objects.equals(this.getAddressbookUser(), other.getAddressbookUser())) { - return false; - } - - return true; - } - - @Override - public int hashCode () { - int hash = 7; - hash = 59 * hash + Objects.hashCode(this.getAddressbookName()); - hash = 59 * hash + Objects.hashCode(this.getAddressbookUser()); - return hash; - } - - @Override - public Calendar getAddressbookCreated () { - return this.addressbookCreated; - } - - @Override - public void setAddressbookCreated (final Calendar addressbookCreated) { - this.addressbookCreated = addressbookCreated; - } - - @Override - public Long getAddressbookId () { - return this.addressbookId; - } - - @Override - public void setAddressbookId (final Long addressbookId) { - this.addressbookId = addressbookId; - } - - @Override - public Calendar getAddressbookLastLocked () { - return this.addressbookLastLocked; - } - - @Override - public void setAddressbookLastLocked (final Calendar addressbookLastLocked) { - this.addressbookLastLocked = addressbookLastLocked; - } - - @Override - public String getAddressbookLastLockedReason () { - return this.addressbookLastLockedReason; - } - - @Override - public void setAddressbookLastLockedReason (final String addressbookLastLockedReason) { - this.addressbookLastLockedReason = addressbookLastLockedReason; - } - - @Override - public String getAddressbookName () { - return this.addressbookName; - } - - @Override - public void setAddressbookName (final String addressbookName) { - this.addressbookName = addressbookName; - } - - @Override - public AddressbokStatus getAddressbookStatus () { - return this.addressbookStatus; - } - - @Override - public void setAddressbookStatus (final AddressbokStatus addressbookStatus) { - this.addressbookStatus = addressbookStatus; - } - - @Override - public User getAddressbookUser () { - return this.addressbookUser; - } - - @Override - public void setAddressbookUser (final User addressbookUser) { - this.addressbookUser = addressbookUser; - } - -} diff --git a/src/org/mxchange/jjobs/model/addressbook/entry/AddressbookEntry.java b/src/org/mxchange/jjobs/model/addressbook/entry/AddressbookEntry.java deleted file mode 100644 index b09a796..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/entry/AddressbookEntry.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook.entry; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jjobs.model.addressbook.Addressbook; - -/** - * A POJI for addressbook entries - *

- * @author Roland Haeder - */ -public interface AddressbookEntry extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getAddressbookEntryId (); - - /** - * Setter for id number - *

- * @param addressbookEntryId Id number - */ - void setAddressbookEntryId (final Long addressbookEntryId); - - /** - * Getter for business contact - *

- * @return Business contact - */ - BusinessContact getAddressbookEntryBusinessContact (); - - /** - * Setter for business contact - *

- * @param addressbookEntryBusinessContact Business contact - */ - void setAddressbookEntryBusinessContact (final BusinessContact addressbookEntryBusinessContact); - - /** - * Getter for entry created timestamp - *

- * @return Entry created timestamp - */ - Calendar getAddressbookEntryCreated (); - - /** - * Setter for entry created timestamp - *

- * @param addressbookEntryCreated Entry created timestamp - */ - void setAddressbookEntryCreated (final Calendar addressbookEntryCreated); - - /** - * Getter for private contact - *

- * @return Private contact - */ - Contact getAddressbookEntryPrivateContact (); - - /** - * Setter for private contact - *

- * @param addressbookEntryPrivateContact Private contact - */ - void setAddressbookEntryPrivateContact (final Contact addressbookEntryPrivateContact); - - /** - * Getter for address book - *

- * @return Address book - */ - Addressbook getAddressbookId (); - - /** - * Setter for address book - *

- * @param addressbookId Address book - */ - void setAddressbookId (final Addressbook addressbookId); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jjobs/model/addressbook/entry/UserAddressbookEntry.java b/src/org/mxchange/jjobs/model/addressbook/entry/UserAddressbookEntry.java deleted file mode 100644 index 9c12762..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/entry/UserAddressbookEntry.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook.entry; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jcontactsbusiness.CompanyContact; -import org.mxchange.jjobs.model.addressbook.Addressbook; -import org.mxchange.jjobs.model.addressbook.UserAddressbook; - -/** - * A POJO for address book entries - *

- * @author Roland Haeder - */ -@Entity (name = "addressbook_entries") -@Table (name = "addressbook_entries") -@NamedQueries ( - @NamedQuery ( - name = "SearchUsersAddressbookEntries", - query = "SELECT e FROM addressbook_entries AS e INNER JOIN addressbooks AS a ON e.addressbookId = a WHERE e.addressbookId = :addressbook AND a.addressbookUser = :owner ORDER BY e.addressbookEntryId ASC") -) -public class UserAddressbookEntry implements AddressbookEntry { - - /** - * Serial number - */ - private static final long serialVersionUID = 178_581_768_581_960L; - - /** - * Connection to table "business_contacts" (commercial contacts) - */ - @JoinColumn (name = "entry_business_contact_id", updatable = false) - @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH) - private BusinessContact addressbookEntryBusinessContact; - - /** - * When this address book entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "entry_created", nullable = false, updatable = false) - private Calendar addressbookEntryCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "entry_id", nullable = false, updatable = false) - private Long addressbookEntryId; - - /** - * Connection to table "contacts" (private contacts) - */ - @JoinColumn (name = "entry_private_contact_id", updatable = false) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH) - private Contact addressbookEntryPrivateContact; - - /** - * Connection to table "addressbooks" - */ - @JoinColumn (name = "entry_addressbook_id", nullable = false, updatable = false) - @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.REFRESH, optional = false) - private Addressbook addressbookId; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final AddressbookEntry other = (AddressbookEntry) object; - - if (!Objects.equals(this.getAddressbookEntryBusinessContact(), other.getAddressbookEntryBusinessContact())) { - return false; - } else if (!Objects.equals(this.getAddressbookEntryPrivateContact(), other.getAddressbookEntryPrivateContact())) { - return false; - } else if (!Objects.equals(this.getAddressbookId(), other.getAddressbookId())) { - return false; - } - - return true; - } - - @Override - public int hashCode () { - int hash = 3; - hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryBusinessContact()); - hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryPrivateContact()); - hash = 19 * hash + Objects.hashCode(this.getAddressbookId()); - return hash; - } - - @Override - public BusinessContact getAddressbookEntryBusinessContact () { - return this.addressbookEntryBusinessContact; - } - - @Override - public void setAddressbookEntryBusinessContact (final BusinessContact addressbookEntryBusinessContact) { - this.addressbookEntryBusinessContact = addressbookEntryBusinessContact; - } - - @Override - public Calendar getAddressbookEntryCreated () { - return this.addressbookEntryCreated; - } - - @Override - public void setAddressbookEntryCreated (final Calendar addressbookEntryCreated) { - this.addressbookEntryCreated = addressbookEntryCreated; - } - - @Override - public Long getAddressbookEntryId () { - return this.addressbookEntryId; - } - - @Override - public void setAddressbookEntryId (final Long addressbookEntryId) { - this.addressbookEntryId = addressbookEntryId; - } - - @Override - public Contact getAddressbookEntryPrivateContact () { - return this.addressbookEntryPrivateContact; - } - - @Override - public void setAddressbookEntryPrivateContact (final Contact addressbookEntryPrivateContact) { - this.addressbookEntryPrivateContact = addressbookEntryPrivateContact; - } - - @Override - public Addressbook getAddressbookId () { - return this.addressbookId; - } - - @Override - public void setAddressbookId (final Addressbook addressbookId) { - this.addressbookId = addressbookId; - } - -} diff --git a/src/org/mxchange/jjobs/model/addressbook/shared/AddressbookShare.java b/src/org/mxchange/jjobs/model/addressbook/shared/AddressbookShare.java deleted file mode 100644 index c538c52..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/shared/AddressbookShare.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook.shared; - -import java.text.MessageFormat; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import org.mxchange.jjobs.model.addressbook.Addressbook; -import org.mxchange.jjobs.model.addressbook.UserAddressbook; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for sharing address books with other users - *

- * @author Roland Haeder - */ -@Entity (name = "addressbook_shares") -@Table (name = "addressbook_shares") -@NamedQueries ( - { - @NamedQuery ( - name = "SearchUserSharedAddressbooks", - query = "SELECT s FROM addressbook_shares AS s WHERE s.shareUserOwner = :user ORDER BY s.shareId ASC" - ), - @NamedQuery ( - name = "SearchShareeAddressbookShare", - query = "SELECT s FROM addressbook_shares AS s WHERE s.shareAddressbook = :addressbook AND s.shareUserSharee = :sharee" - ) - } -) -public class AddressbookShare implements ShareableAddressbook { - - /** - * Serial number - */ - private static final long serialVersionUID = 167_889_678_177_691_690L; - - /** - * Address book this share is for - */ - @JoinColumn (name = "share_addressbook_id", nullable = false, updatable = false) - @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.REFRESH, optional = false) - private Addressbook shareAddressbook; - - /** - * When this share has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "share_created", nullable = false, updatable = false) - private Calendar shareCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "share_id", nullable = false, updatable = false) - private Long shareId; - - /** - * User who is owning the share - */ - @JoinColumn (name = "share_owner_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User shareUserOwner; - - /** - * User the address book is shared with - */ - @JoinColumn (name = "share_sharee_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User shareUserSharee; - - /** - * Constructor with address book and sharee instance. Both parameters must - * not be null, their id numbers must be set and the adress book's user - * instance must be set and have a valid id set. - *

- * @param addressbook Address book instance - * @param sharee User sharee instance - */ - public AddressbookShare (final Addressbook addressbook, final User sharee) { - // Call constructor - this(); - - // Check all conditions - if (null == sharee) { - // Throw NPE - throw new NullPointerException("sharee is null"); //NOI18N - } else if (sharee.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("sharee.userId is null"); //NOI18N - } else if (sharee.getUserId() < 1) { - // Invalid id number - throw new IllegalStateException(MessageFormat.format("sharee.userId={0} is invalid", sharee.getUserId())); //NOI18N - } else if (null == addressbook) { - // Throw NPE again - throw new NullPointerException("addressbook is null"); //NOI18N - } else if (addressbook.getAddressbookId() == null) { - // Throw NPE again - throw new NullPointerException("addressbook.addressbookId is null"); //NOI18N - } else if (addressbook.getAddressbookId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("addressbook.addressbookId={0} is invalid.", addressbook.getAddressbookId())); //NOI18N - } else if (Objects.equals(addressbook.getAddressbookUser(), sharee)) { - // Sharing with yourself! - throw new IllegalStateException("User tries to share with himself."); //NOI18N - } - - // Set all instances - this.shareAddressbook = addressbook; - this.shareUserOwner = addressbook.getAddressbookUser(); - this.shareUserSharee = sharee; - this.shareCreated = new GregorianCalendar(); - } - - /** - * Default constructor - */ - public AddressbookShare () { - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final ShareableAddressbook other = (ShareableAddressbook) object; - - if (!Objects.equals(this.getShareAddressbook(), other.getShareAddressbook())) { - return false; - } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) { - return false; - } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) { - return false; - } - - return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee()); - } - - @Override - public int hashCode () { - int hash = 7; - hash = 19 * hash + Objects.hashCode(this.getShareAddressbook()); - hash = 19 * hash + Objects.hashCode(this.getShareUserOwner()); - hash = 19 * hash + Objects.hashCode(this.getShareUserSharee()); - return hash; - } - - @Override - public Addressbook getShareAddressbook () { - return this.shareAddressbook; - } - - @Override - public void setShareAddressbook (final Addressbook shareAddressbook) { - this.shareAddressbook = shareAddressbook; - } - - @Override - public Calendar getShareCreated () { - return this.shareCreated; - } - - @Override - public void setShareCreated (final Calendar shareCreated) { - this.shareCreated = shareCreated; - } - - @Override - public Long getShareId () { - return this.shareId; - } - - @Override - public void setShareId (final Long shareId) { - this.shareId = shareId; - } - - @Override - public User getShareUserOwner () { - return this.shareUserOwner; - } - - @Override - public void setShareUserOwner (final User shareUserOwner) { - this.shareUserOwner = shareUserOwner; - } - - @Override - public User getShareUserSharee () { - return this.shareUserSharee; - } - - @Override - public void setShareUserSharee (final User shareUserSharee) { - this.shareUserSharee = shareUserSharee; - } - -} diff --git a/src/org/mxchange/jjobs/model/addressbook/shared/ShareableAddressbook.java b/src/org/mxchange/jjobs/model/addressbook/shared/ShareableAddressbook.java deleted file mode 100644 index 5862b55..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/shared/ShareableAddressbook.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook.shared; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jjobs.model.addressbook.Addressbook; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for shared address books - *

- * @author Roland Haeder - */ -public interface ShareableAddressbook extends Serializable { - - /** - * Getter for shared address book instance - *

- * @return Shared address book instance - */ - Addressbook getShareAddressbook (); - - /** - * Setter for shared address book instance - *

- * @param shareAddressbook Shared address book instance - */ - void setShareAddressbook (final Addressbook shareAddressbook); - - /** - * Getter for id number - *

- * @return Id number - */ - Long getShareId (); - - /** - * Setter for id number - *

- * @param shareId Id number - */ - void setShareId (final Long shareId); - - /** - * Getter for address book owner instance - *

- * @return Address book owner instance - */ - User getShareUserOwner (); - - /** - * Setter for address book owner instance - *

- * @param shareUserOwner Address book owner instance - */ - void setShareUserOwner (final User shareUserOwner); - - /** - * Getter for address book sharee instance - *

- * @return Address book sharee instance - */ - User getShareUserSharee (); - - /** - * Setter for address book sharee instance - *

- * @param shareUserSharer Address book sharee instance - */ - void setShareUserSharee (final User shareUserSharer); - - /** - * Getter for share creation timestamp - *

- * @return Share creation timestamp - */ - Calendar getShareCreated (); - - /** - * Setter for share creation timestamp - *

- * @param shareCreated Share creation timestamp - */ - void setShareCreated (final Calendar shareCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jjobs/model/addressbook/status/AddressbokStatus.java b/src/org/mxchange/jjobs/model/addressbook/status/AddressbokStatus.java deleted file mode 100644 index 4fa2c36..0000000 --- a/src/org/mxchange/jjobs/model/addressbook/status/AddressbokStatus.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jjobs.model.addressbook.status; - -import java.io.Serializable; - -/** - * An enumeration for the addressbook status - *

- * @author Roland Haeder - */ -public enum AddressbokStatus implements Serializable { - - /** - * When the addressbook is unlocked - */ - UNLOCKED("ADDRESSBOOK_STATUS_UNLOCKED"), //NOI18N - - /** - * When the addressbook is locked by administrator - */ - LOCKED("ADDRESSBOOK_STATUS_LOCKED"); //NOI18N - - /** - * Message key - */ - private final String messageKey; - - /** - * Constructor - *

- * @param messageKey Message key for this enum - */ - private AddressbokStatus (final String messageKey) { - this.messageKey = messageKey; - } - - /** - * Getter for message key - *

- * @return Message key - */ - public String getMessageKey () { - return this.messageKey; - } -} diff --git a/src/org/mxchange/jjobs/validator/addressbook/AddressbookIdValidator.java b/src/org/mxchange/jjobs/validator/addressbook/AddressbookIdValidator.java index f8aff5c..cd67c99 100644 --- a/src/org/mxchange/jjobs/validator/addressbook/AddressbookIdValidator.java +++ b/src/org/mxchange/jjobs/validator/addressbook/AddressbookIdValidator.java @@ -25,12 +25,12 @@ import javax.faces.validator.ValidatorException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote; +import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException; +import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; import org.mxchange.jcoreee.validator.number.BaseLongValidator; import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; -import org.mxchange.jjobs.exceptions.AddressbookNotFoundException; -import org.mxchange.jjobs.model.addressbook.Addressbook; -import org.mxchange.jjobs.model.addressbook.JobsAddressbookSessionBeanRemote; /** * A validator for address book id verification @@ -48,7 +48,7 @@ public class AddressbookIdValidator extends BaseLongValidator { /** * Remote bean */ - private JobsAddressbookSessionBeanRemote addressbookBean; + private AddressbookSessionBeanRemote addressbookBean; /** * Logger instance @@ -69,7 +69,7 @@ public class AddressbookIdValidator extends BaseLongValidator { this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N // ... and user controller - this.addressbookBean = (JobsAddressbookSessionBeanRemote) context.lookup("java:global/jjobs-ejb/jjobs-adr!org.mxchange.jjobs.model.addressbook.JobsAddressbookSessionBeanRemote"); //NOI18N + this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/jjobs-ejb/jjobs-adr!org.mxchange.jjobs.model.addressbook.JobsAddressbookSessionBeanRemote"); //NOI18N } catch (final NamingException ex) { // Continue to throw it throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N -- 2.39.5