Set the name of an input control in a jrxml file. Is it possible? - jasper-reports

I'd like to set the name of an input control in the jrxml file where it is defined; is that possible?
I know how to set the name of the input control via the Repository Explorer in Jaspersoft Studio, and I know how to set the name of an input control via the Jaspersoft Server.
However, I'd like to set the name of an input control in the jrxml file so that it will be set automatically upon being published to the server. Is there a property to use, similar to the following:
<parameter name="status_date_minimum" class="java.sql.Date">
<property name="some.property.key" vhalue="Minimum Status Date"/>
<defaultValueExpression><![CDATA[java.sql.Date.valueOf(java.time.LocalDate.now().minusYears(10).withMonth(1).withDayOfMonth(1))]]></defaultValueExpression>
</parameter>

As noted by #Siddharth in comments and suggested to me by a co-worker, there is a way to specify the label for the control outside of the user interface.
JasperReports Server associates each report with an XML file that it appears to create around the time it publishes your report to the server. The XML file contains, among other information, the labels for any input controls.
For an example of the XML file, first publish your report to a location on JasperReports Server. For the purpose of this example, the report file name is report.jrxml and the location is path/to/your; JasperReports Server appears to publish your report to path/to/your/report/Main jrxml (per JasperSoft Studio Repository Explorer) or path/to/your/report (per JasperReports Server Web UI).
Second, export your report from JasperReports Server (via the Web UI or via the command line); JasperReports Server will produce a zip file with the following content:
/index.xml
/resources/path/.folder.xml
/resources/path/to/.folder.xml
/resources/path/to/your/.folder.xml
/resources/path/to/your/report.xml
/resources/path/to/your/report_files/main_jrxml.data
main_jrxml.data contains the data from report.jrxml; report.xml contains the labels for any input controls. The content of report.xml may be similar to the following:
<?xml version="1.0" encoding="UTF-8"?>
<reportUnit exportedWithPermissions="true">
<folder>/resources/path/to/your</folder>
<name>report</name>
<version>2</version>
<label>report</label>
<description></description>
<creationDate>2018-03-21T18:12:41.759-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.602-04:00</updateDate>
<mainReport>
<localResource
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exportedWithPermissions="false" dataFile="main_jrxml.data" xsi:type="fileResource">
<folder>/resources/path/to/your/report_files</folder>
<name>main_jrxml</name>
<version>4</version>
<label>Main jrxml</label>
<creationDate>2018-03-21T18:12:41.759-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.410-04:00</updateDate>
<fileType>jrxml</fileType>
</localResource>
</mainReport>
<inputControl>
<localResource
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exportedWithPermissions="false" xsi:type="inputControl">
<folder>/resources/path/to/your/report_files</folder>
<name>status_date_minimum</name>
<version>1</version>
<label>status_date_minimum</label>
<creationDate>2018-03-21T18:48:35.602-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.602-04:00</updateDate>
<type>2</type>
<mandatory>false</mandatory>
<readOnly>false</readOnly>
<visible>true</visible>
<dataType>
<localResource exportedWithPermissions="false" xsi:type="dataType">
<folder>/resources/path/to/your/report_files/status_date_minimum_files</folder>
<name>myDatatype</name>
<version>0</version>
<label>myDatatype</label>
<creationDate>2018-03-21T18:48:35.602-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.602-04:00</updateDate>
<type>3</type>
<strictMin>false</strictMin>
<strictMax>false</strictMax>
</localResource>
</dataType>
</localResource>
</inputControl>
<inputControl>
<localResource
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exportedWithPermissions="false" xsi:type="inputControl">
<folder>/resources/path/to/your/report_files</folder>
<name>status_date_maximum</name>
<version>1</version>
<label>status_date_maximum</label>
<creationDate>2018-03-21T18:48:35.602-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.602-04:00</updateDate>
<type>2</type>
<mandatory>false</mandatory>
<readOnly>false</readOnly>
<visible>true</visible>
<dataType>
<localResource exportedWithPermissions="false" xsi:type="dataType">
<folder>/resources/path/to/your/report_files/status_date_maximum_files</folder>
<name>myDatatype</name>
<version>0</version>
<label>myDatatype</label>
<creationDate>2018-03-21T18:48:35.602-04:00</creationDate>
<updateDate>2018-03-21T18:48:35.602-04:00</updateDate>
<type>3</type>
<strictMin>false</strictMin>
<strictMax>false</strictMax>
</localResource>
</dataType>
</localResource>
</inputControl>
<alwaysPromptControls>true</alwaysPromptControls>
<controlsLayout>1</controlsLayout>
</reportUnit>
You may edit the content of the reportUnit/inputControl/localResource/label element to change the name of the label.
Once edited, you may import the data into the JasperReports Server. If you import through the command line, I recommend importing the directory, not the zip file - it appears that the command line import is picky about the zip format. Also, if you import through the command line, you must restart the JasperReports Server before you may run your changed report.

