use of io.atlasmap.v2.ActionDetails in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionsServiceTest method testListActionDetails.
@Test
public void testListActionDetails() {
assertNotNull(fieldActionsService);
List<ActionDetail> actionDetails = fieldActionsService.listActionDetails();
for (ActionDetail d : actionDetails) {
if (d.getParameters() != null) {
System.out.println("Action: " + d.getName());
for (ActionParameter param : d.getParameters().getParameter()) {
System.out.println("\t param: " + param.getName());
System.out.println("\t type: " + param.getFieldType().value());
}
}
}
}
use of io.atlasmap.v2.ActionDetails in project atlasmap by atlasmap.
the class GenerateFieldActionsMojo method generateFieldAction.
private void generateFieldAction(List<URL> urls) throws MojoFailureException, MojoExecutionException {
DefaultAtlasFieldActionService fieldActionService = DefaultAtlasFieldActionService.getInstance();
ClassLoader origTccl = Thread.currentThread().getContextClassLoader();
ActionDetails answer = new ActionDetails();
try (URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), origTccl)) {
fieldActionService.init(loader);
} catch (Exception e) {
throw new MojoExecutionException("Could not load field actions:", e);
}
answer.getActionDetail().addAll(fieldActionService.listActionDetails());
writeToJsonFile(DEFAULT_OUTPUT_FILE_PREFIX, answer);
}
use of io.atlasmap.v2.ActionDetails in project atlasmap by atlasmap.
the class AtlasService method listFieldActions.
/**
* Retrieves a list of available field action.
* @param uriInfo URI info
* @return {@link ActionDetails} serialized to JSON
*/
@GET
@Path("/fieldActions")
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "List FieldActions", description = "Retrieves a list of available field action")
@ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ActionDetails.class)), description = "Return a list of field action detail"))
public Response listFieldActions(@Context UriInfo uriInfo) {
ActionDetails details = new ActionDetails();
if (atlasContextFactory == null || atlasContextFactory.getFieldActionService() == null) {
return Response.ok().entity(toJson(details)).build();
}
details.getActionDetail().addAll(atlasContextFactory.getFieldActionService().listActionDetails());
byte[] serialized = toJson(details);
if (LOG.isDebugEnabled()) {
LOG.debug(new String(serialized));
}
return Response.ok().entity(serialized).build();
}
Aggregations