src/main/java/org/edgegallery/appstore/interfaces/app/facade/AppServiceFacade.java
public ResponseEntity<List<PackageDto>> findAllPackages(String appId, String userId, int limit, long offset,
        String token) {
        Stream<Release> releaseStream = appRepository
            .findAllWithPagination(new PageCriteria(limit, offset, appId, null, null))
            .getResults().stream();
        if (userId == null) {
            /*
            scenario: go to the app detail page from app warehouse to get packages info,
            just need published, public or inner-public packages.
             */
            releaseStream = releaseStream.filter(p -> p.getStatus() == EnumPackageStatus.Published
                && ("public".equals(p.getShowType()) || "inner-public".equals(p.getShowType())));
        } else {
            releaseStream.filter(r -> r.getUser().getUserId().equals(userId))
                .filter(s -> s.getTestTaskId() != null && EnumPackageStatus.needRefresh(s.getStatus())).forEach(
                    s -> appService
                        .loadTestTask(s.getAppId(), s.getPackageId(), new AtpMetadata(s.getTestTaskId(), token)));
            releaseStream = appRepository
                .findAllWithPagination(new PageCriteria(limit, offset, appId, null, null))
                .getResults().stream().filter(r -> r.getUser().getUserId().equals(userId));
        }
        List<PackageDto> packageDtos = releaseStream.map(PackageDto::of).collect(Collectors.toList());
        return ResponseEntity.ok(packageDtos);
    }
/**
     * Find all package list by parameters follows.
     *
     * @param appId app id.
     * @param limit limit of single page.
     * @param offset offset of pages.
     * @return List<PackageDto></PackageDto>
     */
Find all package list by parameters follows.
@param appId app id.
@param limit limit of single page.
@param offset offset of pages.
@return List
Find all package list by parameters follows . @param appId app id . @param limit limit of single page . @param offset offset of pages . @return List
public ResponseEntity<List<PackageDto>> findAllPackages(String appId, String userId, int limit, long offset,
        String token) {
        Stream<Release> releaseStream = appRepository
            .findAllWithPagination(new PageCriteria(limit, offset, appId, null, null))
            .getResults().stream();
        if (userId == null) {
            /*
            scenario: go to the app detail page from app warehouse to get packages info,
            just need published, public or inner-public packages.
             */
            releaseStream = releaseStream.filter(p -> p.getStatus() == EnumPackageStatus.Published
                && ("public".equals(p.getShowType()) || "inner-public".equals(p.getShowType())));
        } else {
            releaseStream.filter(r -> r.getUser().getUserId().equals(userId))
                .filter(s -> s.getTestTaskId() != null && EnumPackageStatus.needRefresh(s.getStatus())).forEach(
                    s -> appService
                        .loadTestTask(s.getAppId(), s.getPackageId(), new AtpMetadata(s.getTestTaskId(), token)));
            releaseStream = appRepository
                .findAllWithPagination(new PageCriteria(limit, offset, appId, null, null))
                .getResults().stream().filter(r -> r.getUser().getUserId().equals(userId));
        }
        List<PackageDto> packageDtos = releaseStream.map(PackageDto::of).collect(Collectors.toList());
        return ResponseEntity.ok(packageDtos);
    }
public ResponseEntity < List < PackageDto > > findAllPackages ( String appId , String userId , int limit , long offset , String token ) { Stream < Release > releaseStream = appRepository . findAllWithPagination ( new PageCriteria ( limit , offset , appId , null , null ) ) . getResults ( ) . stream ( ) ; if ( userId == null ) { /*
            scenario: go to the app detail page from app warehouse to get packages info,
            just need published, public or inner-public packages.
             */ releaseStream = releaseStream . filter ( p -> p . getStatus ( ) == EnumPackageStatus . Published && ( "public" . equals ( p . getShowType ( ) ) || "inner-public" . equals ( p . getShowType ( ) ) ) ) ; } else { releaseStream . filter ( r -> r . getUser ( ) . getUserId ( ) . equals ( userId ) ) . filter ( s -> s . getTestTaskId ( ) != null && EnumPackageStatus . needRefresh ( s . getStatus ( ) ) ) . forEach ( s -> appService . loadTestTask ( s . getAppId ( ) , s . getPackageId ( ) , new AtpMetadata ( s . getTestTaskId ( ) , token ) ) ) ; releaseStream = appRepository . findAllWithPagination ( new PageCriteria ( limit , offset , appId , null , null ) ) . getResults ( ) . stream ( ) . filter ( r -> r . getUser ( ) . getUserId ( ) . equals ( userId ) ) ; } List < PackageDto > packageDtos = releaseStream . map ( PackageDto :: of ) . collect ( Collectors . toList ( ) ) ; return ResponseEntity . ok ( packageDtos ) ; }
Find all package list by parameters follows.
Find all package list by parameters follows .