src/main/java/org/edgegallery/appstore/application/inner/PackageService.java
public void publishPackage(String appId, String packageId, PublishAppReqDto publishAppReq) {
        Release release = packageRepository.findReleaseById(appId, packageId);
        if (release.getStatus() != EnumPackageStatus.Test_success) {
            LOGGER.error("Test status is {}, publish failed", release.getStatus());
            throw new AppException("Test status is not success, publish failed", ResponseConst.RET_PUBLISH_NO_TESTED);
        }
        if (!appRepository.find(appId).isPresent()) {
            throw new EntityNotFoundException(App.class, appId, ResponseConst.RET_APP_NOT_FOUND);
        }
        Optional<App> existedApp = appRepository
            .findByAppNameAndProvider(release.getAppBasicInfo().getAppName(),
                release.getAppBasicInfo().getProvider());
        if (existedApp.isPresent()) {
            App app = existedApp.get();
            app.checkReleases(release);
        }
        release.setStatus(EnumPackageStatus.Published);
        publishAppAndPackage(appId, release, publishAppReq);
    }
/**
     * publish a package.
     *
     * @param appId app id
     * @param packageId package id
     * @param publishAppReq publish request body
     */
publish a package.
@param appId app id
@param packageId package id
@param publishAppReq publish request body
publish a package . @param appId app id @param packageId package id @param publishAppReq publish request body
public void publishPackage(String appId, String packageId, PublishAppReqDto publishAppReq) {
        Release release = packageRepository.findReleaseById(appId, packageId);
        if (release.getStatus() != EnumPackageStatus.Test_success) {
            LOGGER.error("Test status is {}, publish failed", release.getStatus());
            throw new AppException("Test status is not success, publish failed", ResponseConst.RET_PUBLISH_NO_TESTED);
        }
        if (!appRepository.find(appId).isPresent()) {
            throw new EntityNotFoundException(App.class, appId, ResponseConst.RET_APP_NOT_FOUND);
        }
        Optional<App> existedApp = appRepository
            .findByAppNameAndProvider(release.getAppBasicInfo().getAppName(),
                release.getAppBasicInfo().getProvider());
        if (existedApp.isPresent()) {
            App app = existedApp.get();
            app.checkReleases(release);
        }
        release.setStatus(EnumPackageStatus.Published);
        publishAppAndPackage(appId, release, publishAppReq);
    }
public void publishPackage ( String appId , String packageId , PublishAppReqDto publishAppReq ) { Release release = packageRepository . findReleaseById ( appId , packageId ) ; if ( release . getStatus ( ) != EnumPackageStatus . Test_success ) { LOGGER . error ( "Test status is {}, publish failed" , release . getStatus ( ) ) ; throw new AppException ( "Test status is not success, publish failed" , ResponseConst . RET_PUBLISH_NO_TESTED ) ; } if ( ! appRepository . find ( appId ) . isPresent ( ) ) { throw new EntityNotFoundException ( App . class , appId , ResponseConst . RET_APP_NOT_FOUND ) ; } Optional < App > existedApp = appRepository . findByAppNameAndProvider ( release . getAppBasicInfo ( ) . getAppName ( ) , release . getAppBasicInfo ( ) . getProvider ( ) ) ; if ( existedApp . isPresent ( ) ) { App app = existedApp . get ( ) ; app . checkReleases ( release ) ; } release . setStatus ( EnumPackageStatus . Published ) ; publishAppAndPackage ( appId , release , publishAppReq ) ; }
publish a package.
publish a package .