<?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: How to check that my document title is unique before the document creation ? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-check-that-my-document-title-is-unique-before-the/m-p/324164#M11165</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Nuxeo Studio open the world of Nuxeo EP configuration and development for the non-developper users/integrators. Interface is simple and intuitive for functional people.&lt;/P&gt;
&lt;P&gt;What you are wanted to do is much more complex for non-developper guy, but easy for developer guy with Nuxeo.&lt;/P&gt;
&lt;P&gt;What you want to do is technically create a JSF validator and bind it to the title widget. If you don't understand these notion you will need to get a training session to understand JSF. But you can start by reading this &lt;A href="http://www.ibm.com/developerworks/library/j-jsf1/"&gt;really interesting documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;So JSF validator is out of what you can do with Nuxeo Studio and that's why we have created Nuxeo IDE.&lt;/P&gt;
&lt;P&gt;Nuxeo IDE is free and documentation is here: &lt;A href="http://doc.nuxeo.com/x/ZYKE" target="test_blank"&gt;http://doc.nuxeo.com/x/ZYKE&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can create with Nuxeo IDE a bundle project easily, see &lt;A href="http://doc.nuxeo.com/x/aoKE"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You may know that validator &lt;A href="http://www.ibm.com/developerworks/library/j-jsf3/#N1048B"&gt;can be a method on&lt;/A&gt; a &lt;A href="http://docs.jboss.org/seam/2.1.2/reference/en-US/html/controls.html#controls.annotations"&gt;Seam component&lt;/A&gt; that can be easily created with Nuxeo IDE. You will not have to declare the validator. You will just have to write yourComponent as validator value.&lt;/P&gt;
&lt;P&gt;You will benefit of the Nuxeo IDE Hot Reloading feature during the development and give a really easy way to create your seam component with one click (no more to manage maven dependency, seam.property file, ...)&lt;/P&gt;
&lt;P&gt;About the validation code you can use this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@In(create = true, required = false)
protected transient CoreSession documentManager;

@In(create = true)
protected transient NavigationContext navigationContext;

public void validate(FacesContext context, UIComponent cmp, Object value) throws ValidatorException {
  DocumentModel currentDocument = navigationContext.getCurrentDocument();

  String title = currentDocument.getPropertyValue("dc:title");
  String query = String.format("SELECT * FROM MyDocumentType WHERE dc:title = '%s' ", title);
  DocumentModelList docs = documentManager.query(query);

  ... etc ...
} 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I will continue that you can add validator directly into widgets you use when you describes form of documents. You have a documentation that explains this point: &lt;A href="http://doc.nuxeo.com/x/pgQz" target="test_blank"&gt;http://doc.nuxeo.com/x/pgQz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Hope this will help.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2012 14:07:51 GMT</pubDate>
    <dc:creator>Benjamin_Jalon1</dc:creator>
    <dc:date>2012-01-03T14:07:51Z</dc:date>
    <item>
      <title>How to check that my document title is unique before the document creation ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-check-that-my-document-title-is-unique-before-the/m-p/324163#M11164</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I create my document type with studio and configure the view/edit/creation layout.&lt;/P&gt;
&lt;P&gt;How can I refuse the document creation if there is a document with same title into the container and add a red message under the title field to tell there is another document with the same name ?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2012 13:42:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-check-that-my-document-title-is-unique-before-the/m-p/324163#M11164</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-01-03T13:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to check that my document title is unique before the document creation ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-check-that-my-document-title-is-unique-before-the/m-p/324164#M11165</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Nuxeo Studio open the world of Nuxeo EP configuration and development for the non-developper users/integrators. Interface is simple and intuitive for functional people.&lt;/P&gt;
&lt;P&gt;What you are wanted to do is much more complex for non-developper guy, but easy for developer guy with Nuxeo.&lt;/P&gt;
&lt;P&gt;What you want to do is technically create a JSF validator and bind it to the title widget. If you don't understand these notion you will need to get a training session to understand JSF. But you can start by reading this &lt;A href="http://www.ibm.com/developerworks/library/j-jsf1/"&gt;really interesting documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;So JSF validator is out of what you can do with Nuxeo Studio and that's why we have created Nuxeo IDE.&lt;/P&gt;
&lt;P&gt;Nuxeo IDE is free and documentation is here: &lt;A href="http://doc.nuxeo.com/x/ZYKE" target="test_blank"&gt;http://doc.nuxeo.com/x/ZYKE&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can create with Nuxeo IDE a bundle project easily, see &lt;A href="http://doc.nuxeo.com/x/aoKE"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You may know that validator &lt;A href="http://www.ibm.com/developerworks/library/j-jsf3/#N1048B"&gt;can be a method on&lt;/A&gt; a &lt;A href="http://docs.jboss.org/seam/2.1.2/reference/en-US/html/controls.html#controls.annotations"&gt;Seam component&lt;/A&gt; that can be easily created with Nuxeo IDE. You will not have to declare the validator. You will just have to write yourComponent as validator value.&lt;/P&gt;
&lt;P&gt;You will benefit of the Nuxeo IDE Hot Reloading feature during the development and give a really easy way to create your seam component with one click (no more to manage maven dependency, seam.property file, ...)&lt;/P&gt;
&lt;P&gt;About the validation code you can use this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@In(create = true, required = false)
protected transient CoreSession documentManager;

@In(create = true)
protected transient NavigationContext navigationContext;

public void validate(FacesContext context, UIComponent cmp, Object value) throws ValidatorException {
  DocumentModel currentDocument = navigationContext.getCurrentDocument();

  String title = currentDocument.getPropertyValue("dc:title");
  String query = String.format("SELECT * FROM MyDocumentType WHERE dc:title = '%s' ", title);
  DocumentModelList docs = documentManager.query(query);

  ... etc ...
} 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I will continue that you can add validator directly into widgets you use when you describes form of documents. You have a documentation that explains this point: &lt;A href="http://doc.nuxeo.com/x/pgQz" target="test_blank"&gt;http://doc.nuxeo.com/x/pgQz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Hope this will help.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2012 14:07:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-check-that-my-document-title-is-unique-before-the/m-p/324164#M11165</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-01-03T14:07:51Z</dc:date>
    </item>
  </channel>
</rss>

