Tuesday, August 18, 2015

How to customize date display in PrimeFaces Calendar component

There is a scenario where the requirement wants the calendar component to enable certain date only.
eg, enable 1st day of the month only.

To achieve this requirement, attribute beforeShowDay need to be used.
Description for beforeShowDay in PrimeFaces tag document.
Callback to execute before displaying a date, used to customize date display.

Steps:
1. Write the callback function to be called by the Calendar component.
function beforeShowDayCallback(date){
  if (date.getDate() == 1) {
    return [true, ''];
  }
  return [false, ''];
}

2. Call the function in calendar component.
<p:calendar id="gstEffDateId"  beforeShowDay="beforeShowDayCallback"  />


Done!!

Tuesday, August 11, 2015

Synchronize Class List problem when integrating JBoss with eclipseLink

The problem when integrating eclipseLink with JBoss 7.1
the attribute below in persistence.xml is not functioning
<exclude-unlisted-classes>false</exclude-unlisted-classes>

the workaround is to list all the entity class in persistence.xml.
but this is troublesome to developers, every time entities changed. the developers need to re-sync the entity classes again.

To avoid this troublesome step, we need to add additional module into JBoss AS7 to handle this eclipseLink integration.

The official document from JBoss is here.
And steps below are the simplified version of the official document.

1. Download the precompile jar from my drive.
2. Extract and copy the jar to JBoss modules folder
3. add the following line into standalone.xml
    <system-properties>

        <property name="eclipselink.archive.factory"

            value="id.au.ringerc.as7.eclipselinkintegration.JBossArchiveFactoryImpl"/>

    </system-properties>

4. set persistence.xml to exclude classes and remove all synchronized classes.

<exclude-unlisted-classes>false</exclude-unlisted-classes>

p/s: the eclipseLink jar must be 2.4.2 or above


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...