KomodoVdbService extends KomodoService { @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all permissions belonging to the vdb data role", response = RestVdbPermission[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb or data role could be found with given names"), @ApiResponse(code = 200, message = "No permissions could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) public Response getPermissions( final @Context HttpHeaders headers, final @Context UriInfo uriInfo, @ApiParam(value = "Name of the Vdb", required = true) final @PathParam( "vdbName" ) String vdbName, @ApiParam(value = "Name of the Data Role to get its permissions", required = true) final @PathParam( "dataRoleId" ) String dataRoleId) throws KomodoRestException { SecurityPrincipal principal = checkSecurityContext(headers); if (principal.hasErrorResponse()) return principal.getErrorResponse(); List<MediaType> mediaTypes = headers.getAcceptableMediaTypes(); UnitOfWork uow = null; try { uow = createTransaction(principal, "getPermissions", true ); Vdb vdb = findVdb(uow, vdbName); if (vdb == null) return commitNoVdbFound(uow, mediaTypes, vdbName); DataRole dataRole = findDataRole(uow, mediaTypes, dataRoleId, vdb); if (dataRole == null) { return commitNoDataRoleFound(uow, mediaTypes, dataRoleId, vdbName); } Permission[] permissions = dataRole.getPermissions(uow); if (permissions == null) permissions = new Permission[0]; List<RestVdbPermission> restPermissions = new ArrayList<>(permissions.length); for (Permission permission : permissions) { RestVdbPermission entity = entityFactory.create(permission, uriInfo.getBaseUri(), uow); restPermissions.add(entity); LOGGER.debug("getPermissions:Permission from Data role '{0}' from VDB '{1}' entity was constructed", dataRoleId, vdbName); } return commit( uow, mediaTypes, restPermissions); } catch ( final Exception e ) { if ( ( uow != null ) && ( uow.getState() != State.ROLLED_BACK ) ) { uow.rollback(); } if ( e instanceof KomodoRestException ) { throw ( KomodoRestException )e; } return createErrorResponseWithForbidden(mediaTypes, e, VDB_SERVICE_GET_PERMISSIONS_ERROR, vdbName); } } KomodoVdbService( final KEngine engine ); @POST @Path( StringConstants.FORWARD_SLASH + V1Constants.VDB_PLACEHOLDER ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Create a vdb in the workspace") @ApiResponses(value = { @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response createVdb( final @Context HttpHeaders headers,
                               final @Context UriInfo uriInfo,
                               @ApiParam(
                                         value = "Name of the Vdb to be created",
                                         required = true
                               )
                               final @PathParam( "vdbName" ) String vdbName,
                               @ApiParam(
                                         value = "" + 
                                                 "JSON of the properties of the Vdb to add:<br>" +
                                                 OPEN_PRE_TAG +
                                                 OPEN_BRACE + BR +
                                                 NBSP + "keng\\_\\_id: \"name of the Vdb\"" + COMMA + BR +
                                                 NBSP + "vdb\\_\\_name: \"name of the Vdb\"" + COMMA + BR +
                                                 NBSP + "keng\\_\\_dataPath: \"path of Vdb to create\"" + COMMA + BR +
                                                 NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\")" + CLOSE_PRE_CMT + BR +
                                                 NBSP + "vdb\\_\\_originalFile: \"original file location\"" + COMMA + BR +
                                                 NBSP + OPEN_PRE_CMT + "(same value as keng\\_\\_dataPath)" + CLOSE_PRE_CMT + BR +
                                                 NBSP + "keng\\_\\_kType: \"Vdb\"" + BR +
                                                 CLOSE_BRACE +
                                                 CLOSE_PRE_TAG,
                                         required = true
                               )
                               final String vdbJson); @PUT @Path( StringConstants.FORWARD_SLASH + V1Constants.VDB_PLACEHOLDER ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Update a vdb in the workspace") @ApiResponses(value = { @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response updateVdb( final @Context HttpHeaders headers,
                               final @Context UriInfo uriInfo,
                               @ApiParam(
                                         value = "Name of the Vdb to be updated",
                                         required = true
                               )
                               final @PathParam( "vdbName" ) String vdbName,
                               @ApiParam(
                                         value = "" + 
                                                 "JSON of the properties of the Vdb to update:<br>" +
                                                 OPEN_PRE_TAG +
                                                 OPEN_BRACE + BR +
                                                 NBSP + "keng\\_\\_id: \"name of the Vdb\"" + COMMA + BR +
                                                 NBSP + "vdb\\_\\_name: \"name of the Vdb\"" + COMMA + BR +
                                                 NBSP + "keng\\_\\_dataPath: \"path of Vdb to update\"" + COMMA + BR +
                                                 NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\")" + CLOSE_PRE_CMT + BR +
                                                 NBSP + "vdb\\_\\_originalFile: \"original file location\"" + COMMA + BR +
                                                 NBSP + OPEN_PRE_CMT + "(same value as keng\\_\\_dataPath)" + CLOSE_PRE_CMT + BR +
                                                 NBSP + "keng\\_\\_kType: \"Vdb\"" + BR +
                                                 CLOSE_BRACE +
                                                 CLOSE_PRE_TAG,
                                         required = true
                               )
                               final String vdbJson); @POST @Path( StringConstants.FORWARD_SLASH + V1Constants.CLONE_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.VDB_PLACEHOLDER ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Clone a VDB in the workspace") @ApiResponses(value = { @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response cloneVdb( final @Context HttpHeaders headers,
                              final @Context UriInfo uriInfo,
                              @ApiParam(
                                        value = "Name of the Vdb to be cloned",
                                        required = true
                              )
                              final @PathParam( "vdbName" ) String vdbName,
                              @ApiParam(
                                        value = "name of the new Vdb", 
                                        required = true
                              )
                              final String newVdbName); @DELETE @Path("{vdbName}") @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Delete a vdb from the workspace") @ApiResponses(value = { @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response deleteVdb( final @Context HttpHeaders headers,
                               final @Context UriInfo uriInfo,
                               @ApiParam(
                                         value = "Name of the Vdb to be removed",
                                         required = true
                               )
                               final @PathParam( "vdbName" ) String vdbName); @GET @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Display the collection of vdbs", response = RestVdb[].class) @ApiResponses(value = { @ApiResponse(code = 403, message = "An error has occurred.") }) Response getVdbs( final @Context HttpHeaders headers,
                             final @Context UriInfo uriInfo ); @GET @Path( V1Constants.VDB_PLACEHOLDER ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @ApiOperation(value = "Find vdb by name", response = RestVdb.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 406, message = "Only JSON or XML is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getVdb( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb to be fetched", required = true)
                            final @PathParam( "vdbName" ) String vdbName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all models belonging to the vdb", response = RestVdb.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No models could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModels( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the named model belonging to the vdb", response = RestVdbModel.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModel( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model to be fetched", required = true)
                            final @PathParam( "modelName" ) String modelName); @POST @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Create a Model in a VDB") @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response createModel( final @Context HttpHeaders headers,
                                 final @Context UriInfo uriInfo,
                                 @ApiParam(
                                           value = "Name of the Vdb",
                                           required = true
                                 )
                                 final @PathParam( "vdbName" ) String vdbName,
                                 @ApiParam(
                                           value = "Name of the Model",
                                           required = true
                                 )
                                 final @PathParam( "modelName" ) String modelName,
                                 @ApiParam(
                                           value = "" + 
                                                   "JSON of the properties of the Model to add:<br>" +
                                                   OPEN_PRE_TAG +
                                                   OPEN_BRACE + BR +
                                                   NBSP + "keng\\_\\_id: \"name of the Model\"" + COMMA + BR +
                                                   NBSP + "keng\\_\\_dataPath: \"path of Model to create\"" + COMMA + BR +
                                                   NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\\\\{modelName\\}\")" + CLOSE_PRE_CMT + BR +
                                                   NBSP + "keng\\_\\_kType: \"Model\"" + BR +
                                                   CLOSE_BRACE +
                                                   CLOSE_PRE_TAG,
                                           required = true
                                 )
                                 final String modelJson); @PUT @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Update a Model in the VDB") @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response updateModel( final @Context HttpHeaders headers,
                                 final @Context UriInfo uriInfo,
                                 @ApiParam(
                                           value = "Name of the Vdb",
                                           required = true
                                 )
                                 final @PathParam( "vdbName" ) String vdbName,
                                 @ApiParam(
                                           value = "Name of the Model to be updated",
                                           required = true
                                 )
                                 final @PathParam( "modelName" ) String modelName,
                                 @ApiParam(
                                           value = "" + 
                                                   "JSON of the properties of the Model to update:<br>" +
                                                   OPEN_PRE_TAG +
                                                   OPEN_BRACE + BR +
                                                   NBSP + "keng\\_\\_id: \"name of the Model\"" + COMMA + BR +
                                                   NBSP + "keng\\_\\_dataPath: \"path of Model to update\"" + COMMA + BR +
                                                   NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\\\\{modelName\\}\")" + CLOSE_PRE_CMT + BR +
                                                   NBSP + "keng\\_\\_kType: \"Model\"" + BR +
                                                   CLOSE_BRACE +
                                                   CLOSE_PRE_TAG,
                                           required = true
                                 )
                                 final String modelJson); @DELETE @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Delete a Model from the VDB") @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response deleteModel( final @Context HttpHeaders headers,
                                 final @Context UriInfo uriInfo,
                                 @ApiParam(
                                           value = "Name of the Vdb",
                                           required = true
                                 )
                                 final @PathParam( "vdbName" ) String vdbName,
                                 @ApiParam(
                                           value = "Name of the Model to remove",
                                           required = true
                                 )
                                 final @PathParam( "modelName" ) String modelName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.TRANSLATORS_SEGMENT ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all translators belonging to the Vdb", response = RestVdbTranslator[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No translators could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getTranslators( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the VDB", required = true)
                            final @PathParam( "vdbName" ) String vdbName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.TRANSLATORS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.TRANSLATOR_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the named translator belonging to the vdb", response = RestVdbTranslator.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No translator could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getTranslator( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the translator to be fetched", required = true)
                            final @PathParam( "translatorName" ) String translatorName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.IMPORTS_SEGMENT ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all imports belonging to the vdb", response = RestVdbImport[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No imports could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getImports( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.IMPORTS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.IMPORT_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the named vdb import belonging to the vdb", response = RestVdbImport.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No import could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getImport( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Vdb import to be fetched", required = true)
                            final @PathParam( "importName" ) String importName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all data roles belonging to the vdb", response = RestBasicEntity[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No data roles could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getDataRoles( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName); @POST @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Create a VDB data role") @ApiResponses(value = { @ApiResponse(code = 404, message = "No VDB could be found with specified name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response createDataRole( final @Context HttpHeaders headers,
                                    final @Context UriInfo uriInfo,
                                    @ApiParam( value = "Name of the VDB", required = true ) 
                                    final @PathParam( "vdbName" ) String vdbName,
                                    @ApiParam( value = "Name of the data role", required = true )
                                    final @PathParam( "dataRoleId" ) String dataRoleName,
                                    @ApiParam( value = ""
                                                       + "JSON of the properties of the data role to add:<br>"
                                                       + OPEN_PRE_TAG
                                                       + OPEN_BRACE
                                                       + BR
                                                       + NBSP
                                                       + "keng\\_\\_id: \"name of the data role\""
                                                       + COMMA
                                                       + BR
                                                       + NBSP
                                                       + "keng\\_\\_dataPath: \"path of the data role to create\""
                                                       + COMMA
                                                       + BR
                                                       + NBSP
                                                       + OPEN_PRE_CMT
                                                       + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\\vdb:dataRoles\\\\{dataRoleName\\}\")"
                                                       + CLOSE_PRE_CMT
                                                       + BR
                                                       + NBSP
                                                       + "keng\\_\\_kType: \"DataRole\""
                                                       + BR
                                                       + CLOSE_BRACE
                                                       + CLOSE_PRE_TAG, required = true )
                                    final String dataRoleJson ); @DELETE @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER ) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation( value = "Delete a data role from the VDB" ) @ApiResponses( value = { @ApiResponse( code = 404, message = "No VDB could be found with name" ), @ApiResponse( code = 404, message = "No data role could be found with name" ), @ApiResponse( code = 406, message = "Only JSON is returned by this operation" ), @ApiResponse( code = 403, message = "An error has occurred." ) } ) Response deleteDataRole( final @Context HttpHeaders headers,
                                    final @Context UriInfo uriInfo,
                                    @ApiParam( value = "Name of the VDB", required = true ) final @PathParam( "vdbName" ) String vdbName,
                                    @ApiParam( value = "Name of the data role to remove", required = true ) final @PathParam( "dataRoleId" ) String dataRoleName ); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the named data role belonging to the vdb", response = RestVdbDataRole.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No data role could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getDataRole( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role to be fetched", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.SOURCES_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all ModelSources belonging to the Vdb Model", response = RestVdbModelSource[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No sources could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModelSources( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model to get its Sources", required = true)
                            final @PathParam( "modelName" ) String modelName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.SOURCES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.SOURCE_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the ModelSource belonging to the Vdb Model", response = RestVdbModelSource.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 404, message = "No source could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModelSource( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model", required = true)
                            final @PathParam( "modelName" ) String modelName,
                            @ApiParam(value = "Name of the Model Source to be fetched", required = true)
                            final @PathParam( "sourceName" ) String sourceName); @POST @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.SOURCES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.SOURCE_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Create a ModelSource within a Vdb Model", response = RestVdbModelSource.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response createModelSource( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model", required = true)
                            final @PathParam( "modelName" ) String modelName,
                            @ApiParam(value = "Name of the Model Source to be created", required = true)
                            final @PathParam( "sourceName" ) String sourceName,
                            @ApiParam(
                                      value = "" + 
                                              "JSON of the properties of the Model Source to add:<br>" +
                                              OPEN_PRE_TAG +
                                              OPEN_BRACE + BR +
                                              NBSP + "keng\\_\\_id: \"name of the VdbModelSource\"" + COMMA + BR +
                                              NBSP + "keng\\_\\_dataPath: \"path of VdbModelSource to create\"" + COMMA + BR +
                                              NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\\\\{modelName\\}\\vdb:sources\\\\{sourceName\\}\")" + CLOSE_PRE_CMT + BR +
                                              NBSP + "keng\\_\\_kType: \"VdbModelSource\"" + COMMA + BR +
                                              NBSP + "vdb\\_\\_sourceJndiName: \"the jndi name\"" + COMMA + BR +
                                              NBSP + "vdb\\_\\_sourceTranslator: \"the translator name\"" + BR +
                                              CLOSE_BRACE +
                                              CLOSE_PRE_TAG,
                                      required = true
                            )
                            final String sourceJson); @PUT @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.SOURCES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.SOURCE_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Update the ModelSource belonging to the Vdb Model", response = RestVdbModelSource.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 404, message = "No source could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response updateModelSource( final @Context HttpHeaders headers,
                                       final @Context UriInfo uriInfo,
                                       @ApiParam(value = "Name of the Vdb", required = true)
                                       final @PathParam( "vdbName" ) String vdbName,
                                       @ApiParam(value = "Name of the Model", required = true)
                                       final @PathParam( "modelName" ) String modelName,
                                       @ApiParam(value = "Name of the Model Source to be updated", required = true)
                                       final @PathParam( "sourceName" ) String sourceName,
                                       @ApiParam(
                                                 value = "" + 
                                                         "JSON of the properties of the Model Source to update:<br>" +
                                                         OPEN_PRE_TAG +
                                                         OPEN_BRACE + BR +
                                                         NBSP + "keng\\_\\_id: \"name of the VdbModelSource\"" + COMMA + BR +
                                                         NBSP + "keng\\_\\_dataPath: \"path of VdbModelSource to update\"" + COMMA + BR +
                                                         NBSP + OPEN_PRE_CMT + "(eg keng\\_\\_dataPath: \"tko:komodo\\tko:workspace\\\\{username\\}\\\\{vdbName\\}\\\\{modelName\\}\\vdb:sources\\\\{sourceName\\}\")" + CLOSE_PRE_CMT + BR +
                                                         NBSP + "keng\\_\\_kType: \"VdbModelSource\"" + COMMA + BR +
                                                         NBSP + "vdb\\_\\_sourceJndiName: \"the jndi name\"" + COMMA + BR +
                                                         NBSP + "vdb\\_\\_sourceTranslator: \"the translator name\"" + BR +
                                                         CLOSE_BRACE +
                                                         CLOSE_PRE_TAG,
                                                 required = true
                                       )
                                       final String sourceJson); @DELETE @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.SOURCES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.SOURCE_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Delete the ModelSource in the specified Vdb Model", response = RestVdbModelSource.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 404, message = "No model could be found with name"), @ApiResponse(code = 404, message = "No source could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response deleteModelSource( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model", required = true)
                            final @PathParam( "modelName" ) String modelName,
                            @ApiParam(value = "Name of the Model Source to be deleted", required = true)
                            final @PathParam( "sourceName" ) String sourceName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.TABLES_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all tables of the model belonging to the vdb", response = RestVdbModelTable[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No tables could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModelTables( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model to get its tables", required = true)
                            final @PathParam( "modelName" ) String modelName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MODELS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MODEL_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.TABLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.TABLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.COLUMNS_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all columns of the specified vdb model table", response = RestVdbModelTableColumn[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb could be found with name"), @ApiResponse(code = 200, message = "No tables could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getModelTableColumns( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Model", required = true)
                            final @PathParam( "modelName" ) String modelName,
        	                @ApiParam(value = "Name of the Table to get its columns", required = true)
                            final @PathParam( "tableName" ) String tableName); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find all permissions belonging to the vdb data role", response = RestVdbPermission[].class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb or data role could be found with given names"), @ApiResponse(code = 200, message = "No permissions could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getPermissions( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role to get its permissions", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.PERMISSION_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the named permission belonging to the data role of the vdb", response = RestVdbPermission.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb, data role or permission could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getPermission( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId,
                            @ApiParam(value = "Name of the Permission to be fetched", required = true)
                            final @PathParam( "permissionId" ) String permissionId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.PERMISSION_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.CONDITIONS_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the conditions belonging to the permission of the data role of the vdb", response = RestVdbPermission.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb, data role or permission could be found with given names"), @ApiResponse(code = 200, message = "No conditions could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getConditions( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId,
                            @ApiParam(value = "Name of the Permission to get its Conditions", required = true)
                            final @PathParam( "permissionId" ) String permissionId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.PERMISSION_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.CONDITIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.CONDITION_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the condition belonging to the permission of the data role of the vdb", response = RestVdbPermission.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb, data role, permission or condition could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getCondition( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId,
                            @ApiParam(value = "Name of the Permission", required = true)
                            final @PathParam( "permissionId" ) String permissionId,
                            @ApiParam(value = "Name of the Condition to be fetched", required = true)
                            final @PathParam( "conditionId" ) String conditionId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.PERMISSION_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MASKS_SEGMENT) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the masks belonging to the permission of the data role of the vdb", response = RestVdbPermission.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb, data role or permission could be found with given names"), @ApiResponse(code = 200, message = "No masks could be found but an empty list is returned"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getMasks( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId,
                            @ApiParam(value = "Name of the Permission to get its Masks", required = true)
                            final @PathParam( "permissionId" ) String permissionId); @GET @Path( V1Constants.VDB_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLES_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.DATA_ROLE_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.PERMISSIONS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.PERMISSION_PLACEHOLDER + StringConstants.FORWARD_SLASH + V1Constants.MASKS_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.MASK_PLACEHOLDER) @Produces( MediaType.APPLICATION_JSON ) @ApiOperation(value = "Find the mask belonging to the permission of the data role of the vdb", response = RestVdbPermission.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "No vdb, data role, permission or mask could be found with name"), @ApiResponse(code = 406, message = "Only JSON is returned by this operation"), @ApiResponse(code = 403, message = "An error has occurred.") }) Response getMask( final @Context HttpHeaders headers,
                            final @Context UriInfo uriInfo,
                            @ApiParam(value = "Name of the Vdb", required = true)
                            final @PathParam( "vdbName" ) String vdbName,
                            @ApiParam(value = "Name of the Data Role", required = true)
                            final @PathParam( "dataRoleId" ) String dataRoleId,
                            @ApiParam(value = "Name of the Permission", required = true)
                            final @PathParam( "permissionId" ) String permissionId,
                            @ApiParam(value = "Name of the Mask to be fetched", required = true)
                            final @PathParam( "maskId" ) String maskId); @GET @Path( V1Constants.NAME_VALIDATION_SEGMENT + StringConstants.FORWARD_SLASH + V1Constants.VDB_PLACEHOLDER ) @Produces( { MediaType.TEXT_PLAIN } ) @ApiOperation( value = "Returns an error message if the VDB name is invalid" ) @ApiResponses( value = { @ApiResponse( code = 400, message = "The URI cannot contain encoded slashes or backslashes." ), @ApiResponse( code = 403, message = "An unexpected error has occurred." ), @ApiResponse( code = 500, message = "The VDB name cannot be empty." ) } ) Response validateVdbName( final @Context HttpHeaders headers,
                                     final @Context UriInfo uriInfo,
                                     @ApiParam( value = "The VDB name being checked", required = true )
                                     final @PathParam( "vdbName" ) String vdbName );  }
