Delete a profile

@param model
@param id
@return
@throws Exception
774871
@RequestMapping(value = "/api/profile", method = RequestMethod.DELETE)
    public
    @ResponseBody
    HashMap<String, Object> deleteProfile(Model model, int id) throws Exception {
        profileService.remove(id);
        return Utils.getJQGridJSON(profileService.findAllProfiles(), "profiles");
    }
1141159
def delete(self, id):
        
        id = self.as_id(id)
        response = self.http.delete(
            '%s/%s' % (self.api_url, id),
            auth=self.auth)
        response.raise_for_status()
1322826
synchronized void removeUserProfile(String id) {

        if (id == null) return;
        final String tableName = Table.USER_PROFILES.getName();
        try {
            final SQLiteDatabase db = dbHelper.getWritableDatabase();
            db.delete(tableName, "_id = ?", new String[]{id});
        } catch (final SQLiteException e) {
            getConfigLogger().verbose("Error removing user profile from " + tableName + " Recreating DB");
            dbHelper.deleteDatabase();
        } finally {
            dbHelper.close();
        }
    }
345480
public void deleteVoiceMessage(final String id) throws UnauthorizedException, GeneralException, NotFoundException {
        if (id == null) {
            throw new IllegalArgumentException("Message ID must be specified.");
        }
        messageBirdService.deleteByID(VOICEMESSAGESPATH, id);
    }
1234904
@RequestMapping(value = "api/servergroup/{id}", method = RequestMethod.DELETE)
    public
    @ResponseBody
    List<ServerGroup> deleteServerGroup(Model model,
                                             @PathVariable int id,
                                             @RequestParam(value = "profileId", required = false) Integer profileId,
                                             @RequestParam(value = "clientUUID", required = false) String clientUUID,
                                             @RequestParam(value = "profileIdentifier", required = false) String profileIdentifier) throws Exception {
        if (profileId == null && profileIdentifier == null) {
            throw new Exception("profileId required");
        }
        if (profileId == null) {
            profileId = ProfileService.getInstance().getIdFromName(profileIdentifier);
        }

        int clientId = ClientService.getInstance().findClient(clientUUID, profileId).getId();

        ServerGroup group = ServerRedirectService.getInstance().getServerGroup(id, profileId);
        ServerRedirectService.getInstance().deleteServerGroup(id);
        return ServerRedirectService.getInstance().tableServerGroups(clientId);
    }
34457
@RequestMapping(value = "/api/profile", method = RequestMethod.POST)
    public
    @ResponseBody
    HashMap<String, Object> addProfile(Model model, String name) throws Exception {
        logger.info("Should be adding the profile name when I hit the enter button={}", name);
        return Utils.getJQGridJSON(profileService.add(name), "profile");
    }
354350
protected boolean deleteMultipleModel(Set<MODEL_ID> idCollection, boolean permanent) throws Exception {
        if (permanent) {
            server.deleteAllPermanent(modelType, idCollection);
        } else {
            server.deleteAll(modelType, idCollection);
        }
        return permanent;
    }
256421
def delete_instance(model, instance_id, _commit=True):
    
    try:
        model = get_model(model)
    except ImportError:
        return

    instance = model.query.get(instance_id)
    if not instance:
        return

    db.session.delete(instance)
    try:
        if _commit:
            db.session.commit()
        else:
            db.session.flush()
    except Exception as exception:
        db.session.rollback()
        raise exception
297789
public synchronized void delete(File dir, String id) {
        if (idToNumber.remove(id) != null) {
            save(dir);
        }
    }
240763
public function delete($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->delete("$this->action/$id");
    }
532710
public void reset(int profileId, String clientUUID) throws Exception {
        PreparedStatement statement = null;

        // TODO: need a better way to do this than brute force.. but the iterative approach is too slow
        try (Connection sqlConnection = sqlService.getConnection()) {

            // first remove all enabled overrides with this client uuid
            String queryString = "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                " WHERE " + Constants.GENERIC_CLIENT_UUID + "= ? " +
                " AND " + Constants.GENERIC_PROFILE_ID + " = ?";
            statement = sqlConnection.prepareStatement(queryString);
            statement.setString(1, clientUUID);
            statement.setInt(2, profileId);
            statement.executeUpdate();
            statement.close();

            // clean up request response table for this uuid
            queryString = "UPDATE " + Constants.DB_TABLE_REQUEST_RESPONSE +
                " SET " + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + "=?, "
                + Constants.REQUEST_RESPONSE_CUSTOM_RESPONSE + "=?, "
                + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + "=-1, "
                + Constants.REQUEST_RESPONSE_REQUEST_ENABLED + "=0, "
                + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED + "=0 "
                + "WHERE " + Constants.GENERIC_CLIENT_UUID + "=? " +
                " AND " + Constants.GENERIC_PROFILE_ID + "=?";
            statement = sqlConnection.prepareStatement(queryString);
            statement.setString(1, "");
            statement.setString(2, "");
            statement.setString(3, clientUUID);
            statement.setInt(4, profileId);
            statement.executeUpdate();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        this.updateActive(profileId, clientUUID, false);
    }
575815
def delete(self, request, id):
        
        if not id:
            # can't delete the whole container
            raise errors.MethodNotAllowed()
        try:
            models.User.objects.get(pk=id).delete()
        except models.User.DoesNotExist:
            # we never had it, so it's definitely deleted
            pass
1257981
protected boolean deleteModel(MODEL_ID id, boolean permanent) throws Exception {
        if (permanent) {
            server.deletePermanent(modelType, id);
        } else {
            server.delete(modelType, id);
        }
        return permanent;
    }
1097594
@Path("{id}")
  @DELETE
  @Produces(APPLICATION_JSON)
  @Timed
  @ExceptionMetered
  public JobDeleteResponse delete(@PathParam("id") @Valid final JobId id,
                                  @QueryParam("token") @DefaultValue("") final String token) {
    if (!id.isFullyQualified()) {
      throw badRequest("Invalid id");
    }
    try {
      model.removeJob(id, token);
      return new JobDeleteResponse(JobDeleteResponse.Status.OK);
    } catch (JobDoesNotExistException e) {
      throw notFound(new JobDeleteResponse(JobDeleteResponse.Status.JOB_NOT_FOUND));
    } catch (JobStillDeployedException e) {
      throw badRequest(new JobDeleteResponse(JobDeleteResponse.Status.STILL_IN_USE));
    } catch (TokenVerificationException e) {
      throw forbidden(new JobDeleteResponse(JobDeleteResponse.Status.FORBIDDEN));
    }
  }
413837
def delete_profile(id, factory_id, opts = {})
      data, _status_code, _headers = delete_profile_with_http_info(id, factory_id, opts)
      return data
    end
995989
public void destroy() throws Exception {
        if (_clientId == null) {
            return;
        }

        // delete the clientId here
        String uri = BASE_PROFILE + uriEncode(_profileName) + "/" + BASE_CLIENTS + "/" + _clientId;
        try {
            doDelete(uri, null);
        } catch (Exception e) {
            // some sort of error
            throw new Exception("Could not delete a proxy client");
        }
    }
894873
@RequestMapping(value = "/api/profile/{profileIdentifier}", method = RequestMethod.GET)
    public
    @ResponseBody
    HashMap<String, Object> getProfile(Model model, @PathVariable String profileIdentifier) throws Exception {
        Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier);
        return Utils.getJQGridJSON(profileService.findProfile(profileId), "profile");
    }