public void setSelectedEntityReference(final DocRef docRef,
                                           final boolean decorateDocRef,
                                           final Consumer<DocRef> onDocRefDecoration,
                                           final Runnable onDocRefNotFound) {
        if (docRef != null && decorateDocRef) {
            // The docRef may have come from the data within a Doc so the name may be out of date,
            // so decorate it to ensure we have the right name
            restFactory
                    .create(EXPLORER_RESOURCE)
                    .method(resource ->
                            resource.decorate(DecorateRequest.createWithPermCheck(
                                    docRef, getRequiredPermissions())))
                    .onSuccess(decoratedDocRef -> {
                        if (decoratedDocRef != null) {
                            explorerPopupPresenter.setSelectedEntityReference(decoratedDocRef);
                            setFieldValue(decoratedDocRef, null);
                            if (!Objects.equals(docRef, decoratedDocRef)) {
                                // The decorated one is different so we need to update
                                if (onDocRefDecoration != null) {
                                    onDocRefDecoration.accept(decoratedDocRef);
                                }
                            }
                        } else {
                            handleDecorateError(docRef, onDocRefNotFound);
                        }
                    })
                    .taskMonitorFactory(this)
                    .exec();
        } else {
            // No decoration
            explorerPopupPresenter.setSelectedEntityReference(docRef);
            setFieldValue(docRef, null);
        }
    }
@param docRef             The {@link DocRef} to set as the selected value of the dropdown.
                          If docRef does not exist or is not visible to the user, a warning
                          will be displayed but the value will be as passed.
@param decorateDocRef     If true, force decorate docRef to ensure it has the correct name.
                          Set to false if you know docRef has an up-to-date name, is a constant,
                          is definitely null, or you don't care.
@param onDocRefDecoration Called when docRef is found to be different to a
                          decorated version of it, e.g. it's name has changed.
@param onDocRefNotFound   Called docRef does not exist, e.g. it has been deleted
                          or its permissions have changed.
stroom-core-client/src/main/java/stroom/explorer/client/presenter/DocSelectionBoxPresenter.java