IzPack TargetPanel lets one select one target directory. However I need to allow users to choose two (one for apps, one for data). How to do that?
You can create a UserInputPanel and get the path as a variable from the user. Then you can use variable substitution anywhere you want. You'll have to add a userInputSpec.xml file and define your own panels (as many as you want). To get a directory, use <field type="dir" ... >
Example userInputSpec.xml from an application of mine. I include mongoDB with the installer and use this to get some settings.
<userInput>
<panel order="0">
<createForPack name="MongoDB" />
<!-- Other settings like port, ip, username, password-->
<field type="staticText" align="left" txt="Select the catalogue where data will be stored." id="staticText.registry.db.data.text" />
<field type="dir" align="left" variable="mongo.data.dir">
<spec txt="Data directory" size="25" set="$INSTALL_PATH\data" mustExist="false" create="true" />
</field>
</panel>
<panel order="1">
<!-- definition of a second panel -->
</panel>
</userInput>
You also need to include the userInputSpec.xml as a resource in your main installation file and add a UserInputPanel element for each panel that you define in userInputSpec.xml
Like this (in the <installation> element:
<resources>
<!-- other resources -->
<res id="userInputSpec.xml" src="userInputSpec.xml" />
</resources>
<panels>
<panel classname="HelloPanel"/>
<panel classname="InfoPanel"/>
<panel classname="LicencePanel"/>
<panel classname="TargetPanel"/>
<panel classname="TreePacksPanel"/>
<panel classname="UserInputPanel"/>
<panel classname="UserInputPanel"/>
<panel classname="InstallPanel"/>
<panel classname="ShortcutPanel"/>
<panel classname="FinishPanel"/>
</panels>
notice the double occurence of
I have two panels defined in my userInputSpec
Make sure that your UserInputPanels appear before InstallPanel because you have to get the variables from the user before copying your files.
This is just an example from my app. See the official documentation to get the idea of what the elements and attributes I used mean. There are many features connected with user input.
Related
I'm using VS Code for Java development and working with other developers who use IntelliJ. I'd like to use the Organize Imports command (Shift+Alt+O) to clean up my imports, but I don't want to fight over import order with every commit. So I'd like to configure VS Code to organize the imports in the same order as IntelliJ's default. Does anybody have a configuration that would do this?
If this is not possible, is there a workspace configuration I can apply to both VS Code and IntelliJ so that the two IDEs will agree, even if they aren't agreeing on IntelliJ's default?
We were able to get it the almost identical with the following config tweaks.
VS Code:
{
"java.completion.importOrder": [
"",
"javax",
"java",
"#"
]
}
IntelliJ
The only difference from the IntelliJ default is a new line between import javax... and import java....
It's possible to get VS Code and IntelliJ to agree on a standard format, as long as that standard format:
Puts static imports at the top*
Separates all specific sections with empty lines
Puts everything not in its own specific section in a catch-all section at the end*
Never uses wildcard imports
Not actually true; static imports can be positioned in VS Code with '#', and everything else can be position in VS Code with ''.
IntelliJ's default settings don't work for this, but it is flexible enough to be reconfigured. Here are the files to add to a project to make just that project set up consistent rules for both IDEs (make sure they are not excluded in .gitignore).
Rule: The following groups separated by empty lines: Static imports, java.*, javax.*, everything else.
.vscode/settings.json:
{
"java.completion.importOrder": ["java", "javax"],
}
.idea/codeStyles/codeStyleConfig.xml:
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
.idea/codeStyles/Project.xml
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</JavaCodeStyleSettings>
</code_scheme>
</component>
I'm at my wit's end with this.
I have a VERY simple installation descriptor for izpack for a two-package Java app on Windows. Everything works as intended EXCEPT for the shortcut creation. The shortcut panel doesn't seem right, for a start. The label "ShortcutPanel.regular.startup" is displayed instead of "run at startup" or anything of the sort in the startup execution checkbox.
After running the installer, the shortcuts simply aren't created. Here's what my install.xml looks like, it's pretty straightforward:
<izpack:installation version="5.0"
xmlns:izpack="http://izpack.org/schema/installation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">
<info>
<appname>application_name</appname>
<appversion>2.0.0</appversion>
<appsubpath>myapp</appsubpath>
<javaversion>1.8</javaversion>
</info>
<locale>
<langpack iso3="bra" />
</locale>
<resources>
<res src="shortcutSpec.xml" id="shortcutSpec.xml"/>
</resources>
<variables>
<variable name="TargetPanel.dir.windows" value="C:/Sistemas"/>
</variables>
<guiprefs width="800" height="600" resizable="no">
<laf name="substance">
<os family="windows" />
<os family="unix" />
<param name="variant" value="mist-silver" />
</laf>
<modifier key="useHeadingPanel" value="yes" />
</guiprefs>
<panels>
<panel classname="HelloPanel" />
<panel classname="DefaultTargetPanel" />
<panel classname="ShortcutPanel" />
<panel classname="InstallPanel" />
<panel classname="FinishPanel" />
</panels>
<natives>
<native type="izpack" name="ShellLink.dll">
<os family="windows"/>
</native>
<native type="izpack" name="ShellLink_x64.dll">
<os family="windows"/>
</native>
</natives>
<packs>
<pack name="Pack1" required="yes">
<description>one of the packs it's a jar</description>
<file src="lib/pack1.jar" targetdir="$INSTALL_PATH/pack1subdir"
override="true">
</file>
<file src="imagens/logo.ico" targetdir="$INSTALL_PATH/pack1subdir/imagens/"
override="true" />
<executable targetfile="lib/pack1.jar" type="jar"
stage="never"></executable>
</pack>
<pack name="Pack2" required="yes">
<description>the other pack</description>
<file src="lib/pack2.jar" targetdir="$INSTALL_PATH/pack2subdir"
override="true">
</file>
<file src="imagens/update.ico" targetdir="$INSTALL_PATH/pack2subdir/imagens/"
override="true" />
<executable targetfile="lib/pack2.jar" type="jar"
stage="never"></executable>
</pack>
</packs>
Then there's the shortcutSpec.xml. My pom moves it to my staging directory:
<izpack:shortcuts version="5.0"
xmlns:izpack="http://izpack.org/schema/shortcuts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/shortcuts http://izpack.org/schema/5.0/izpack-shortcuts-5.0.xsd">
<lateShortcutInstall />
<shortcut name="pack1" programGroup="false"
desktop="true" applications="false" startMenu="no" startup="true"
target="java -jar $INSTALL_PATH/pack1subdir/pack1.jar"
workingDirectory="$INSTALL_PATH/pack1subdir/">
<createForPack name="pack1" />
</shortcut>
<shortcut name="pack2" programGroup="false"
desktop="true" applications="false" startMenu="no" startup="true"
target="java -jar $INSTALL_PATH/pack2subdir/pack1.jar"
workingDirectory="$INSTALL_PATH/pack2subdir/">
<createForPack name="pack2" />
</shortcut>
The installer simply doesn't create any shortcuts anywhere. It finishes with no error messages no logs no stack traces no nothing.
Help.
I fixed that by going into the izPack/lib/izpack-core-5.0.9.jar and opening the /com/izforge/izpack/bin/langpacks/installer/ folder in it. Then editing the bra.xml file and adding the following line:
<str id="ShortcutPanel.regular.startup" txt="Iniciar com o Windows"/>
Then save and update the file in the jar and rebuild your instalation.
I have a custom content model I created for Alfresco that has type with a d:date property. I am able to build the repository and share projects with seemingly no errors. However, I am unable to search by the properties using the data type d:date or d:int. I resolved the d:int problem by changing the data type to d:text and adding a regex constraint, but I'm not sure if that would be prudent for the d:date property.
Is there some additional configuration that I need to supply or create in order to search by properties that are not d:text?
Here is a snippet showing the type declaration:
<types>
<!-- Enterprise-wide generic document type -->
<type name="gl:x">
<title>Document</title>
<parent>cm:content</parent>
<properties>
<property name="gl:period">
<type>d:text</type>
</property>
<property name="gl:year">
<type>d:text</type>
<constraints>
<constraint ref="gl:documentYears" />
</constraints>
</property>
<property name="gl:docType">
<type>d:text</type>
<constraints>
<constraint ref="gl:documentTypeList" />
</constraints>
</property>
<property name="gl:date">
<type>d:date</type>
</property>
</properties>
</type>
</types>
The share search forms and properties forms seem to be rendering correctly, so I don't think that there is any problem within those.
The advanced search page accepts two types of parameters.
One is simply the "keywords" field. This performs a full text search, i.e. it looks for the provided keywords in ANY text property. There is no need to configure the full text search for custom types (e.g. your gl:x) - it automatically picks up any text property in any model in the system.
The other is the group of single parameters: name, title, description, mime-type, modified-date, modifier. These properties can be of any type. A d:date property would be perfectly acceptable here, as the modified-date parameter testifies.
But here custom properties are not picked-up automatically. They need to be configured explicitly.
Notice that in the upper part of the advanced search page is a drop-down called "Look for" with two options: content and folders. The best approach would be to add an option for your content type gl:x and to configure a search form for it.
You can find the definition of the two standard search forms in tomcat/webapps/share/WEB-INF/classes/alfresco/share-form-config.xml. The file is rather long so here are the two sections to look for:
<config evaluator="model-type" condition="cm:content">
<forms>
<!-- Default Create Content form -->
<form>
</form>
<!-- Document Library Create Google Doc form -->
<form id="doclib-create-googledoc">
</form>
<!-- Search form -->
<form id="search">
</form>
</forms>
</config>
<!-- cm:folder type (creating nodes) -->
<config evaluator="model-type" condition="cm:folder">
<forms>
<!-- Document Library Common form -->
<form id="doclib-common">
</form>
<!-- Search form -->
<form id="search">
</form>
</forms>
</config>
I've skipped the details, but what is important is that "cm:content" and "cm:folder" each defines a <form id="search"> with the desired search properties/parameters.
As an experiment you could modify share-form-config.xml directly and add your own definition:
<config evaluator="model-type" condition="gl:x">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="gl:date" />
</field-visibility>
<appearance>
<field id="gl:date">
<control template="/org/alfresco/components/form/controls/daterange.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Also you have to add the new search form to the AdvancedSearch configuration found in tomcat/webapps/share/WEB-INF/classes/alfresco/share-config.xml:
<config evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<forms>
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>
<form labelId="search.form.label.gl_x" descriptionId="search.form.desc.gl_x">gl:x</form>
</forms>
</advanced-search>
</config>
Remember to restart alfresco after every change.
When you're satisfied with the results, it would be better to move your custom definitions to a separate share-config-custom.xml in your project (share-config.xml and share-form-config.xml should never be modified directly).
For more details: https://wiki.alfresco.com/wiki/Share_Advanced_Search
Background: As usual we have various life cycles like dev. stage, lt, prod all these are picked at deploy time from environment variable ${lifecycle}.
So JNDI setting we stores in ${lifecycle}.properties as variable datasource.jndi.name=jdbc/xxx. As other beans are also using this properties file, it is verified that such variable is loaded & file is in classpath, but somehow I am not able to consume this variable in log4j2.xml in below JDBC Appender.
<JDBC name="DBAppender" tableName="V1_QUERY_LOG" bufferSize="4" ignoreExceptions="false">
<DataSource jndiName="${sys:datasource.jndi.name}" />
<Column name="event_date" isUnicode="false" isEventTimestamp="true" />
<Column name="log_level" isUnicode="false" pattern="%level" />
<Column name="logger" isUnicode="false" pattern="%logger" />
<Column name="message" isUnicode="false" pattern="%message" />
<Column name="exception_msg" isUnicode="false" pattern="%ex{full}" />
</JDBC>
I have tried some option like "${datasource.jndi.name}" too, or is there any way I can fit the solution in
<Properties>
<Property name="datasource.jndi.name">get datasource.jndi.name from {lifecycle}.properties</property>
</Properties>
If you are not using java system properties, but environment variables, you should not use the ${sys:variable} prefix, but the ${env:variable} prefix instead. See also http://logging.apache.org/log4j/2.x/manual/lookups.html#EnvironmentLookup
In general the placeholders that work in Spring bean configuration files do not work in Log4j configuration. They look the same, but the syntax and underlying discovery mechanism are completely different.
For instance ${sys:something} attempts to resolve a Java system property. System properties are usually passed to JVM as command line arguments in format -Dkey=value and not stored in property files.
You can try to use Resource bundle syntax ${bundle:MyProperties:MyKey} however this will load from that specific file and will not perform any additional Spring substitutions.
See also:
http://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution
Starting to learn ofbiz, I am following the tutorial here:
https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginnersDevelopmentGuide-SecureYourApplicationbyAuthentication
Now I am in the step to make the list form of persons editable. In this step I need to create a service which will be used for auto-fields-service. Below I give the code which I have done.
In the controller.xml of my componenent I have created a requestMaps as follows:
<request-map uri="updatePracticePerson">
<security https="true" auth="true"/>
<event type="service" invoke="updatePracticePerson"/>
<response name="success" type="view" value="personForm"/>
<response name="error" type="view" value="personForm"/>
</request-map>
Moving now to the PracticeScreens.xml i have the following for personForm:
<screen name="personForm">
<section>
<actions>
<set field="headerItem" value="personForm"/>
<set field="titleProperty" value="PageTitlePracticePersonForm"/>
<entity-condition entity-name="Person" list="persons"/>
</actions>
<widgets>
<decorator-screen name="CommonPracticeDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<label text="Person List" style="h2"/>
<include-form name="ListPersons" location="component://practice/widget/PracticeForms.xml"></include-form>
</decorator-section>
</decorator-screen>
</widgets>
</section>
The above includes the ListPersons from PracticeForms.xml, which I have as :
<form name="ListPersons" type="list" list-name="persons" list-entry-name="person" target="updatePracticePerson" paginate-target="personForm">
<auto-fields-service service-name="updatePracticePerson" default-field-type="edit" map-name="person"/>
<field name="partyId"><hidden/></field>
<field name="submitButton" title="Update" widget-style="smallSubmit"><submit button-type="button"/></field>
<field name="deletePracticePerson" title="Delete Person" widget-style="buttontext">
<hyperlink target="deletePracticePerson?partyId=${person.partyId}" description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
</field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
</form>
If you see above the ListPersons calls the service updatePracticePerson.
inside servicedef/services.xml i have the following:
<service name="updatePracticePerson" default-entity-name="Person" engine="simple"
location="component://practice/script/org/hotwax/practice/PracticeServices.xml" invoke="updatePracticePerson" auth="true">
<description>Create a Person</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<attribute name="salutation" mode="IN" type="String" optional="true"/>
<attribute name="firstName" mode="IN" type="String" optional="false"/>
<attribute name="middleName" mode="IN" type="String" optional="true"/>
<attribute name="lastName" mode="IN" type="String" optional="false"/>
<attribute name="suffix" mode="IN" type="String" optional="true"/>
</service>
In the root of my project in the file ofbiz-component.xml i have :
<service-resource type="model" loader="main" location="servicedef/services.xml"/>
this to make sure that my service is loaded.
Although all of the above seem correct to me I get the following error :
org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.RuntimeException: Error rendering included form named [ListPersons] at location [component://practice/widget/PracticeForms.xml]: java.lang.IllegalArgumentException: Error finding Service with name updatePracticePerson for auto-fields-service in a form widget (Error rendering included form named [ListPersons] at location [component://practice/widget/PracticeForms.xml]: java.lang.IllegalArgumentException: Error finding Service with name updatePracticePerson for auto-fields-service in a form widget)
Which obviously implies that everything is not ok and there is something wrong with my service. Could you please assist on this?
Thanks in advance,
gianis
Restart OFBiz and check the logs. During startup it will show you loading your component and then the services defined in your component. You should be able to see the problem in the logs
at the end i found the answer myself.
in the file on the root of my component ofbiz-component.xml i had:
<resource-loader name="personForm" type="component"/>
when I should have:
<resource-loader name="main" type="component"/>