code: private void copyRelations(CmsDbContext dbc, CmsResource source, CmsResource target) throws CmsException {
  
          // copy relations all relations
          CmsObject cms = new CmsObject(getSecurityManager(), dbc.getRequestContext());
          Iterator<CmsRelation> itRelations = getRelationsForResource(
              dbc,
              source,
              CmsRelationFilter.TARGETS.filterNotDefinedInContent()).iterator();
          while (itRelations.hasNext()) {
              CmsRelation relation = itRelations.next();
              if (relation.getType().getCopyBehavior() == CopyBehavior.copy) {
                  try {
                      CmsResource relTarget = relation.getTarget(cms, CmsResourceFilter.ALL);
                      addRelationToResource(dbc, target, relTarget, relation.getType(), true);
                  } catch (CmsVfsResourceNotFoundException e) {
                      // ignore this broken relation
                      if (LOG.isWarnEnabled()) {
                          LOG.warn(e.getLocalizedMessage(), e);
                      }
                  }
              }
          }
          // repair categories
          repairCategories(dbc, getProjectIdForContext(dbc), target);
      }
docs: Copies all relations from the source resource to the target resource.<p>
  
  @param dbc the database context
  @param source the source
  @param target the target
  
  @throws CmsException if something goes wrong