code: public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException,
        RepositoryException
     {
        checkValid();
  
        JCRName jcrLabelName = locationFactory.parseJCRName(label);
        InternalQName labelQName = jcrLabelName.getInternalName();
  
        NodeData labels = getVersionLabelsData();
  
        List<PropertyData> labelsList = dataManager.getChildPropertiesData(labels);
        for (PropertyData prop : labelsList)
        {
           if (prop.getQPath().getName().equals(labelQName))
           {
              // label is found
              if (moveLabel)
              {
                 removeVersionLabel(label);
                 break;
              }
              throw new VersionException("Label " + label + " is already exists and moveLabel=false");
           }
        }
  
        NodeData versionData = getVersionData(versionName);
  
        SessionChangesLog changesLog = new SessionChangesLog(session);
  
        PropertyData labelData =
           TransientPropertyData.createPropertyData(labels, labelQName, PropertyType.REFERENCE, false,
              new TransientValueData(versionData.getIdentifier()));
        changesLog.add(ItemState.createAddedState(labelData));
  
        dataManager.getTransactManager().save(changesLog);
     }
docs: {@inheritDoc}