.. ******************************************************************************* * MetaFactory.io R2 * Technical Documentation * * File name : RefUserPreferences.rst * Created by : Ralph Oudejans * Last update : 02-03-2021 * Updated by : Niels de Nies * * MetaFactory BV Amsterdam ******************************************************************************* User Preferences ================ Description ----------- The `User Preferences` feature gives users of applications generated with the MetaFactory tool the ability to set their preferences. Based on the user's preferences, when a user starts to create a new instance of an object, the attributes and/or references of this object that have specific metadata will be initialized with the values set in the user's preferences. Examples -------- - Hours application: the preferred hour amount and hour task can be set by the user. - AMI application: the preferred section dealer and section account manager (amongst others) can be set by the user. Objects ------- The following objects are involved in modeling the feature: UserPreferences, User, plus all project specific objects that need User Preferences. Metadata -------- The following metadata are involved in modeling the feature: .. code-block:: xml :caption: context for metadata: , .. code-block:: xml :caption: context for metadata: Owner my USER owner Patterns -------- The following patterns are involved in generating the feature: Library specific patterns: - metafactory-internal-library\\pattern\\package\\service-using-jpa-repository.xml - metafactory-internal-library\\pattern\\package\\backend\\rest\\rest-dto.xml - metafactory-internal-library\\pattern\\package\\backend\\service\\service-dto.xml - metafactory-jhipster-library\\jhipster620_angular800\\frontend\\webapp\\app\\account\\account_route_ts.xml - metafactory-jhipster-library\\jhipster620_angular800\\frontend\\webapp\\app\\account\\index_ts.xml - metafactory-jhipster-library\\jhipster620_angular800\\frontend\\webapp\\app\\account\\preferences_route_ts.xml .. note:: The service-using-jpa-repository.xml pattern generates the :class:`UserPreferencesService` class, with method :func:`getMyPreferences` (My is the value of dto.owner.prefix) | The :class:`UserPreferencesService` class uses the following classes: | the :class:`User` class | the :class:`UserRepositoryJPA` class | the :class:`UserPreferences` class | the :class:`UserPreferencesRepositoryJPA` class .. note:: The rest-dto.xml pattern generates the :class:`OwnerUserPreferencesDtoRestController` class with method :func:`getOwnerUserPreferencesEditDto`. .. note:: The service-dto.xml pattern generates the :class:`OwnerUserPreferencesConverterService` class, with method :func:`getMyOwnerUserPreferencesEditDto`. Project specific patterns: - Depends on the project. Snippets -------- The following snippets are involved in generating the feature: Library specific snippets: - metafactory-angular-library\\snippet\\file\\angular\\services\\angular-service.ftl - metafactory-internal-library\\snippet\\condition\\backend\\has_user_preferences.ftl - metafactory-internal-library\\snippet\\backend\\rest\\dto\\get_owner_user_preferences_edit_dto.ftl - metafactory-internal-library\\snippet\\backend\\service\\jpa2\\get_my_preferences.ftl - metafactory-internal-library\\snippet\\java\\service\\createNew.ftl - metafactory-jhipster-library\\snippets\\jhipster620_angular800\\frontend\\webapp\\app\\account\\account_route_ts.ftl - metafactory-jhipster-library\\snippets\\jhipster620_angular800\\frontend\\webapp\\app\\account\\index_ts.ftl - metafactory-jhipster-library\\snippets\\jhipster620_angular800\\frontend\\webapp\\app\\account\\preferences_route_ts.ftl - metafactory-jhipster-library\\snippets\\jhipster620_angular800\\frontend\\webapp\\app\\layouts\\navbar\\navbar_component_html.ftl Project specific snippets: - [*project*]-metafactory\\src\\snippets\\[*frontend*]\\owner\\edit\\edit-component-userpreferences.ftl - [*project*]-metafactory\\src\\snippets\\[*frontend*]\\owner\\edit\\edit-template-userpreferences.ftl .. note:: The edit-template-userpreferences.ftl snippet generates the custom rendering of the user preferences edit screen.