Skip to content

Commit

Permalink
Remove delete
Browse files Browse the repository at this point in the history
  • Loading branch information
danchang committed May 20, 2012
1 parent dec689a commit fa3ec46
Showing 1 changed file with 4 additions and 44 deletions.
Expand Up @@ -101,13 +101,8 @@ public boolean allowPut() {
return true;
}

@Override
public boolean allowDelete() {
return true;
}

// GET - Retrieve all and single Skill
// -----------------------------------
// GET - Retrieve all and single User Group with Permissions
// ---------------------------------------------------------

@Override
public Representation represent(Variant variant) throws ResourceException {
Expand Down Expand Up @@ -153,8 +148,8 @@ public Representation represent(Variant variant) throws ResourceException {
return new UserGroupPermissionsRepresentation(variant.getMediaType(), userGroupPermissionsBundleRestInfo);
}

// PUT - Update or Add single Skill
// --------------------------------
// PUT - Update Permissions
// ------------------------

@Override
public void storeRepresentation(Representation entity) throws ResourceException {
Expand Down Expand Up @@ -215,41 +210,6 @@ public void storeRepresentation(Representation entity) throws ResourceException
}


// DELETE - Delete single Skill
// ----------------------------

@Override
public void removeRepresentations() throws ResourceException {
Group userGroup;
int idInt;

// get id then delete single
String idString = (String) getRequest().getAttributes().get("id");

if (idString != null) {
try {
idInt = RestUtilities.getIntFromAttribute(idString);
userGroup = m_settingContext.getGroup(idInt);
}
catch (Exception exception) {
RestUtilities.setResponseError(getResponse(), RestUtilities.ResponseCode.ERROR_BAD_INPUT, "ID " + idString + " not found.");
return;
}

List<Integer> userGroupIds = new ArrayList<Integer>();
userGroupIds.add(idInt);
m_settingContext.deleteGroups(userGroupIds);

RestUtilities.setResponse(getResponse(), RestUtilities.ResponseCode.SUCCESS_DELETED, "Deleted User Group Permissions", userGroup.getId());

return;
}

// no id string
RestUtilities.setResponse(getResponse(), RestUtilities.ResponseCode.ERROR_MISSING_INPUT, "ID value missing");
}


// Helper functions
// ----------------

Expand Down

0 comments on commit fa3ec46

Please sign in to comment.