Alfresco Share: renaming label on workflow forms - workflow

I need to rename some labels on workflow forms. I think I've found the resource bundle that need to be edited. It's slingshot.properties file.
I changed values of workflow.field.message and workflow.field.comment to my preference and restarted Alfresco but nothing's changed. Did I miss something?

In $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/web-extension, create a new file called custom-slingshot-application-context.xml with the following content:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="mycustom.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.web-extension.messages.mycustom</value>
</list>
</property>
</bean>
</beans>
In $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/web-extension/messages, create a file called mycustom.properties with the following content:
workflow.field.message=Whatever You Want
Restart Tomcat
Notes:
Please use something more descriptive than "mycustom" in both the
bean ID and the properties file name. This is just an example.
Create folders where they don't exist already.

Related

Configure Spring batch admin to use db2 database

In order to configure spring batch admin UI to use db2 database, I referred the Admin UI documentation which says "launch the application with a system property -DENVIRONMENT=[type]." I understand that "-DENVIRONMENT=db2" should be kept in some file. I tried by keeping in batch-default.properties file, but that did not work. Since I am using WLP(liberty server), tried by keeping in server.xml file, no help. Still in the console I see env-context.xml file from batch admin is still loading batch-hsql.properties file(default configuration).
My job is written using Spring Boot so I put property, ENVIRONMENT=db2 in application.properties and add a new file - batch-db2.properties at same location as application.properties.
Few compulsory properties will be needed there like - you need to try an experiment,
batch.job.configuration.package=
batch.drop.script=classpath*:/org/springframework/batch/core/schema-drop-db2.sql
batch.schema.script=
batch.business.schema.script=
#Copied from batch.properties of spring-batch-admin-manager API project
batch.jdbc.testWhileIdle=false
batch.jdbc.validationQuery=
batch.data.source.init=false
batch.job.configuration.file.dir=target/config
batch.job.service.reaper.interval=60000
batch.files.upload-dir=/sba/input
I had put DB connection information too but later I moved to JNDI by overriding file - data-source-context.xml in META-INF\spring\batch\override like below,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="ConnectionPool" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
ConnectionPool is db connection pool JNDI name from server.
Keeping configurations in your code lets you freely move your app to different servers without asking for server specific configurations first.
Not really familiar with liberty server, but the link below says that system properties need to be added to jvm.options file. See link below :
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_admin_customvars.html

JPA 2.0 Ehcache configuration for L2 cache throwing Error

I am trying to configure Ehcache for JPA 2.0.
first i have setup following into persistance.xml
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.generate_statistics" value="true"/>
I have ehcache.xml in my class path.
configure #Cacheable(true) to my #Entity class.
I am getting following error.
net.sf.ehcache.config.InvalidConfigurationException: There is one error in your configuration:
* Cache 'net.sf.ehcache.constructs.asynchronous.MessageCache' error: If your CacheManager has no maxBytesLocalHeap set, you need to either set maxEntriesLocalHeap or maxBytesLocalHeap at the Cache level
ehcache.xml
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<!-- By default, Ehcache stored the cached files in temp folder. -->
<!-- <diskStore path="java.io.tmpdir" /> -->
<!-- Ask Ehcache to store cache in this path -->
<diskStore path="c:\\cache" />
<!-- Sample cache named cache1
This cache contains a maximum in memory of 10000 elements, and will expire
an element if it is idle for more than 5 minutes and lives for more than
10 minutes.
If there are more than 10000 elements it will overflow to the
disk cache, which in this configuration will go to wherever java.io.tmp is
defined on your system. On a standard Linux system this will be /tmp" -->
<Cache name = "com.test.myDataDE"
maxEntriesLocalHeap="10000"
maxEntriesLocalDisk="1000"
eternal="false"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300" timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
transactionalMode="off">
<persistence strategy="localTempSwap" />
</Cache>
</ehcache>
Please help me understand any mistake I am doing?
I had the same problem today, solved it by adding:
maxBytesLocalHeap="100M"
and removing:
maxEntriesLocalHeap
in my ehcache.xml configuration.
Without your ehcache.xml content, it is hard to be definitive.
However, given the error message, I believe the issue is that you did not specify a heap size to your cache, either in entries or in bytes.

Error: "reading schema error: error calling driver#connect" when configuring Table filters in the Hibernate Reverse Engineering File (reveng.xml)

I am having some problems trying to configure Hibernate in my Java Project. I was looking around the forum, but I could not find any solution. I am new to Hibernate, Could you please help me? Thanks in advance.
Here is my hibernate.cfg.xml file content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="ConexionHibernate">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">hr</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:1521/xe</property>
<property name="hibernate.connection.username">hr</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
</session-factory>
</hibernate-configuration>
This is how my DataBase Connection looks like in Oracle SQL Developer
This is the error itself when i try configure the tables.
In your config jdbc driver is set for mysql and also the connection url is not correct, for oracle it's:
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#localhost:1521:xe</property>

