@Override void executeOnSuccess() { try { result = projectComponentManager.update(component); } catch (EntityNotFoundException e) { Long id = component.getId(); if (id != null) { addErrorKey(KEY_NO_SUCH_COMPONENT_WITH_ID, id.toString(), ErrorCollection.Reason.SERVER_ERROR); } else { addErrorKey(KEY_NO_SUCH_COMPONENT, null, ErrorCollection.Reason.SERVER_ERROR); } } }
private void removeComponentLeadsForUser(final ApplicationUser user) { for (final ProjectComponent component : getComponentsUserLeads(user)) { MutableProjectComponent newProjectComponent = MutableProjectComponent.copy(component); newProjectComponent.setLead(null); if (component.getAssigneeType() == AssigneeTypes.COMPONENT_LEAD) { newProjectComponent.setAssigneeType(AssigneeTypes.PROJECT_DEFAULT); } try { componentManager.update(newProjectComponent); } catch (EntityNotFoundException e) { // We only just fetched this component, but perhaps someone deleted it concurrently ... } } }