src/com/company/Server/ReadWriteFiles.java
public void updateNotificationContactUser(int id) {
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));

            JSONArray listUsers = (JSONArray) obj.get("Registry");

            int i = 0;
            boolean found = false;
            JSONObject user;

            while (!found && i < listUsers.size()) {
                user = (JSONObject) listUsers.get(i);

                if (Integer.parseInt(user.get("id").toString()) == id) {
                    found = true;
                    ((JSONObject) listUsers.get(i)).put("isNotified", true);
                } else {
                    i++;
                }
            }

            JSONArray county = (JSONArray) obj.get("Counties");
            JSONArray unregisteredUsers = (JSONArray) obj.get("UnregisteredUsers");

            JSONObject objWrite = new JSONObject();

            objWrite.put("UnregisteredUsers", unregisteredUsers);
            objWrite.put("Registry", listUsers);
            objWrite.put("Counties", county);

            FileWriter fileWriter = new FileWriter(file.getPath());

            fileWriter.write(objWrite.toJSONString());

            fileWriter.close();

        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
    }
/**
     * Method responsible for adding a contact that is not yet registered in the application
     *
     * @param id unregistered contact id
     */
Method responsible for adding a contact that is not yet registered in the application
@param id unregistered contact id
Method responsible for adding a contact that is not yet registered in the application @param id unregistered contact id
public void updateNotificationContactUser(int id) {
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));
            JSONArray listUsers = (JSONArray) obj.get("Registry");
            int i = 0;
            boolean found = false;
            JSONObject user;
            while (!found && i < listUsers.size()) {
                user = (JSONObject) listUsers.get(i);
                if (Integer.parseInt(user.get("id").toString()) == id) {
                    found = true;
                    ((JSONObject) listUsers.get(i)).put("isNotified", true);
                } else {
                    i++;
                }
            }
            JSONArray county = (JSONArray) obj.get("Counties");
            JSONArray unregisteredUsers = (JSONArray) obj.get("UnregisteredUsers");
            JSONObject objWrite = new JSONObject();
            objWrite.put("UnregisteredUsers", unregisteredUsers);
            objWrite.put("Registry", listUsers);
            objWrite.put("Counties", county);
            FileWriter fileWriter = new FileWriter(file.getPath());
            fileWriter.write(objWrite.toJSONString());
            fileWriter.close();
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
    }
public void updateNotificationContactUser ( int id ) { try { JSONObject obj = ( JSONObject ) jsonParser . parse ( new FileReader ( file . getPath ( ) ) ) ; JSONArray listUsers = ( JSONArray ) obj . get ( "Registry" ) ; int i = 0 ; boolean found = false ; JSONObject user ; while ( ! found && i < listUsers . size ( ) ) { user = ( JSONObject ) listUsers . get ( i ) ; if ( Integer . parseInt ( user . get ( "id" ) . toString ( ) ) == id ) { found = true ; ( ( JSONObject ) listUsers . get ( i ) ) . put ( "isNotified" , true ) ; } else { i ++ ; } } JSONArray county = ( JSONArray ) obj . get ( "Counties" ) ; JSONArray unregisteredUsers = ( JSONArray ) obj . get ( "UnregisteredUsers" ) ; JSONObject objWrite = new JSONObject ( ) ; objWrite . put ( "UnregisteredUsers" , unregisteredUsers ) ; objWrite . put ( "Registry" , listUsers ) ; objWrite . put ( "Counties" , county ) ; FileWriter fileWriter = new FileWriter ( file . getPath ( ) ) ; fileWriter . write ( objWrite . toJSONString ( ) ) ; fileWriter . close ( ) ; } catch ( IOException | ParseException e ) { e . printStackTrace ( ) ; } }
Method responsible for adding a contact that is not yet registered in the application
 @param id unregistered contact id
Method responsible for adding a contact that is not yet registered in the application @param id unregistered contact id