Related

Deploying communities using package.xml

I am trying to retrieve Salesforce communities names 'XXX Community' from one org into VS Code and subsequently want to deploy it into another org.
However, when I use the sfdx force:source:retrieve -u DemoMaster -x ./package.xml command, for the below package.xml file, I get the following error:
Entity of type 'CustomSite' named 'XXX_Community_Test' cannot be found
Entity of type 'SiteDotCom' named 'XXX_Community_Test1' cannot be found
Only the network and network branding elements got retrieved.
The package.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>XXX Community</members>
<name>Network</name>
</types>
<types>
<members>XXX_Community_Test</members>
<name>CustomSite</name>
</types>
<types>
<members>XXX Community_Test1</members>
<name>SiteDotCom</name>
</types>
<types>
<members>cbXXX_Community</members>
<name>NetworkBranding</name>
</types>
<version>48.0</version>
</Package>
Any help appreciated!
D

XSLT streaming not streaming

I'm using Saxon-EE for the purpose of streaming XSLT transformation of large XML. The transformation works fine but it seems it's not really streaming since the java.exe process is inflating: for a 100 MB XML, process memory increases ~1GB. This is the XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:bb="urn:xx-zz-1.1"
xmlns:aa="urn:xx-yy-1.1">
<xsl:mode streamable="yes"/>
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
<xsl:for-each select="aa:LevelOne/aa:LevelTwo">
<xsl:iterate select="bb:LevelThree! copy-of(.)">
<xsl:value-of select="concat(bb:fieldOne,',',bb:fieldTwo,'
')"/>
</xsl:iterate>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This is the XML:
<?xml version="1.0" encoding="utf-8"?>
<aa:LevelOne xmlns="urn:xx-zz-1.1" xmlns:aa="urn:xx-yy-1.1">
<aa:LevelTwo xmlns="urn:xx-zz-1.1" xmlns:aa="urn:xx-yy-1.1">
<LevelThree xmlns="urn:xx-zz-1.1">
<fieldOne>f1</fieldOne>
<fieldTwo>f2</fieldTwo>
</LevelThree>
<!-- Level three is repeated many times -->
</aa:LevelTwo>
</aa:LevelOne>
I would like to know if there (& what) is a problem with the XSLT above.
The code I use:
net.sf.saxon.s9api.Processor processor = new net.sf.saxon.s9api.Processor(true);
processor.setConfigurationProperty(Feature.STREAMABILITY, "standard");
XsltCompiler compiler = processor.newXsltCompiler();
XsltExecutable stylesheet = compiler.compile(new StreamSource(stylesheetFile));
Serializer out = processor.newSerializer(outputCsvFile);
Xslt30Transformer transformer = stylesheet.load30();
transformer.applyTemplates(new StreamSource(xmlFile), out);
EDIT: Fixed the XSLT so it compiles & added XML example.
Remark: using command java -cp "<path>\test;<path>\saxon9ee.jar" com.example.test.Test -t does not ouput additional info (only the printlns in the code). java -cp "<path>\test;<path>\saxon9ee.jar" -t com.example.test.Test outputs: Unrecognized option: -Xt Error: Could not create the Java Virtual Machine. If I change the XSLT to non-streamable rule e.g. remove the iterate line, program outputs Template rule is not streamable, also without -t option. In this case if I remove the streamability requirement from code/xslt, the error goes away.
Thanks.
Probably the most likely reason Saxon would fall back to non-streaming mode is that it hasn't located a Saxon-EE license. The easiest way to test that is (unintuitively!) by calling processor.isSchemaAware() - that will only be true if you're running Saxon-EE code with a recognized license, which is exactly the same condition to enable streaming.
If it hasn't found a license, the Saxon documentation includes a section on troubleshooting license problems at http://www.saxonica.com/documentation/index.html#!about/license
Also, try it from the command line with option -t; that will give you more information (a) about streaming, and (b) about loading of license files.
I think, if the data is as simple and as regular as shown in the question, then you can avoid the use of copy-of() and simply use
<xsl:iterate select="bb:LevelThree">
<xsl:value-of select="bb:*" separator=","/>
<xsl:text>
</xsl:text>
</xsl:iterate>
That in a quick test shows a reduced memory consumption compared to your posted approach.
As for your posted approach not using streaming with Saxon EE 9.9, I have tested the posted XSLT and the input sample with Saxon 9.9 EE from the command line with the -t option and it shows the input is streamed.
I also think the Java code shown is fine to process the file with streaming with Saxon EE.
For a detailed analysis of the memory consumption and any problems you encounter with that it might be better to raise an issue with all details on the Saxonica support site. I am not sure how the memory info Saxon outputs relates exactly to the one you say you see for java.exe.

Output in txt format in JasperReports Server

I'm using JasperReports Server 6.4.2. And in "Output Options" tab of "New Schedule" windows I have such list of output formats:
And I would like to add here .txt format. I uncommented the following line in \JasperReports Server\apache-tomcat\webapps\jasperserver\WEB-INF\flows\viewReportBeans.xml file:
<!--
<entry key="txt" value-ref="txtExporterConfiguration"/>
-->
and uncommented the lines:
<!--
<bean class="com.jaspersoft.jasperserver.war.dto.ByteEnum">
<property name="code">
<util:constant static-field="com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJob.OUTPUT_FORMAT_TXT"/>
</property>
<property name="labelMessage">
<value>report.output.txt.label</value>
</property>
</bean>
-->
in \JasperReports Server\apache-tomcat\webapps\jasperserver\WEB-INF\flows\reportJobBeans.xml file, but these actions didn't make any visual effect, the "Text only" format didn't appear on the "Formats" form. How to add this format on the form?
I found also the similar question on the official jasper site, but, unfortunately, without answer... It seems the matter is in 6.x version.
At last I found instruction how to do this. The steps that I lacked: editing \JasperReports Server\apache-tomcat\webapps\jasperserver\scripts\scheduler\view\editor\outputTabView.js file and disabling "javascript.optimize" property in WEB-INF\js.config.properties file. After these actions "TXT" checkbox eventually appeared on the form:

SSMA ProtectedStorage.ssma file being used by another process

