Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-1355

AdvancedSearch does not work whit custom type of type d:int with a constraint of type LIST

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: No Version
    • Fix Version/s: 2.2.8, 3.3.2
    • Component/s: Installer
    • Labels:
      None
    • Environment:
      Alfresco Enterprise 2.1
    • Bug Priority:
      Category 2
    • ACT Numbers:

      3843, 14514

      Description

      I have a custom type of type d:int with a constraint of type LIST defined as follows:

      <constraints>
      <constraint name="fact:estadosFactura" type="LIST">
      <parameter name="allowedValues">
      <list>
      <value>-1</value>
      <value>0</value>
      <value>1</value>
      <value>2</value>
      </list>
      </parameter>
      </constraint>
      </constraints>

      <!-- Type and Aspect definitions go here -->
      <types>
      <type name="fact:facturaproveedor">
      <title>Factura</title>
      <parent>cm:content</parent>
      <properties>
      <property name="fact:estadoFactura">
      <title>Estado de la factura</title>
      <type>d:int</type>
      <constraints>
      <constraint ref="fact:estadosFactura"/>
      </constraints>
      </property>
      </properties>
      </type>
      </types>

      Next included in the advanced search via web-client-config-custom.xml :

      <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
      <content-types>
      <type name="fact:facturaproveedor" />
      </content-types>
      <custom-properties>

      <meta-data type="fact:facturaproveedor" property="fact:estadoFactura" display-label-id="customModel_fact_estadoFactura" />
      </custom-properties>
      </advanced-search>
      </config>

      When searching the value asigned to the property is 'true' instead of what it was chose in the select (should be of type int) so the search fails. In the log output for impl.lucene.LuceneQueryParser appears: '+@{fact.model}estadoFactura:"true" '

      I think it's because in the org.alfresco.web.bean.search#search() method it the data type is int th following code is executed

      else if (DataTypeDefinition.INT.equals(typeName) || DataTypeDefinition.LONG.equals(typeName) ||
      DataTypeDefinition.FLOAT.equals(typeName) || DataTypeDefinition.DOUBLE.equals(typeName))
      {
      String strVal = value.toString();
      if (strVal != null && strVal.length() != 0)

      { search.addFixedValueQuery(QName.createQName(qname), strVal); }

      }

      instead of

      else if (value != null)
      {
      Object item = properties.getCustomProperties().get(
      UISearchCustomProperties.PREFIX_LOV_ITEM + qname);
      if (item != null)
      {
      // ListOfValues
      if (((Boolean)value) == true)

      { search.addFixedValueQuery(QName.createQName(qname), item.toString()); }

      }
      else
      {
      // by default use toString() value - this is for text fields and unknown types
      String strVal = value.toString();
      if (strVal != null && strVal.length() != 0)

      { search.addAttributeQuery(QName.createQName(qname), strVal); }

      }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs
                Reporter:
                togomez Roberto Gomez
              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: