All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.fhframework.docs.application.url.UseCaseUrlsForm.frm Maven / Gradle / Ivy


{$.fh.docs.url_many_use_cases_are_being_started_while} {$.fh.docs.url_use_cases_creator_can_mark_it_as_use_case} {$.fh.docs.url_url_to_an_use_case_contains}: - {$.fh.docs.url_alias_identifies_the_use_case} - {$.fh.docs.url_positional_parameters_visible_as_path_elements} - {$.fh.docs.url_named_parameters_visible_as_query_parameters} {$.fh.docs.url_example_urls}: {$.fh.docs.url_to_expose_an_url_start_with_annotating} {$.fh.docs.url_it_is_recommended_to_give_use_case} {$.fh.docs.url_input_parameter_of_an_url_enabled}: - {$.fh.docs.url_strings_number} - {$.fh.docs.url_enums} - {$.fh.docs.url_convertible_types_see} ) - {$.fh.docs.url_database_entities_id_of_an_entity_is_exposed} - {$.fh.docs.url_complex_types_if_urlparamwrapper} {$.fh.docs.url_by_default_all_parameters_are_exposed} { @Override public void start(String firstName, String lastName) { ... } }]]]]> {$.fh.docs.url_urlparam_annotation_can_be_used_to_declare} { @Override public void start(@UrlParam(position = 1) String firstName, @UrlParam(position = 0) String lastName) { ... } }]]]]> { @Override public void start(@UrlParam(name = "myName") String name, @UrlParam(name = "myAge") Integer age) { ... } }]]]]> { @Override public void start(@UrlParam(optional = true) String name, @UrlParam(name = "myAge") Integer age) { ... } }]]]]> {$.fh.docs.url_urlparamignored_annotation_can_be_used} { @Override public void start(@UrlParamIgnored String firstName, String lastName) { ... } }]]]]> {$.fh.docs.url_urlparamwrapper_annotation_can_be_used} { @Override public void start(@UrlParamWrapper(namePrefix = "sister_") Person sister, @UrlParamWrapper(namePrefix = "brother_") Person brother) { ... } }]]]]> { @Override public void start(@UrlParamWrapper(useNames = false) Person me, @UrlParamWrapper(namePrefix = "brother_") Person brother) { ... } }]]]]> { @Override public void start(@UrlParamWrapper Person me) Person brother) { ... } }]]]]> {$.fh.docs.url_in_more_complex_scenarios_eg_external_service} { private static final String URL_PARAM_MODE = "mode"; @Autowired private FormService formService; @Override public Optional> extractParameters(UseCaseUrl url) { String className = url.getPositionalParameter(0); String modeStr = url.getNamedParameter(URL_PARAM_MODE); if (modeStr == null || className == null) { return Optional.empty(); } EditorMode mode = EditorMode.valueOf(modeStr); DynamicClassFilter filter = new DynamicClassFilter(); filter.setCustomPredicate(c -> c.getClassName().equals(DynamicClassName.forClassName(className))); List foundForms = formService.getFormsInfo(filter); if (foundForms.isEmpty()) { FhLogger.warn("Url passed form name '{}' not found", className); return Optional.empty(); } else { return Optional.of(new Parameters<>(mode, foundForms.get(0))); } } @Override public boolean exposeParamsInURL(UseCaseUrl url, EditorMode mode, FormInfo formInfo) { url.putNamedParameter(URL_PARAM_MODE, mode.name()); url.putPositionalParameter(0, formInfo.getFullClassName()); return true; } } }]]]]> { @Override public void start(EditorMode mode, FormInfo formInfo) { ... } }]]]]> {$.fh.docs.url_although_it_is_not_considered_to_be_a_good_practice}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy