Clear all overrides, reset repeat counts for a request path

@param pathId ID of path
@param clientUUID UUID of client
@throws Exception exception
338531
public void clearRequestSettings(int pathId, String clientUUID) throws Exception {
        this.setRequestEnabled(pathId, false, clientUUID);
        OverrideService.getInstance().disableAllOverrides(pathId, clientUUID, Constants.OVERRIDE_TYPE_REQUEST);
        EditService.getInstance().updateRepeatNumber(Constants.OVERRIDE_TYPE_REQUEST, pathId, clientUUID);
    }
834761
@Override
	public void removeByUuid(String uuid) {
		for (CPSpecificationOption cpSpecificationOption : findByUuid(uuid,
				QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(cpSpecificationOption);
		}
	}
351981
public void incrementRetryCount(String clientId)
	{
		Integer retryCount = this.retryCounts.get(clientId);
		this.retryCounts.put(clientId, retryCount == null ? 1 : retryCount + 1);
	}
440843
@Override
	public int countByUuid_C(String uuid, long companyId) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_C;

		Object[] finderArgs = new Object[] { uuid, companyId };

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_COUNT_CPDEFINITIONSPECIFICATIONOPTIONVALUE_WHERE);

			boolean bindUuid = false;

			if (uuid == null) {
				query.append(_FINDER_COLUMN_UUID_C_UUID_1);
			}
			else if (uuid.equals("")) {
				query.append(_FINDER_COLUMN_UUID_C_UUID_3);
			}
			else {
				bindUuid = true;

				query.append(_FINDER_COLUMN_UUID_C_UUID_2);
			}

			query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (bindUuid) {
					qPos.add(uuid);
				}

				qPos.add(companyId);

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
171935
@Override
	public final void setUUID(UUID id) {
		final UUID oldId = getUUID();
		if ((oldId != null && !oldId.equals(id)) || (oldId == null && id != null)) {
			super.setUUID(oldId);
			fireElementChanged();
		}
	}
835131
@DELETE
    @Path("{ids}")
    public final Response deleteMultiple(@NotNull @PathParam("ids") URI_ID id,
                                         @NotNull @PathParam("ids") final PathSegment ids,
                                         @QueryParam("permanent") final boolean permanent) throws Exception {
        return super.deleteMultiple(id, ids, permanent);
    }
510592
public void addPathToRequestResponseTable(int profileId, String clientUUID, int pathId) throws Exception {
        PreparedStatement statement = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection
                .prepareStatement("INSERT INTO " + Constants.DB_TABLE_REQUEST_RESPONSE +
                                      "(" + Constants.REQUEST_RESPONSE_PATH_ID + ","
                                      + Constants.GENERIC_PROFILE_ID + ","
                                      + Constants.GENERIC_CLIENT_UUID + ","
                                      + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + ","
                                      + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED + ","
                                      + Constants.REQUEST_RESPONSE_REQUEST_ENABLED + ","
                                      + Constants.REQUEST_RESPONSE_CUSTOM_RESPONSE + ","
                                      + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + ")"
                                      + " VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
            statement.setInt(1, pathId);
            statement.setInt(2, profileId);
            statement.setString(3, clientUUID);
            statement.setInt(4, -1);
            statement.setInt(5, 0);
            statement.setInt(6, 0);
            statement.setString(7, "");
            statement.setString(8, "");
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
872913
@Override
	public void removeByUuid(String uuid) {
		for (CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue : findByUuid(
				uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(cpDefinitionSpecificationOptionValue);
		}
	}
821746
@Override
	public int countByUuid(String uuid) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID;

		Object[] finderArgs = new Object[] { uuid };

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE);

			boolean bindUuid = false;

			if (uuid == null) {
				query.append(_FINDER_COLUMN_UUID_UUID_1);
			}
			else if (uuid.equals("")) {
				query.append(_FINDER_COLUMN_UUID_UUID_3);
			}
			else {
				bindUuid = true;

				query.append(_FINDER_COLUMN_UUID_UUID_2);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (bindUuid) {
					qPos.add(uuid);
				}

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
1246180
public Client findClient(String clientUUID, Integer profileId) throws Exception {
        Client client = null;
        /* ERROR CODE: 500 WHEN TRYING TO DELETE A SERVER GROUP.
            THIS APPEARS TO BE BECAUSE CLIENT UUID IS NULL.
         */
        /* CODE ADDED TO PREVENT NULL POINTERS. */
        if (clientUUID == null) {
            clientUUID = "";
        }

        // first see if the clientUUID is actually a uuid.. it might be a friendlyName and need conversion
        /* A UUID IS A UNIVERSALLY UNIQUE IDENTIFIER. */
        if (clientUUID.compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) != 0 &&
            !clientUUID.matches("[\\w]{8}-[\\w]{4}-[\\w]{4}-[\\w]{4}-[\\w]{12}")) {
            Client tmpClient = this.findClientFromFriendlyName(profileId, clientUUID);

            // if we can't find a client then fall back to the default ID
            if (tmpClient == null) {
                clientUUID = Constants.PROFILE_CLIENT_DEFAULT_ID;
            } else {
                return tmpClient;
            }
        }

        PreparedStatement statement = null;
        ResultSet results = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            String queryString = "SELECT * FROM " + Constants.DB_TABLE_CLIENT +
                " WHERE " + Constants.CLIENT_CLIENT_UUID + " = ?";

            if (profileId != null) {
                queryString += " AND " + Constants.GENERIC_PROFILE_ID + "=?";
            }

            statement = sqlConnection.prepareStatement(queryString);
            statement.setString(1, clientUUID);

            if (profileId != null) {
                statement.setInt(2, profileId);
            }

            results = statement.executeQuery();
            if (results.next()) {
                client = this.getClientFromResultSet(results);
            }
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        return client;
    }
859917
@Override
	public void removeByUuid_C(String uuid, long companyId) {
		for (CommerceSubscriptionEntry commerceSubscriptionEntry : findByUuid_C(
				uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceSubscriptionEntry);
		}
	}
438958
public void resetRetryCount(String clientId)
	{
		Integer currentRetryCount = this.retryCounts.get(clientId);
		if (currentRetryCount != null && currentRetryCount.intValue() != 0)
		{
			this.retryCounts.put(clientId, 0);
		}
	}
1357833
public void updateUuid(SIBUuid12 uuid)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "updateUuid", uuid);

    _uuid = uuid;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "updateUuid");
          
    return;
  }
285712
@Override
	public void removeByUuid(String uuid) {
		for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid(
				uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceVirtualOrderItem);
		}
	}
554255
@Override
    public void setClientID(String clientID) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setClientID", clientID);

        // Make empty and null look the same.
        if ("".equals(clientID))
            clientID = null;
        jcaManagedConnectionFactory.setClientID(clientID);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setClientID");
    }
40884
@RequestMapping(value = "", method = RequestMethod.GET)
    public String pathOrderHome(Model model, @PathVariable int profileId,
                                @RequestParam(value = "clientUUID", defaultValue = "-1") String clientUUID) throws Exception {

        model.addAttribute("profile_id", profileId);
        model.addAttribute("profile_name", ProfileService.getInstance().getNamefromId(profileId));
        model.addAttribute("pathnames", PathOverrideService.getInstance().getPaths(profileId, clientUUID, null));

        return "pathOrder";
    }
942662
public boolean removeCustomResponse(String pathValue, String requestType) {
        try {
            JSONObject path = getPathFromEndpoint(pathValue, requestType);
            if (path == null) {
                return false;
            }
            String pathId = path.getString("pathId");
            return resetResponseOverride(pathId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }