Determine if i18n is enabled for a JCR Property - properties

How to access the corresponding FieldDefinition, if I have only the jcr property name at hand.
Is there any desired functionality,like find a field definition by a jcr property name ? If not, how would I access configured field definitions in java code ?
Scenario : I need to determine, if a given jcr property name was configured to be an i18n-capable field in definition ?

The answer is you can never be sure if property was configured to be i18n-able (or have any other trait) at the time it was last edited as definition might have changes since.
However to achieve what you want (obtain the definition), what you need to do is:
get a parent node of the property in question,
get value of it's mgnl:template property. That's your templateId,
use the templateId to obtain template from the registry,
read value of dialog property of the template, that's your dialogId
use the dialogId to obtain dialog from the registry
scan tabs in the dialog to find property definition with name of the jcr property you have started with

Related

Nifi add flow file attributes to S3 Object (PutS3Object) Metadata

I have a simple flow consisting of
GenerateFlowFile ----> PutS3Object ----> Wait
And the generated flow files are getting stored in the bucket correctly.
Now I want to add Metadata to my flow file.
If I add a property "Test1" to PutS3Object, it shows up as "X-Amz-Meta-Test1" in the metadata of the object.
But if I add a property "Test2" in GenerateFlowFile it doesn't show up in metadata.
I tried adding "Test2" as s3.usermetadata.Test2 but it still didn't work.
Is there a way to pass all the flow files attributes as metadata without explicitly adding properties in the PutS3Object.
PutS3Object only inserts metadata values that you have set as Dynamic Properties on the PutS3Object processor itself. Please see the docs link and look at the Dynamic Properties section.
PutS3Object does not just stick any Attribute you set as metadata, otherwise you would end up with potentially hundreds of metadata entries that you aren't interested in. The only Attribute it reads by default is filename - please see the Reads Attributes section of the docs.
If you have an existing Attibute, and you want to push the value of this Attribute into the metadata, you must add a Dynamic Property to PutS3Object and reference the value of the Attribute.
E.g. you have an Attribute called file_author with a value Steve and you want the S3 object to have the metadata field author with the value Steve:
You would add a Dynamic Property to PutS3Object with a name of author and a value of ${file_author}.
Edit:
You could fork PutS3Object into a custom processor to add the dynamic functionality you want, but I would recommend just using the standard PutS3Object config and manually configuring the Attributes you want.

Reading property from another property

I am having a property file like this
url.DEV.a=devlocalhost
url.QA.a=qalocalhost
env=DEV
To get url I am using below property. But I can't able to get correct value.
totalurl=${url.${env}.a}
Here i am expecting totalurl as devlocalhost
how can i do this in property file.
You can check here :
http://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_basicfeatures.html#Variable_Interpolation
Could you give more details, why you need such configuration ?
It's not easier for you to use a common file where you store the common properties ?

In InstallShield, how to change the value of my Property before it is used by SQL Text Replacement?

What I want to do
In InstallShield I want to set the value of a Property before it is used by the SQL Text Replacement feature. I want the new Property value to come from an Edit control that I've added to a dialog.
What I've done so far
I have added SQL Scripts to my InstallShield project, which include placeholders for InstallShield's Text Replacement feature. I've used the Text Replacement tab to find and replace a placeholder in the SQL script with the value of a Property that I've added to the Property Manager. This works correctly, but only for the Property's default value.
Where I'm stuck
The problem is that I want the new value to come from an Edit control in my custom Dialog, but I can't find a way to do this. Text Replacement always uses the Property's default value.
What I've tried is the following InstallScript, which runs when the user clicks Next on my custom Dialog:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty ( hwndDlg, "EDIT_VALUE_FROM_USER", svValueFromUser);
Where EDIT_VALUE_FROM_USER is my Property. This runs without error, but the value doesn't come through to the final SQL script.
Why isn't the new value for EDIT_VALUE_FROM_USER being used by SQL Text Replacement? How can I diagnose why it's not working? Should I be doing this in a completely different way?
This turned out to be because I wasn't using the system property ISMSI_HANDLE.
So the correct code to write a Property from an Edit control in a custom dialog is:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty (ISMSI_HANDLE, "EDIT_VALUE_FROM_USER", svValueFromUser);
I'm guessing your property isn't listed in the SecureCustomPublicProperties property and is getting set back to it's default value when the installer transitions to the install execute sequence. A log file of the installation would give more data to work with.

how to get the modified value of property after the feature is installed?

I have used a dialog in OnFirstUIBefore() for users to input some information,
and stored them in property USERINF.
However, when I want to retrieve the value of USERINF inputted by user in feature_installed(),
what I get is a default value.
I have added the USERINF to SecureCustomProperties property, but still cannot get the modified value.
How can I fix the problem?
I've always written values like these to the registry, then used appsearch to get them out into the property again.
There is no built in way to persist values like these built into MSI.

Is it possible to make Lucene queries in alfresco that find nodes based on their parent/children properties

is it possible to make Lucene query in alfresco that finds nodes based on their parent/children properties? For example i want to find all the nodes that have the property "foo" set to '1' and have nodes associated to them by a child association with the property "baz" set to '2' (maybe specifing somehow the name of their child association)
something like
#crl\:numeroAtto:"6555" AND #crl\:firmatario:"Marco rossi"
Where "numeroAtto" is a property of the parent node and "firmatario" is a property of the child. The association type is "firmatari" (It's not in the query because i don't know how to use it)
To be even clearer i'm trying to tell lucene: "Find all nodes that have the property numeroAtto set to 6555 and that have children (association type with the children: firmatari) with the property "firmatario" set to Marco rossi.
Thanx in advance
You can't search on associations, so what we do is not to build slow queries.
But add a new d:text property of the association on the parent Type.
So it's searchable through Lucune.
To make it fully working, create a Java Behaviour which checks on content update. And when 'your' association is found it adds it to the d:text property.
This way lucene searches are very quick.
There is no direct lucene way to do this.
Another idea: the first would return all of the parent nodes and then build searches based on the root of each returned node.