/**
   * Decorates a group if needed.
   *
   * @param group The group to decorate.
   * @return The decorated group if some grouper grouper groups have to be loaded in it.
   */
  private IEntityGroup decorate(final IEntityGroup group) {

    if (group == null) {
      return group;
    }

    final String groupName = group.getName();
    String eltsToLoad = null;

    if (groupName != null) {
      eltsToLoad = grouperMapping.getProperty(groupName);
    }

    // Retrieves the name of the Grouper groups to load.
    String[] grouperGroups = null;

    if (eltsToLoad != null) {
      grouperGroups = eltsToLoad.split(ESCOConstants.SEP);
    }
    final EntityGroupImpl decoratedGroup =
        new ESCODynEntityGroupDecorator(
            group.getKey(),
            group.getLeafType(),
            group.getCreatorID(),
            group.getName(),
            group.getDescription(),
            grouperGroups);

    return decoratedGroup;
  }
  /** @see org.jasig.portal.groups.IEntityGroupStore#update(org.jasig.portal.groups.IEntityGroup) */
  public void update(IEntityGroup group) throws GroupsException {

    // assume key is fully qualified group name
    String groupName = group.getLocalKey();

    String description = group.getDescription();

    // the name is the displayExtension
    String displayExtension = group.getName();

    WsGroupToSave wsGroupToSave = new WsGroupToSave();
    wsGroupToSave.setCreateParentStemsIfNotExist("T");
    wsGroupToSave.setWsGroupLookup(new WsGroupLookup(groupName, null));
    WsGroup wsGroup = new WsGroup();
    wsGroup.setName(groupName);
    wsGroup.setDisplayExtension(displayExtension);
    wsGroup.setDescription(description);
    wsGroupToSave.setWsGroup(wsGroup);

    new GcGroupSave().addGroupToSave(wsGroupToSave).execute();

    updateMembers(group);
  }