src/main/java/org/edgegallery/appstore/application/inner/PackageService.java
public void updateAppById(MultipartFile iconFile, MultipartFile demoVideo, MultipartFile docFile,
        PackageDto packageDto) {
        String appId = packageDto.getAppId();
        Release release = packageRepository.findReleaseById(appId, packageDto.getPackageId());
        App app = appRepository.find(appId)
            .orElseThrow(() -> new EntityNotFoundException(App.class, appId, ResponseConst.RET_APP_NOT_FOUND));
        modifyPackageFile(docFile, packageDto.getShortDesc(), release);
        String fileParent = dir + File.separator + UUID.randomUUID().toString().replace("-", "");
        if (iconFile != null) {
            AFile icon = getFile(iconFile, new IconChecker(dir), fileParent);
            release.setIcon(icon);
        }
        if (demoVideo != null) {
            AFile demoVideoFile = getFile(demoVideo, new VideoChecker(dir), fileParent);
            release.setDemoVideo(demoVideoFile);
        }
        if (packageDto.getIndustry() != null) {
            release.setIndustry(packageDto.getIndustry());
            app.setIndustry(packageDto.getIndustry());
        }
        if (packageDto.getType() != null) {
            release.setApplicationType(packageDto.getType());
            app.setApplicationType(packageDto.getType());
        }
        if (packageDto.getAffinity() != null) {
            release.setAffinity(packageDto.getAffinity());
            app.setAffinity(packageDto.getAffinity());
        }
        if (packageDto.getShortDesc() != null) {
            release.getAppBasicInfo().setAppDesc(packageDto.getShortDesc());
            app.setShortDesc(packageDto.getShortDesc());
        }
        if (packageDto.getShowType() != null) {
            release.setShowType(packageDto.getShowType());
            app.setShowType(packageDto.getShowType());
        }
        if (docFile != null) {
            String mdContent = modifyAppDetail(docFile, release);
            if (mdContent != null) { // app detail may be empty content
                release.getAppBasicInfo().setMarkDownContent(mdContent);
            }
        }
        release.setExperienceAble(packageDto.isExperienceAble());
        appRepository.store(app);
        packageRepository.updateRelease(release);
    }
/**
     * update app package information.
     *
     * @param iconFile app icon
     * @param demoVideo app demo video
     * @param docFile app detail md file.
     * @param packageDto packageDto
     */
update app package information.
@param iconFile app icon
@param demoVideo app demo video
@param docFile app detail md file.
@param packageDto packageDto
update app package information . @param iconFile app icon @param demoVideo app demo video @param docFile app detail md file . @param packageDto packageDto
public void updateAppById(MultipartFile iconFile, MultipartFile demoVideo, MultipartFile docFile,
        PackageDto packageDto) {
        String appId = packageDto.getAppId();
        Release release = packageRepository.findReleaseById(appId, packageDto.getPackageId());
        App app = appRepository.find(appId)
            .orElseThrow(() -> new EntityNotFoundException(App.class, appId, ResponseConst.RET_APP_NOT_FOUND));
        modifyPackageFile(docFile, packageDto.getShortDesc(), release);
        String fileParent = dir + File.separator + UUID.randomUUID().toString().replace("-", "");
        if (iconFile != null) {
            AFile icon = getFile(iconFile, new IconChecker(dir), fileParent);
            release.setIcon(icon);
        }
        if (demoVideo != null) {
            AFile demoVideoFile = getFile(demoVideo, new VideoChecker(dir), fileParent);
            release.setDemoVideo(demoVideoFile);
        }
        if (packageDto.getIndustry() != null) {
            release.setIndustry(packageDto.getIndustry());
            app.setIndustry(packageDto.getIndustry());
        }
        if (packageDto.getType() != null) {
            release.setApplicationType(packageDto.getType());
            app.setApplicationType(packageDto.getType());
        }
        if (packageDto.getAffinity() != null) {
            release.setAffinity(packageDto.getAffinity());
            app.setAffinity(packageDto.getAffinity());
        }
        if (packageDto.getShortDesc() != null) {
            release.getAppBasicInfo().setAppDesc(packageDto.getShortDesc());
            app.setShortDesc(packageDto.getShortDesc());
        }
        if (packageDto.getShowType() != null) {
            release.setShowType(packageDto.getShowType());
            app.setShowType(packageDto.getShowType());
        }
        if (docFile != null) {
            String mdContent = modifyAppDetail(docFile, release);
            if (mdContent != null) { 
                release.getAppBasicInfo().setMarkDownContent(mdContent);
            }
        }
        release.setExperienceAble(packageDto.isExperienceAble());
        appRepository.store(app);
        packageRepository.updateRelease(release);
    }
public void updateAppById ( MultipartFile iconFile , MultipartFile demoVideo , MultipartFile docFile , PackageDto packageDto ) { String appId = packageDto . getAppId ( ) ; Release release = packageRepository . findReleaseById ( appId , packageDto . getPackageId ( ) ) ; App app = appRepository . find ( appId ) . orElseThrow ( ( ) -> new EntityNotFoundException ( App . class , appId , ResponseConst . RET_APP_NOT_FOUND ) ) ; modifyPackageFile ( docFile , packageDto . getShortDesc ( ) , release ) ; String fileParent = dir + File . separator + UUID . randomUUID ( ) . toString ( ) . replace ( "-" , "" ) ; if ( iconFile != null ) { AFile icon = getFile ( iconFile , new IconChecker ( dir ) , fileParent ) ; release . setIcon ( icon ) ; } if ( demoVideo != null ) { AFile demoVideoFile = getFile ( demoVideo , new VideoChecker ( dir ) , fileParent ) ; release . setDemoVideo ( demoVideoFile ) ; } if ( packageDto . getIndustry ( ) != null ) { release . setIndustry ( packageDto . getIndustry ( ) ) ; app . setIndustry ( packageDto . getIndustry ( ) ) ; } if ( packageDto . getType ( ) != null ) { release . setApplicationType ( packageDto . getType ( ) ) ; app . setApplicationType ( packageDto . getType ( ) ) ; } if ( packageDto . getAffinity ( ) != null ) { release . setAffinity ( packageDto . getAffinity ( ) ) ; app . setAffinity ( packageDto . getAffinity ( ) ) ; } if ( packageDto . getShortDesc ( ) != null ) { release . getAppBasicInfo ( ) . setAppDesc ( packageDto . getShortDesc ( ) ) ; app . setShortDesc ( packageDto . getShortDesc ( ) ) ; } if ( packageDto . getShowType ( ) != null ) { release . setShowType ( packageDto . getShowType ( ) ) ; app . setShowType ( packageDto . getShowType ( ) ) ; } if ( docFile != null ) { String mdContent = modifyAppDetail ( docFile , release ) ; if ( mdContent != null ) { release . getAppBasicInfo ( ) . setMarkDownContent ( mdContent ) ; } } release . setExperienceAble ( packageDto . isExperienceAble ( ) ) ; appRepository . store ( app ) ; packageRepository . updateRelease ( release ) ; }
update app package information.
update app package information .
// app detail may be empty content