protected <T> T performCopy(final MultiTenantCopyContext context, final MultiTenantCloneable<T> entity, Map<String, String> copyHints, final EntityDuplicateModifier... modifiers) throws Exception { context.getCopyHints().putAll(copyHints); context.setForDuplicate(true); persistCopyObjectTree(new CopyOperation<T, CloneNotSupportedException>() { @Override public T execute(T original) throws CloneNotSupportedException { T response = entity.createOrRetrieveCopyInstance(context).getClone(); for (EntityDuplicateModifier modifier : modifiers) { modifier.modifyInitialDuplicateState(response); } return response; } }, (Class<T>) entity.getClass(), (T) entity, context); return context.getClonedVersion((Class<T>) entity.getClass(), genericEntityService.getIdentifier(entity)); } }
cloned.setTotalitarianOffer(totalitarianOffer); cloned.setType(getType()); if (!BooleanUtils.toBoolean(context.getCopyHints().get(EXCLUDE_OFFERCODE_COPY_HINT))) { for (OfferCode entry : offerCodes) { OfferCode clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();