--- /dev/null
+/*\r
+ * Copyright (C) 2016 Roland Haeder\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package org.mxchange.jcontacts.contact.utils;\r
+\r
+import java.text.MessageFormat;\r
+import org.mxchange.jcontacts.contact.Contact;\r
+import org.mxchange.jcore.BaseFrameworkSystem;\r
+import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;\r
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;\r
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;\r
+\r
+/**\r
+ * Utilities for contacts\r
+ * <p>\r
+ * @author Roland Haeder<roland@mxchange.org>\r
+ */\r
+public class ContactUtils extends BaseFrameworkSystem {\r
+\r
+ public static void updateCellPhoneNumber (final Contact contact, final MobileProvider cellphoneProvider, final Long cellphoneNumber) {\r
+ // Is there a cellphone number?\r
+ if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {\r
+ // Debug message\r
+ System.out.println(MessageFormat.format("updateCellPhoneNumber: cellPhoneId={0}", contact.getContactCellphoneNumber().getPhoneId())); //NOI18N\r
+\r
+ // Is provider null?\r
+ if (null == cellphoneProvider) {\r
+ // Remove instance\r
+ contact.setContactCellphoneNumber(null);\r
+ } else {\r
+ // Yes, then update as well\r
+ contact.getContactCellphoneNumber().setCellphoneProvider(cellphoneProvider);\r
+ contact.getContactCellphoneNumber().setPhoneNumber(cellphoneNumber);\r
+ }\r
+ } else if ((cellphoneProvider instanceof MobileProvider) && (cellphoneNumber > 0)) {\r
+ // Create new instance\r
+ DialableCellphoneNumber cellphone = new CellphoneNumber(cellphoneProvider, cellphoneNumber);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Private constructor for utilities\r
+ */\r
+ private ContactUtils () {\r
+ }\r
+\r
+}\r