I'm trying to add custom metadata namespace to CQ DAM.
I. e. URI http://example.com/ with prefix ex
added namespace in /crx/explorer/nodetypes/index.jsp in Namespaces tab
added line <ex = 'http://example.com/'> in /libs/dam/nodetypes/dam.cnd
created /libs/dam/options/metadata/ex folder
then I can't set metadata property to the /libs/dam/options/metadata/ex folder, nor add any subnode to it. ("No matching property definition found" error).
What is the full procedure of adding custom metadata namespace in CQ DAM?
Two first steps are alternative ways of doing the same thing.
The created /libs/dam/options/metadata/ex folder should by
sling:Folder not nt:Folder
Related
I want to add more node information to a network node. Is it possible to share more data besides what's in the node configuration file? Maybe some custom fields, like an encoded logo image or stuff like that.
Thanks
Yes you can.
Inside your module under src folder add a file called config.conf.
Add your values inside of it in the following format:
key1="string_value"
key2=number_value
Inside build.gradle go to the part where you define your nodes, let's say your module name is "my_module"; do this:
cordapp (project(':my_module')) {
config project.file("src/config.conf")
}
Now when you run deployNodes, gradle will generate a file called my_module.conf under build\nodes\my_node\cordapps\config.
To access those values inside your flow:
getServiceHub().getAppContext().getConfig().getString("key1");
As for testing flows; to mimic the custom config file you need to do the following:
Map<String, String> customConfig = new HashMap<>();
customConfig.put("key1", "string_value");
customConfig.put("key2", "int_value");
// Setup network.
network = new MockNetwork(new MockNetworkParameters().withCordappsForAllNodes(ImmutableList.of(
TestCordapp.findCordapp("my_package").withConfig(customConfig))));
OK, so I've managed to create a custom project flavor with a custom property page. It all works and the values are being saved to the .csproj file like such:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{880389B4-B814-4796-844B-F0E1678C31D1}" Configuration="Debug|Any CPU">
<ServiceLibraryProjectFlavorCfg>
<BooleanProperty>True</BooleanProperty>
</ServiceLibraryProjectFlavorCfg>
</FlavorProperties>
<FlavorProperties GUID="{880389B4-B814-4796-844B-F0E1678C31D1}" Configuration="Release|Any CPU">
<ServiceLibraryProjectFlavorCfg />
</FlavorProperties>
</VisualStudio>
What I cant seem to figure out is how to access this custom property from, say, a menu item callback in my package. I can get the project that the selected item in the solution explorer which was right clicked belongs to, but I'm stuck after that...
Any help will be appreciated
Thanx
Hein
OK, I figured it out.
As part of creating a custom project flavor, you inherit from FlavoredProjectBase and implement the IVsProjectFlavorCfgProvider interface.
the IVsProjectFlavorCfgProvider has one implementable method
int CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg)
So here I implemented a static mapping between my custom IVsProjectFlavorCfg and the specified IVsCfg
Already having a EnvDTE.Project reference, I could then use the following to get a IVsCfg reference:
IVsHierarchy hierarchy1 = null;
var sol = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
sol.GetProjectOfUniqueName(project.UniqueName, out hierarchy1);
IVsSolutionBuildManager bm = Package.GetGlobalService(typeof(IVsSolutionBuildManager)) as IVsSolutionBuildManager;
IVsProjectCfg[] cfgs = new IVsProjectCfg[1];
bm.FindActiveProjectCfg(IntPtr.Zero, IntPtr.Zero, hierarchy1, cfgs);
IVsCfg cfg = cfgs[0] as IVsCfg;
I could then use the IVsCfg reference to look up my custom configuration provider.
If you can access the project node instance (and if your project system is based on MPF), you can just use the GetProjectProperty method of the ProjectNode class. It obtains a ProjectPropertyInstance and returns its evaluated value, or null if the property does not exist.
I have notices that types created with paster on the file system can be changed using the TTW editor.
When I reinstall the product the TTW changes persist, and the model file seems to be ignored. How can I discard these changes? Is there a guide to the relationship between web changes and file system changes?
A content type's entry in the portal_types tool has 3 properties related to where the model is loaded from. They are checked in this order:
model_source: The XML model, inline
model_file: Path to a file which contains the XML model
schema: Dotted path to a Python schema
My guess is that you need to make your filesystem product's installation profile explicitly empty model_source, so that it won't take precedence over model_file and schema.
I'm generating sitemaps and their index with JDOM2.
what I'd like to obtain is this:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>http://
so I added an attribute to the root element titled "xmlns". Running the code I receive this error:
The name "xmlns" is not legal for JDOM/XML attributes: An Attribute name may not be "xmlns"; use the Namespace class to manage namespaces.
How can I obtain what I need without changing the above structure?
thanks!
You need to use namespaces, not attributes:
Element root = new Element("sitemapindex", "http://www.sitemaps.org/schemas/sitemap/0.9");
Read up on namespaces....: http://www.w3schools.com/xml/xml_namespaces.asp
Rolf
I have created a configuration section designer project to represent nodes of a custom section necessary to read and save from my web application. I am able to successfully create instances of the configuration elements and collections, however when I save the configuration using the referenced System.Configuration.Configuration object and issuing save, the elements get merged into their parents as attributes. An example of the issue is outlined below:
After calling the referenced Configuration.save, the output is as follows:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets dataViewId="1" id="4203bb88-b0c4-4d57-8708-18e48f0a1d2d">
<selects keyId="1" sortOrder="1" />
</resultsSets>
</savedReports>
As defined in my configuration section designer project (confirmed by the resulting xsd as well) the output should match the following:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets>
<savedReport id="1">
<selects>
<select keyId="1" sortOrder="1"/>
</selects>
</savedReport>
</resultsSets>
</savedReports>
Any ideas? The element collection types are set to BasicMapAlternate however when I set them to AddRemoveClearMapAlternate they are not merged but they are prefixed by "add" rather than "select" or "savedReport" causing the validation to be off.
Turns out AddRemoveClearMapAlternate was the option I needed to correct my problem referenced in the question.