@Test public void shouldCreateDataRole() throws Exception { loadVdbs(); final String dataRoleName = "MyDataRole"; final Properties settings = _uriBuilder.createSettings( SettingNames.VDB_NAME, TestUtilities.PORTFOLIO_VDB_NAME ); _uriBuilder.addSetting( settings, SettingNames.VDB_PARENT_PATH, _uriBuilder.workspaceVdbsUri() ); _uriBuilder.addSetting( settings, SettingNames.DATA_ROLE_ID, dataRoleName ); final URI uri = _uriBuilder.vdbDataRoleUri( LinkType.SELF, settings ); final boolean allowCreateTempTables = true; final boolean anyAuthenticated = true; final String dataPath = "/tko:komodo/tko:workspace/user/" + TestUtilities.PORTFOLIO_VDB_NAME + '/' + VdbLexicon.Vdb.DATA_ROLES + '/' + dataRoleName; final String description = "My data role description"; final boolean grantAll = true; final String[] mappedRoles = new String[] { "a", "b", "c", "d", "e" }; final KomodoType type = KomodoType.VDB_DATA_ROLE; final String id = dataRoleName; final String permissionName = "MyPermission"; final String permissionId = permissionName; final KomodoType permissionType = KomodoType.VDB_PERMISSION; final String permissionDataPath = dataPath + '/' + VdbLexicon.DataRole.PERMISSIONS + '/' + permissionName; final boolean allowAlter = true; final boolean allowCreate = false; final boolean allowDelete = true; final boolean allowExecute = false; final boolean allowLanguage = true; final boolean allowRead = false; final boolean allowUpdate = true; { final RestVdbDataRole inDataRole = new RestVdbDataRole(); inDataRole.setAllowCreateTempTables( allowCreateTempTables ); inDataRole.setAnyAuthenticated( anyAuthenticated ); inDataRole.setDataPath( dataPath ); inDataRole.setDescription( description ); inDataRole.setGrantAll( grantAll ); inDataRole.setId( id ); inDataRole.setkType( type ); inDataRole.setMappedRoles( mappedRoles ); inDataRole.setName( dataRoleName ); final RestVdbPermission permission = new RestVdbPermission(); permission.setName( permissionName ); permission.setAllowAlter( allowAlter ); permission.setAllowCreate( allowCreate ); permission.setAllowDelete( allowDelete ); permission.setAllowExecute( allowExecute ); permission.setAllowLanguage( allowLanguage ); permission.setAllowRead( allowRead ); permission.setAllowUpdate( allowUpdate ); permission.setId( permissionId ); permission.setkType( permissionType ); permission.setDataPath( permissionDataPath ); inDataRole.setPermissions( new RestVdbPermission[] { permission } ); final String json = KomodoJsonMarshaller.marshall( inDataRole ); final ClientRequest request = request( uri, MediaType.APPLICATION_JSON_TYPE ); addBody( request, json ); final ClientResponse< String > response = request.post( String.class ); assertThat( response, is( notNullValue() ) ); assertThat( response.getStatus(), is( Response.Status.OK.getStatusCode() ) ); final String entity = response.getEntity(); assertThat( entity, is( notNullValue() ) ); final RestVdbDataRole outDataRole = KomodoJsonMarshaller.unmarshall( entity, RestVdbDataRole.class ); assertNotNull( outDataRole ); assertThat( outDataRole.isAllowCreateTempTables(), is( allowCreateTempTables ) ); assertThat( outDataRole.isAnyAuthenticated(), is( anyAuthenticated ) ); assertThat( outDataRole.getDataPath(), is( dataPath ) ); assertThat( outDataRole.getDescription(), is( description ) ); assertThat( outDataRole.isGrantAll(), is( grantAll ) ); assertThat( outDataRole.getId(), is( id ) ); assertThat( outDataRole.getkType(), is( type ) ); assertThat( Arrays.equals( outDataRole.getMappedRoles(), mappedRoles ), is( true ) ); assertThat( outDataRole.getName(), is( dataRoleName ) ); assertThat( outDataRole.getPermissions().length, is( 1 ) ); final RestVdbPermission outPermission = outDataRole.getPermissions()[0]; assertThat( outPermission.getName(), is( permissionName ) ); assertThat( outPermission.isAllowAlter(), is( allowAlter ) ); assertThat( outPermission.isAllowCreate(), is( allowCreate ) ); assertThat( outPermission.isAllowDelete(), is( allowDelete ) ); assertThat( outPermission.isAllowExecute(), is( allowExecute ) ); assertThat( outPermission.isAllowLanguage(), is( allowLanguage ) ); assertThat( outPermission.isAllowRead(), is( allowRead ) ); assertThat( outPermission.isAllowUpdate(), is( allowUpdate ) ); } { final ClientRequest request = request( uri, MediaType.APPLICATION_JSON_TYPE ); final ClientResponse< String > response = request.get( String.class ); final String entity = response.getEntity(); assertThat( entity, is( notNullValue() ) ); final RestVdbDataRole dataRole = KomodoJsonMarshaller.unmarshall( entity, RestVdbDataRole.class ); assertNotNull( dataRole ); assertThat( dataRole.isAllowCreateTempTables(), is( allowCreateTempTables ) ); assertThat( dataRole.isAnyAuthenticated(), is( anyAuthenticated ) ); assertThat( dataRole.getDataPath(), is( dataPath ) ); assertThat( dataRole.getDescription(), is( description ) ); assertThat( dataRole.isGrantAll(), is( grantAll ) ); assertThat( dataRole.getId(), is( id ) ); assertThat( dataRole.getkType(), is( type ) ); assertThat( Arrays.equals( dataRole.getMappedRoles(), mappedRoles ), is( true ) ); assertThat( dataRole.getName(), is( dataRoleName ) ); assertThat( dataRole.getPermissions().length, is( 1 ) ); final Collection< RestLink > links = dataRole.getLinks(); assertEquals( 4, links.size() ); } }