I am getting a repeated error trying to build the protected storage file for SSMA for Oracle version 6.0.1. I have made various attempts; nothing works! SSMA insists on writing to the roaming profile directory and the file it writes to is ALWAYS in use. Even if I reboot it is reported to be "in use." Even if I power down and restart, it is reported to be in use. Even when I use my home computer (which is configured with a local profile and where there is no place to roam), the application writes to the roaming profile and the file is reported to be in use. It is the same with SSMA 5.3. I also tried launching the special command shell with the same result. It is the same with the 2012 server version. I also tried using hardcoded values and skipping the variable file.
No one else reports this issue. Does anyone know what am I doing wrong or how I can work around this issue?
Here is the command and error text:
C:\Windows\System32>SSMAforORacleConsole.exe -securepassword -add DEV -s "y:\dba\projects\OracleToSQLServerMigration\SSMAProjects\DEV_Migration\command-config\DataMigrationDEV.xml" -v y:\dba\projects\OracleToSQLServerMigration\SSMAProjects\DEV_Migration\command-config\VariableValueFileSample - DEV.xml"
[5/19/2016 10:32:33 AM] INPUT Enter password for server id 'DEV': ****
[5/19/2016 10:32:36 AM] INPUT Re-enter password for server id 'DEV': ****
[5/19/2016 10:32:38 AM] FATALERR Unexpected error during addition of servers to protected storage
[5/19/2016 10:32:38 AM] **NESTED The process cannot access the file 'C:\Users\amorris\AppData\Roaming\Microsoft SQL Server Migration Assistant\Oracle\ProtectedStorage.ssma' because it is being used by another process.**
Here is the connection file, DataMigrationDEV.xml (edited to remove server information):
<?xml version="1.0" encoding="UTF-8"?>
-<ssma-script-file xsi:noNamespaceSchemaLocation="..\Schemas\O2SSConsoleScriptSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<config>
-<output-providers>
<data-migration-connection target-server="AAA_DEV" source-server="DEV"/>
<log-verbosity level="debug"/>
</output-providers>
</config>
-<servers>
-<sql-server name="AAA_DEV">
-<windows-authentication>
<server value="$SQLServerName$"/>
<database value="$SQLServerDb$"/>
<encrypt value="true"/>
<trust-server-certificate value="true"/>
</windows-authentication>
</sql-server>
-<oracle name="DEV">
-<tns-name-mode>
<connection-provider value="Oracle Client Provider"/>
<service-name value="$OracleInstance$"/>
<user-id value="$OracleUserName$"/>
</tns-name-mode>
</oracle>
</servers>
-<script-commands>
<connect-source-database server="DEV"/>
<connect-target-database server="AAA_DEV"/>
<map-schema sql-server-schema="$SQLServerDb$.dbo" source- schema="$OracleSchemaName$"/>
<migrate-data verbose="true" report-errors="true" write-summary-report- to="$SummaryReports$" object-type="category" object-name="$OracleSchemaName$.Tables"/>
</script-commands>
</ssma-script-file>
Here is the variable file (edited to remove identifying information):
<?xml version="1.0" encoding="utf-8"?>
<!--
Variable value file for SSMA-v4.2 Console for Oracle adapted for AIMS.
Specified name and value attribute values are mandatory
Name values should begin and end with '$'
Use of this file is NOT mandatory
option -v[ariable]. See the documentation for SSMA-v4.2 Console for more information.
-->
<variables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schemas\ConsoleScriptVariablesSchema.xsd">
<!--
********************************** MUST DO **************************************************
***** MUST replace occurrences of {<value>} with appropriate values wherever necessary *****
*********************************************************************************************
-->
<!--
***************************************************************************
***** The "working folder" {Working Folder Path} should exist *****
***** prior to console script execution *****
***************************************************************************
-->
<variable name="$WorkingFolder$" value="d:\app\OracleToSQLServerMigration\DEV_Migration\"/>
<variable-group name="OracleConnection">
<variable name="$OracleInstance$" value="DEV"/>
<variable name="$OracleUserName$" value="USERA"/>
<variable name="$OraclePassword$" value="{password}"/>
<variable name="$OracleSchemaName$" value="SCHEMAA"/>
</variable-group>
<variable-group name="SQLServerConnection">
<variable name="$SQLServerName$" value="dev.sample.edu\DEV"/>
<variable name="$SQLServerDb$" value="MigrationTest"/>
</variable-group>
<variable-group name="Report">
<variable name="$SummaryReports$" value="$WorkingFolder$"/>
<variable name="$AssessmentReportFolderName$" value="AssessmentReports"/>
<variable name="$AssessmentReports$" value="$WorkingFolder$\$AssessmentReportFolderName$"/>
<variable name="$RefreshDBFolder$" value="$WorkingFolder$"/>
<variable name="$ConvertARReportsFolder$" value="$WorkingFolder$\$AssessmentReportFolderName$"/>
<variable name="$SynchronizationReports$" value="$WorkingFolder$"/>
<variable name="$SaveScriptFolder$" value="$WorkingFolder$"/>
<variable name="$ConvertSQLReports$" value="$WorkingFolder$"/>
<!--
***************************************************************************
***** The folder {Folder where sql files are stored} needs to exists *****
***** and should contain the *.sql files that need to be converted *****
***** using convert-sql-statement command *****
***************************************************************************
-->
<variable name="$ConvertSqlSampleFiles$" value="$WorkingFolder$\ {Folder where sql files are stored}"/>
</variable-group>
<variable-group name="ProjectSpecs">
<variable name="$project_name$" value="DEV_Migration"/>
<variable name="$project_overwrite$" value="true"/>
<variable name="$project_type$" value="sql-server-2014"/>
<variable name="$project_folder$" value="$WorkingFolder$\$project_name$"/>
</variable-group>
</variables>
I have been through some web pages for file used by another process errors. I just do not see how the file could be used by another process. It gets created by this application! And the repetition on all servers makes a legitimate error or any kind of server permission error less likely.
Any ideas?
Thank you,
A L Morris

Change VMConfig file using azure powershell

I have a vmConfig file. I want to change subnet and IP Address as I want to create a new VM out of config file in new subnet, rest all configurations no need to be changed. I can manually edit xml file content but I want to do it through powershell so that I can have an automated process for everything.
Here is the sample vmConfig xml-
<?xml version="1.0" encoding="utf-8"?>
<PersistentVM xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ConfigurationSets>
<ConfigurationSet xsi:type="NetworkConfigurationSet">
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
<InputEndpoints>
<InputEndpoint>
<LocalPort>5986</LocalPort>
<Name>PowerShell</Name>
<Port>64929</Port>
<Protocol>tcp</Protocol>
<Vip>191.237.20.225</Vip>
<EnableDirectServerReturn>false</EnableDirectServerReturn>
<IdleTimeoutInMinutes xsi:nil="true" />
</InputEndpoint>
</InputEndpoints>
<SubnetNames>
<string>mysubnet</string>
</SubnetNames>
<StaticVirtualNetworkIPAddress>12.13.14.15</StaticVirtualNetworkIPAddress>
<PublicIPs />
<NetworkInterfaces />
I am interested changing only IP Address and Subnet.
This is basically xml parsing using powershell. I hope this should work for you-
$path = 'C:\myFolder\XmlVM.xml'
[xml]$myXML = Get-Content $path
$myXML.PersistentVM.ConfigurationSets.ConfigurationSet.SubnetNames.string="MYNEWSUBNET"
$myXML.PersistentVM.ConfigurationSets.ConfigurationSet.StaticVirtualNetworkIPAddress="10.11.14.115"
$myXML.Save($path)