import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.annotation.PostConstruct;
return isFound;
}
+ @Override
+ public boolean isOtherAddressbook () {
+ // Just call the other method and invert it
+ return (!this.isOwnAddressbook());
+ }
+
+ @Override
+ public boolean isOwnAddressbook () {
+ // Is the user logged in?
+ if (!this.loginController.isUserLoggedIn()) {
+ // No, then no own address book
+ return false;
+ }
+
+ // Is same user?
+ return Objects.equals(this.getAddressbookUser(), this.loginController.getLoggedInUser());
+ }
+
/**
* Initializes the user user's address book list
*/
* @param event
*/
void afterLoginEvent (final UserLoggedInEvent event);
+
+ /**
+ * Checks if the user is logged in and if so if it matches the current
+ * address book owner.
+ * <p>
+ * @return Whether the owner matches currently logged-in user
+ */
+ boolean isOwnAddressbook ();
+
+ /**
+ * Checks if the owner of the current address book is NOT matching the
+ * logged-in user.
+ * <p>
+ * @return Whether the user does NOT match
+ */
+ boolean isOtherAddressbook ();
+
}