odatagen: Failed to generate proxy classes. Please verify the metadata (iOS)

Im working on Open Data Protocol (OData) which is a standardized protocol for creating and consuming data API's.
OData builds on core protocols like HTTP and commonly accepted methodologies like REST .
I have installed, configured and built OData successfully on iOS6
Currently I'm creating a Proxy class to connect to the OData Service using the following commands:
cd /Users/Shamsu/Applications/ODataObjC/ODataSDKV1-1.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug
./odatagen /uri=http://35.35.6.4/MyApp.MyApp3D.DataService/MyApp3DDataService.svc/ /out=/Users/Ramshad/Applications/ODataObjC/ODataSDKV1-1.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug /u=sa /p=123
However, I'm getting the error: "odatagen: Failed to generate proxy classes. Please verify the metadata"
I can see the "metadata.xml" file is updated as
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="MyAppDBModel" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="User">
<Key>
<PropertyRef Name="UserID" />
</Key>
<Property Name="UserID" Type="Edm.Guid" Nullable="false" />
<Property Name="UserName" Type="Edm.String" MaxLength="10" FixedLength="true" Unicode="true" />
<Property Name="UserDescription" Type="Edm.String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Active" Type="Edm.Int64" />
</EntityType>
</Schema>
<Schema Namespace="MyApp.MyApp3D.DataService" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="MyAppDBEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="User" EntityType="MyAppDBModel.User" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx> "
Note: the metadata.xml file is located at out param location (/Users/Ramshad/Applications/ODataObjC/ODataSDKV11.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug /metadata.xml)
I'm unable to identify the issue. Any problem with my windows WCF service /ODataService configuration/database configuration ? Permission assigned as * (read,write).
Any help on this issue is appreciated.
Thanks.
I looked a bit closer at the XSLT document I linked to in my original comment, and it seems that the odatagen tool hasn't been updated to work with CSDL v3. The version of CSDL (i.e., the format used to serialize the metadata document) is indicated by the xml namespace of the Schema element. In your metadata, that namespace is http://schemas.microsoft.com/ado/2009/11/edm, which indicates CSDL v3. You can see in the XSLT document here that this namespace isn't recognized by the odatagen tool.
Since the odatagen tool is open source (see the source on github), you can try to tweak the code and XSLT files to make it work for your situation. You could try to just add the v3 namespace to the recognized schema namespaces, and if your metadata doesn't use any v3 features, I would imagine it would just work. Off the top of my head I'm not sure of the exact differences between v2 and v3, so I can't immediately say whether the metadata you've posted above would be valid in CSDL v2.
Alternatively, you could try to generate the $metadata document so that it's using CSDL v2 instead.
Sorry I don't have a better answer for you. Unfortunately, the odatagen tool has fallen a bit behind. But you're more than welcome to contribute to the project :)

Best ways to deal with properties values in XML file in Spring, Maven and Eclipses

I am working on a Spring WebFlow project which has a lot of property values in XML files, as any Spring programmer knows. I have database user names, password, URLs, etc.
We are using Eclipse with Spring WebFlow and Maven. We are trying to have an SA do the builds but the SA does not want to go into the XML files to change the values, but on the other hand, we don't know the production values. How do we work with this?
Most SA are more willing and confident to deal with .properties file rather than .xml.
Spring provide PropertyPlaceholderConfigurer to let you define everything into one or several .properties file and substitute the placeholder in applicationContext.xml.
Create a app.properties under src/main/resources/ folder:
... ...
# Dadabase connection settings:
jdbc.driverClassName=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost:5432/app_db
jdbc.username=app_admin
jdbc.password=password
... ...
And use PropertyPlaceholderConfigurer in applicationContext.xml like so:
... ...
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>app.properties</value>
</property>
</bean>
... ...
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
Check out Spring PropertyPlaceholderConfigurer Example for more details.
In addition, from application deployment perspective, we usually package app in some executable format and the .properties files are usually packed inside the executable war or ear file. A simple solution is to configure your PropertyPlaceholderConfigurer bean to resolve properties from multiple location in a pre-defined order, so in the deployment environment, you can use a fixed location or environment variable to specify the properties file, also note that in order to simplify the deploy/configure task for SA, we usually use a single external .properties file define all runtime configuration, like so:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- Default location inside war file -->
<value>classpath:app.properties</value>
<!-- Environment specific location, a fixed path on server -->
<value>file:///opt/my-app/conf/app.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true"/>
</bean>
Hope this helps.
Another simple way is Spring Expression Language (SpEL)
for example
<property name="url" value="#{ systemProperties['jdbc.url'] }" />
Documentation
spring documentations
Also you can define a propertyConfigurer programmatically in configuration class:
#Configuration
#PropertySource("classpath:application.properties")
public class PropertiesConfiguration {
#Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(Environment env) {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
configurer.setEnvironment(env);
return configurer;
}
}