@ -27,6 +27,7 @@ import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.service.UdfFuncService ;
import org.apache.dolphinscheduler.api.service.UdfFuncService ;
import org.apache.dolphinscheduler.api.utils.Result ;
import org.apache.dolphinscheduler.api.utils.Result ;
import org.apache.dolphinscheduler.common.Constants ;
import org.apache.dolphinscheduler.common.Constants ;
import org.apache.dolphinscheduler.common.enums.ProgramType ;
import org.apache.dolphinscheduler.common.enums.ResourceType ;
import org.apache.dolphinscheduler.common.enums.ResourceType ;
import org.apache.dolphinscheduler.common.enums.UdfType ;
import org.apache.dolphinscheduler.common.enums.UdfType ;
import org.apache.dolphinscheduler.common.utils.ParameterUtils ;
import org.apache.dolphinscheduler.common.utils.ParameterUtils ;
@ -275,7 +276,7 @@ public class ResourcesController extends BaseController {
* @param type resource type
* @param type resource type
* @return resource list
* @return resource list
* /
* /
@ApiOperation ( value = "queryResourceJarList " , notes = "QUERY_RESOURCE_LIST_NOTES" )
@ApiOperation ( value = "queryResourceByProgramType " , notes = "QUERY_RESOURCE_LIST_NOTES" )
@ApiImplicitParams ( {
@ApiImplicitParams ( {
@ApiImplicitParam ( name = "type" , value = "RESOURCE_TYPE" , required = true , dataType = "ResourceType" )
@ApiImplicitParam ( name = "type" , value = "RESOURCE_TYPE" , required = true , dataType = "ResourceType" )
} )
} )
@ -283,10 +284,14 @@ public class ResourcesController extends BaseController {
@ResponseStatus ( HttpStatus . OK )
@ResponseStatus ( HttpStatus . OK )
@ApiException ( QUERY_RESOURCES_LIST_ERROR )
@ApiException ( QUERY_RESOURCES_LIST_ERROR )
public Result queryResourceJarList ( @ApiIgnore @RequestAttribute ( value = Constants . SESSION_USER ) User loginUser ,
public Result queryResourceJarList ( @ApiIgnore @RequestAttribute ( value = Constants . SESSION_USER ) User loginUser ,
@RequestParam ( value = "type" ) ResourceType type
@RequestParam ( value = "type" ) ResourceType type ,
@RequestParam ( value = "programType" , required = false ) ProgramType programType
) {
) {
logger . info ( "query resource list, login user:{}, resource type:{}" , loginUser . getUserName ( ) , type . toString ( ) ) ;
String programTypeName = programType = = null ? "" : programType . name ( ) ;
Map < String , Object > result = resourceService . queryResourceJarList ( loginUser , type ) ;
String userName = loginUser . getUserName ( ) ;
userName = userName . replaceAll ( "[\n|\r|\t]" , "_" ) ;
logger . info ( "query resource list, login user:{}, resource type:{}, program type:{}" , userName , programTypeName ) ;
Map < String , Object > result = resourceService . queryResourceByProgramType ( loginUser , type , programType ) ;
return returnDataList ( result ) ;
return returnDataList ( result ) ;
}
}