Storing app preferences in Spring app - database

I'm working in a Spring MVC application that needs access to some variables that the admin user must set using a web wizard (smtp server, preferences, etc). I want to store this info in a database to be accessible by the app. Which is the best way to store this info?

Please spend some time with Section IV of Spring Reference Manual. There are plenty data persistence option supported by Spring. To name few popular ones: JDBC, JPA, Hibernate, XML

We use an approach with default values and a generic GUI. Therefore we use a property file that contains the default value as well as type information for every key. in the dayabdatabase we store only this values that have been modified by the user. The database schema is just a simple key value table. The key is the same like the one from the property file, the value is of type string, because we have to parse the default value anyway. The type info (int, positiveInt, boolean, string, text, html) from the propty file is used by the generic GUI to have the right input for every key.
Example:
default.properties
my.example.value=1
my.example.type=into
default.properties_en
my.example.title=Example Value
my.example.descruption=This is..
Db:
Key=string(256)
Value=string(2048)

Related

Field Type of entity-query not working, correctly retrieves list of content-items but incorrectly stores them as 'Empty Slot"

I have an Authors App which has x amount of authors. I have another app and have configured an Field Input-Type entity-query in it which pulls from the Authors App. It does this correctly and I can select multiple authors. However upon save, when I go to retrieve a content item which should contain the selected authors, I am given "empty slot" for the place of each author
Real entity fields are Entity relations, and they enforce validity. So they only work with entities in the same app, as that's kind of a sealed scope. This is important that Apps can ensure export/import and still work for all standard use cases.
To reference entities of another app you must use strings instead. This can be done using the string-query field which has the same functionality.
The only downside is that your code will need to then look up the entity in the other app using the id or guid (whichever you store) in Razor.

Using UUID for id on Pages

Just getting started with Wagtail. To support interoperability with a legacy system, I'd like to have the id/pk of my Page objects be UUIDs instead of Integers. I tried just adding a id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4) to my class that inherits from Page but I get an error Local field u'id' clashes with field of similar name from base class 'Page'
Is there a simple way to make id be a UUID? Or, do I just need to call it something besides id?
There won't be a simple way to do this, unfortunately - the assumption that IDs are numeric is baked in to the database schema, URL routes, rich text data representation and various other places in Wagtail's design.
Would it be an option to add your UUID column as a new field on your model (named something like legacy_id), and look up on that whenever you need to interoperate with the legacy system - but otherwise leave the primary key as numeric?

Update Drupal Application with an external DB script

I’m trying to update my Drupal application with an external script writing directly in the MySQL DB, I only need to modify one field of one specific datatype. I see it in a table named field_data_field_FIELDNAME but when I update this the application doesn’t change. I need to modify something else? Thanks
Assuming you are trying to change the field's value, try modifying both field_data_field_FIELDNAME and field_revision_field_FIELDNAME, then clear all cache.
Note that you do not actually need to clear all cache if you know what you need to clear, e.g. to clear the field's value for a particular node, you can use cache_clear_all('field:node:[your nid here]', 'cache_field');
If your are trying to change more than the field's value, I suggest you do it through the Field API.

Create new field type for custom content

I want to create a new content type called "Message". It will have a couple of fields, "message-body" which will be plain text and "addressees". The addressees field should reflect a list of the registered users of the site.
The idea is to create a field type that will be a checklist where all users of the site can be selected, and those that are will receive the message in "message-body" via drupal_set_message($msg).
I am not suceeding so far in creating a custom field type. The Field API documentation is not very clear.
Thanks.
You maybe already found the solutions for you problem.
I think in your case you can use Entity Reference. In your custom content type you can create a new field with the Entity Reference type. Then on the configuration page you can choose which entity to reference, like node, taxonomy or users, with different types of widget.
Here's a link of the Entity Reference module.
Why not make a content type via the menu interface www.yoursite.com/admin/structure/types/add.
Or you need it as a module that you can re-distribute?
An easier way then is to make use of features. It allows you to 'export' a built content type into a module. Enabling the module (on another site), then creates all the fields that where in the export.

Difference between DataControl.cpx and Datacontrol.dcx in Oracle ADF

In Oracle ADF what is the difference between DataControl.dcx and DataControl.cpx ? What goes where ?
Check out the doc at A.7 DataBindings.cpx
Databindings.cpx- Data Binding Registry
Jdeveloper Creates this first time when you data bind a UI Component
It has
pageMap maps all user interface URLs and the corresponding page definition usage name. This map is used at runtime to map a URL to its page definition.
pageDefinitionUsages maps a page definition usage (BindingContainer instance) name to the corresponding page definition. The id attribute represents the usage ID. The path attribute represents the full path to the pagedefinition.
dataControlUsages declares a list of data control usages (shortnames)corresponding path to the data control definition entries is available in datacontrols.dcx file
Datacontrols.dcx -Data Controls Registry
Lists ADF Data control available in a project
It Contains Information needed to initialize the data control to work with. a particular service (Java bean web service ,EJB) J developer Creates this file when you create a data control . This file is not generated for Oracle ADF Business Components

Resources