docs: @Override
      public void uploadAsset(RepositoryResourceImpl newResource, List<RepositoryResourceImpl> matchingResources) throws RepositoryBackendException, RepositoryResourceException {
  
          // we haven't added the newResource yet so blank its id in case we have stale data
          newResource.resetId();
  
          State desired;
          if (matchingResources.size() != 0) {
              desired = calculateTargetState(matchingResources.get(0));
          } else {
              desired = _desiredStateIfNoMatchingFound;
          }
  
          boolean performHideOnOldResource = false;
          List<RepositoryResource> resourcesToHide = new ArrayList<RepositoryResource>();
  
          // Lock on the vanityURL
          String lockString = getVanityUrlLock(newResource.getVanityURL());
          synchronized (lockString) {
  
              // If the desired state is not published we will never hide any resources
              if (desired == State.PUBLISHED) {
  
                  // If we adding a public beta feature make it visible (it will be hidden later
                  // if there is a non-beta version before being uploaded)
                  if (newResource instanceof EsaResourceImpl) {
                      EsaResourceImpl esa = (EsaResourceImpl) newResource;
                      if (isBeta(newResource) && Visibility.PUBLIC.equals(esa.getVisibility())) {
                          esa.setWebDisplayPolicy(DisplayPolicy.VISIBLE);
                      }
                  }
  
                  // get the resource(s) to hide (which may be the one we are adding)
                  resourcesToHide = findResourcesToHide(newResource, matchingResources);
  
                  // if the resource to hide is the resource being added make it hidden before upload.
                  // If it is another resource set a flag so that it gets uploaded later as hidden.
                  if (resourcesToHide.size() != 0) {
  
                      for (RepositoryResource loopResource : resourcesToHide) {
  
                          if (loopResource.getId() == null) {
                              // this is the resource we are adding (as it doesn't yet have an id) and we want it hidden
                              if (loopResource instanceof WebDisplayable) {
                                  ((WebDisplayable) loopResource).setWebDisplayPolicy(DisplayPolicy.HIDDEN);
                              }
                          } else {
                              // there are resources other than the one we are adding to hide
                              performHideOnOldResource = true;
                          }
                      }
                  }
              } // end if (desired == State.PUBLISHED)
  
              // upload the new resource (could be hidden or visible) ...
              super.uploadAsset(newResource, matchingResources);
              String newlyAddedAssetId = newResource.getId();
  
              // now hide any OTHER assets that need hiding as THIS one will have been hidden if necessary before upload.
              if (performHideOnOldResource) {
                  for (RepositoryResource resourceToHide : resourcesToHide) {
                      if ((resourceToHide.getId()).equals(newlyAddedAssetId)) {
                          // leave the asset we have just added alone
                      } else {
                          // this is not the recently added resource so hide
                          if (resourceToHide instanceof WebDisplayable) {
                              ((WebDisplayable) resourceToHide).setWebDisplayPolicy(DisplayPolicy.HIDDEN);
                              RepositoryResourceWritable rrw = (RepositoryResourceWritable) resourceToHide;
                              // The desired stated is passed explicitly here, just in case a previous, failed,
                              // upload attempt has left a matching resource in the wrong state.  There should
                              // always be a matching resource, so the desiredStateIfNoMatchingFound (second parameter)
                              // should never be used.
                              rrw.uploadToMassive(new AddThenDeleteStrategy(rrw.getState(), State.DRAFT, true));
                          }
                      }
  
                  }
              }
          }
      }