Source:
<code>public Group updateGroup(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group.getName(), "group.getName()"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if (!dbGroup.getShortName().equals(group.getShortName())) { dbGroup.setShortName(group.getShortName()); try { jdbc.update("update groups set name=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getName(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } if (group.getDescription() != null && !group.getDescription().equals(dbGroup.getDescription())) { try { jdbc.update("update groups set dsc=?, modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", group.getDescription(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), group.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } dbGroup.setDescription(group.getDescription()); } <START> <END> if (group.getParentGroupId() != null && !group.getParentGroupId().equals(dbGroup.getParentGroupId())) { dbGroup.setParentGroupId(group.getParentGroupId()); try { jdbc.update("update groups set parent_group_id=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getParentGroupId(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } return dbGroup; }</code><technical_language>I prefer implementing method, instead of updateGroup(), some people API create inconsistency changing parentGroupId, rest of logic</technical_language>

Target:
public Group updateGroup(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group.getName(), "group.getName()"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if (!dbGroup.getShortName().equals(group.getShortName())) { dbGroup.setShortName(group.getShortName()); try { jdbc.update("update groups set name=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getName(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } if (group.getDescription() != null && !group.getDescription().equals(dbGroup.getDescription())) { try { jdbc.update("update groups set dsc=?, modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", group.getDescription(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), group.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } dbGroup.setDescription(group.getDescription()); } return dbGroup; }