Source:
public static WebAsset publishAsset(WebAsset currWebAsset, User user, boolean isNewVersion) throws WebAssetException, DotStateException, DotDataException, DotSecurityException { Logger.debug(WebAssetFactory.class, "Publishing asset!!!!"); Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset); WebAsset workingwebasset = null; workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false); if (!InodeUtils.isSet(workingwebasset.getInode())) { workingwebasset = currWebAsset; } Logger.debug(WebAssetFactory.class, "workingwebasset=" + workingwebasset.getInode()); WebAsset livewebasset = null; try { livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false); } catch (Exception e) { } if(workingwebasset.isDeleted()){ throw new WebAssetException("You may not publish deleted assets!!!"); } boolean localTransaction = false; try { localTransaction = HibernateUtil.startLocalTransactionIfNeeded(); APILocator.getVersionableAPI().setLive(workingwebasset); if(isNewVersion){ workingwebasset.setModDate(new java.util.Date()); workingwebasset.setModUser(user.getUserId()); } HibernateUtil.merge(workingwebasset); if(localTransaction) { HibernateUtil.closeAndCommitTransaction(); } } catch(Exception e){ Logger.error(WebAssetFactory.class, e.getMessage(), e); if(localTransaction){ HibernateUtil.rollbackTransaction(); } } Logger.debug(WebAssetFactory.class, "HibernateUtil.saveOrUpdate(workingwebasset)"); systemEventsAPI.pushAsync(SystemEventType.PUBLISH_LINK, new Payload(currWebAsset, Visibility.EXCLUDE_OWNER, new ExcludeOwnerVerifierBean(user.getUserId(), PermissionAPI.PERMISSION_READ, Visibility.PERMISSION))); return livewebasset; }

Target:
public static WebAsset publishAsset(WebAsset currWebAsset, User user, boolean isNewVersion) throws WebAssetException, DotStateException, DotDataException, DotSecurityException { Logger.debug(WebAssetFactory.class, "Publishing asset!!!!"); Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset); WebAsset workingwebasset = null; workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false); if (!InodeUtils.isSet(workingwebasset.getInode())) { workingwebasset = currWebAsset; } Logger.debug(WebAssetFactory.class, "workingwebasset=" + workingwebasset.getInode()); WebAsset livewebasset = null; try { livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false); } catch (Exception e) { } if(workingwebasset.isDeleted()){ throw new WebAssetException("You may not publish deleted assets!!!"); } boolean localTransaction = false; try { localTransaction = HibernateUtil.startLocalTransactionIfNeeded(); APILocator.getVersionableAPI().setLive(workingwebasset); if(isNewVersion){ workingwebasset.setModDate(new java.util.Date()); workingwebasset.setModUser(user.getUserId()); } HibernateUtil.merge(workingwebasset); if(localTransaction) { HibernateUtil.commitTransaction(); } } catch(Exception e){ Logger.error(WebAssetFactory.class, e.getMessage(), e); if(localTransaction){ HibernateUtil.rollbackTransaction(); } } finally { if(localTransaction) { DbConnectionFactory.closeConnection(); } } Logger.debug(WebAssetFactory.class, "HibernateUtil.saveOrUpdate(workingwebasset)"); systemEventsAPI.pushAsync(SystemEventType.PUBLISH_LINK, new Payload(currWebAsset, Visibility.EXCLUDE_OWNER, new ExcludeOwnerVerifierBean(user.getUserId(), PermissionAPI.PERMISSION_READ, Visibility.PERMISSION))); return livewebasset; }