<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: getting the valid date in datetime datatype in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259683#M212813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you considered writing your own custom constraint? Constraints are just Java classes. So your class could look at the date provided and compare it to today and then return false if the date is greater than today's date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will take care of it for the back-end. If you want it validated in real-time in the Share UI you'll have to write your own validator and then use form config to tell Share to use it. You could start with the existing date validator and extend it to compare it to today's date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Feb 2012 21:51:06 GMT</pubDate>
    <dc:creator>jpotts</dc:creator>
    <dc:date>2012-02-08T21:51:06Z</dc:date>
    <item>
      <title>getting the valid date in datetime datatype</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259682#M212812</link>
      <description>Hi All,I have a custom content model.I have written a constraint having datatype "datetime".But the problem is in this datatype someone can give future date .My requirement is to validate the date so nobody can give any future date.Is it possible to get the system date and time while setting the tim</description>
      <pubDate>Tue, 07 Feb 2012 14:21:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259682#M212812</guid>
      <dc:creator>abhashree</dc:creator>
      <dc:date>2012-02-07T14:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: getting the valid date in datetime datatype</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259683#M212813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you considered writing your own custom constraint? Constraints are just Java classes. So your class could look at the date provided and compare it to today and then return false if the date is greater than today's date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will take care of it for the back-end. If you want it validated in real-time in the Share UI you'll have to write your own validator and then use form config to tell Share to use it. You could start with the existing date validator and extend it to compare it to today's date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 21:51:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259683#M212813</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2012-02-08T21:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: getting the valid date in datetime datatype</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259684#M212814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can implement your own Date validator constraint class by extending it with org.alfresco.repo.dictionary.constraint.AbstractConstraint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You just need to override a method protected void evaluateSingleValue(Object value).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just type cast value parameter to java.util.Date and you can compare as you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Post validation, you can return an appropriate message by throwing ConstraintException which takes message and value as parameters in constraint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Following is sample code for you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; protected void evaluateSingleValue(Object value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final String ERR_INVALID_DATE = "d_dictionary.constraint.my_date.invalid_date";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ensure that the value can be converted to a String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date checkValue = (Date) value;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(checkValue.before(new Date())) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;throw new ConstraintException(ERR_INVALID_DATE, value);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Feb 2012 22:28:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/getting-the-valid-date-in-datetime-datatype/m-p/259684#M212814</guid>
      <dc:creator>hemantkpn</dc:creator>
      <dc:date>2012-02-19T22:28:01Z</dc:date>
    </item>
  </channel>
</rss>

