src/main/java/org/edgegallery/appstore/application/inner/PushablePackageService.java
public List<Boolean> pushPackage(String packageId, PushTargetAppStoreDto targetAppStore) {
        final PushablePackageDto packagePo = pushablePackageRepository.getPushablePackages(packageId);
        packagePo.setSourcePlatform(context.platformName);

        // to check the atp report
        if (!toCheckAndUpdateAtpReport(packagePo)) {
            LOGGER.warn("atp test failed, can not publish to other app store. package id: {}, atp task id: {}",
                packagePo.getPackageId(), packagePo.getAtpTestTaskId());
            final List<Boolean> results = new ArrayList<>();
            targetAppStore.getTargetPlatform().forEach(platformId -> results.add(false));
            return results;
        }

        final List<Boolean> results = new ArrayList<>();
        LOGGER.info("push package {}", packagePo.getPackageId());
        targetAppStore.getTargetPlatform().forEach(platformId -> {
            AppStore appStore = appStoreRepository.queryAppStoreById(platformId);
            if (appStore == null) {
                results.add(false);
                return;
            }
            String url = appStore.getUrl() + NOTICE_API;
            LOGGER.info(url);

            MessageReqDto requestDto = generatorMessageRequest(appStore.getAppStoreName(), packagePo);

            MessageReqDto messageReqDto = pushNotice(url, requestDto);
            if (messageReqDto == null) {
                results.add(false);
                return;
            }
            Message message = messageReqDto.toMessage(EnumMessageType.PUSH);

            // store message to the db
            messageRepository.addMessage(message);

            results.add(true);
        });
        // update the push log
        pushablePackageRepository.updateOrSavePushLog(packagePo);
        return results;
    }
/**
     * push package to target appstore.
     *
     * @param packageId package id
     * @param targetAppStore target appstore
     */
push package to target appstore.
@param packageId package id
@param targetAppStore target appstore
push package to target appstore . @param packageId package id @param targetAppStore target appstore
public List<Boolean> pushPackage(String packageId, PushTargetAppStoreDto targetAppStore) {
        final PushablePackageDto packagePo = pushablePackageRepository.getPushablePackages(packageId);
        packagePo.setSourcePlatform(context.platformName);
        if (!toCheckAndUpdateAtpReport(packagePo)) {
            LOGGER.warn("atp test failed, can not publish to other app store. package id: {}, atp task id: {}",
                packagePo.getPackageId(), packagePo.getAtpTestTaskId());
            final List<Boolean> results = new ArrayList<>();
            targetAppStore.getTargetPlatform().forEach(platformId -> results.add(false));
            return results;
        }
        final List<Boolean> results = new ArrayList<>();
        LOGGER.info("push package {}", packagePo.getPackageId());
        targetAppStore.getTargetPlatform().forEach(platformId -> {
            AppStore appStore = appStoreRepository.queryAppStoreById(platformId);
            if (appStore == null) {
                results.add(false);
                return;
            }
            String url = appStore.getUrl() + NOTICE_API;
            LOGGER.info(url);
            MessageReqDto requestDto = generatorMessageRequest(appStore.getAppStoreName(), packagePo);
            MessageReqDto messageReqDto = pushNotice(url, requestDto);
            if (messageReqDto == null) {
                results.add(false);
                return;
            }
            Message message = messageReqDto.toMessage(EnumMessageType.PUSH);
            messageRepository.addMessage(message);
            results.add(true);
        });
        pushablePackageRepository.updateOrSavePushLog(packagePo);
        return results;
    }
public List < Boolean > pushPackage ( String packageId , PushTargetAppStoreDto targetAppStore ) { final PushablePackageDto packagePo = pushablePackageRepository . getPushablePackages ( packageId ) ; packagePo . setSourcePlatform ( context . platformName ) ; if ( ! toCheckAndUpdateAtpReport ( packagePo ) ) { LOGGER . warn ( "atp test failed, can not publish to other app store. package id: {}, atp task id: {}" , packagePo . getPackageId ( ) , packagePo . getAtpTestTaskId ( ) ) ; final List < Boolean > results = new ArrayList < > ( ) ; targetAppStore . getTargetPlatform ( ) . forEach ( platformId -> results . add ( false ) ) ; return results ; } final List < Boolean > results = new ArrayList < > ( ) ; LOGGER . info ( "push package {}" , packagePo . getPackageId ( ) ) ; targetAppStore . getTargetPlatform ( ) . forEach ( platformId -> { AppStore appStore = appStoreRepository . queryAppStoreById ( platformId ) ; if ( appStore == null ) { results . add ( false ) ; return ; } String url = appStore . getUrl ( ) + NOTICE_API ; LOGGER . info ( url ) ; MessageReqDto requestDto = generatorMessageRequest ( appStore . getAppStoreName ( ) , packagePo ) ; MessageReqDto messageReqDto = pushNotice ( url , requestDto ) ; if ( messageReqDto == null ) { results . add ( false ) ; return ; } Message message = messageReqDto . toMessage ( EnumMessageType . PUSH ) ; messageRepository . addMessage ( message ) ; results . add ( true ) ; } ) ; pushablePackageRepository . updateOrSavePushLog ( packagePo ) ; return results ; }
push package to target appstore.
push package to target appstore .
// to check the atp report // store message to the db // update the push log