cancel
Showing results for 
Search instead for 
Did you mean: 

Additional Date type attribute for person

raweck
Champ on-the-rise
Champ on-the-rise
I wanted to extend user attributes by new Date type attribute.
I added:
<property name="cm:replacementPersonStartDate">  <type>d:date</type></property>‍‍‍‍‍
to contentModel.xml file.

<tr><td><h:outputText value="#{msg.replacement_person_start_date}"/>:</td><td><h:inputText id="replacement_person_start_date" value="#{UsersBean.person.properties.replacementPersonStartDate}" size="35" maxlength="1024" onkeyup="updateButtonState();" onchange="updateButtonState();" /> *</td></tr>‍‍‍‍‍‍‍‍
to edit-user-details.jsp file.

<td class="propertiesLabel"><h:outputText value="#{msg.replacement_person_start_date}" />:</td><td><h:outputText value="#{UsersBean.person.properties.replacementPersonStartDate}" /></td></tr>‍‍‍‍‍‍‍‍‍
to user-console.jsp file.

I added props.put(…(Date)…) line in changeUserDetails() :
public String changeUserDetails(){…props.put(ContentModel.PROP_EMAIL, (String)getPerson().getProperties().get(ContentModel.PROP_EMAIL));props.put(ContentModel.PROP_REPLACEMENT_PERSON_START_DATE,(Date)getPerson().getProperties().get(ContentModel.PROP_REPLACEMENT_PERSON_START_DATE));…this.nodeService.setProperties(getPerson().getNodeRef(), props);…}‍‍‍‍‍‍‍‍‍‍‍‍‍
in UsersBean.java file.

If I do it for String or Integer type attribute it works, for Date type attribute it does not. What is wrong?
2 REPLIES 2

rivarola
Champ on-the-rise
Champ on-the-rise
Hello,

Are you sure your h:inputText will not need a converter to convert the input text into Date ?
Anyway, can you explain what goes wrong ?

raweck
Champ on-the-rise
Champ on-the-rise
You are right! It was converter! I set it before, but I had to make mistake than.
I used:
<f:convertDateTime dateStyle="short" pattern="dd-MM-yyyy"/>
and it seems OK now.

Thank you very much!