@Override public String getObject() { if (groupWrapper.getInnerObject().getGroupOwner() == null) { return StringUtils.EMPTY; } else { GroupTO groupTO = groupRestClient.read(groupWrapper.getInnerObject().getGroupOwner()); if (groupTO == null) { return StringUtils.EMPTY; } else { return String.format("[%s] %s", groupTO.getKey(), groupTO.getName()); } } }
if (groupTO.getGroupOwner() != null) { Group owner = groupDAO.find(groupTO.getGroupOwner()); if (owner == null) { LOG.warn("Ignoring invalid group specified as owner: {}", groupTO.getGroupOwner()); } else { group.setGroupOwner(owner);
/** * Calculate modifications needed by first in order to be equal to second. * * @param updated updated GroupTO * @param original original GroupTO * @param incremental perform incremental diff (without removing existing info) * @return {@link GroupUR} containing differences */ public static GroupUR diff(final GroupTO updated, final GroupTO original, final boolean incremental) { GroupUR result = new GroupUR(); diff(updated, original, result, incremental); // 1. name result.setName(replacePatchItem(updated.getName(), original.getName(), new StringReplacePatchItem())); // 2. ownership result.setUserOwner( replacePatchItem(updated.getUserOwner(), original.getUserOwner(), new StringReplacePatchItem())); result.setGroupOwner( replacePatchItem(updated.getGroupOwner(), original.getGroupOwner(), new StringReplacePatchItem())); // 3. dynamic membership result.setUDynMembershipCond(updated.getUDynMembershipCond()); result.getADynMembershipConds().putAll(updated.getADynMembershipConds()); // 4. type extensions result.getTypeExtensions().addAll(updated.getTypeExtensions()); return result; }
/** * Calculate modifications needed by first in order to be equal to second. * * @param updated updated GroupTO * @param original original GroupTO * @param incremental perform incremental diff (without removing existing info) * @return GroupPatch containing differences */ public static GroupPatch diff(final GroupTO updated, final GroupTO original, final boolean incremental) { GroupPatch result = new GroupPatch(); diff(updated, original, result, incremental); // 1. name result.setName(replacePatchItem(updated.getName(), original.getName(), new StringReplacePatchItem())); // 2. ownership result.setUserOwner( replacePatchItem(updated.getUserOwner(), original.getUserOwner(), new StringReplacePatchItem())); result.setGroupOwner( replacePatchItem(updated.getGroupOwner(), original.getGroupOwner(), new StringReplacePatchItem())); // 3. dynamic membership result.setUDynMembershipCond(updated.getUDynMembershipCond()); result.getADynMembershipConds().putAll(updated.getADynMembershipConds()); // 4. type extensions result.getTypeExtensions().addAll(updated.getTypeExtensions()); return result; }
if (((GroupTO) template).getGroupOwner() != null) { final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner()); if (groupOwner != null) { ((GroupTO) anyTO).setGroupOwner(groupOwner.getKey());
groupCR.setGroupOwner(groupTO.getGroupOwner()); groupCR.setUDynMembershipCond(groupTO.getUDynMembershipCond()); groupCR.getADynMembershipConds().putAll(groupTO.getADynMembershipConds());
updatedGroup.setGroupOwner(originalGroup.getGroupOwner()); updatedGroup.setUDynMembershipCond(originalGroup.getUDynMembershipCond()); updatedGroup.getADynMembershipConds().putAll(originalGroup.getADynMembershipConds());
this.wrapper = groupWrapper; isGroupOwnership = Model.of(groupWrapper.getInnerObject().getGroupOwner() != null);