Hierarchy Developer's Guide for Oracle Billing Insight > Extending Advanced Hierarchy Manager Use Cases > Making OMF Objects Work with Hierarchy Manager >

Configuring Searchable Properties


Three types of property are available for search: simple property, references to other objects, and extended attribute of the business object. Through object reference, your search can be conducted across multiple objects. You can specify your own search configuration in one or multiple files.

Specify the search Meta data bean to specify which attributes can be searched by. In the ServiceAgreement class, use the SimpleProperty bean class to indicate that the simple property name and description can be searched. See the following example configuration:

<bean id="serviceAgreementSearchMeta"
class="com.edocs.common.omf.search.SearchMetaDataSupport" singleton="true">

<property name="beanClassName">
<value>com.edocs.common.omf.serviceagreement.ServiceAgreement</value>
</property>
<property name="propertyList">
<list>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name">
<value>name</value>
</property>
</bean>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name">
<value> subscriberName</value>
</property>
</bean>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name">
<value> extAttr1</value>
</property>
</bean>
</list>
</property>
</bean>

In the ServiceCharge class, use the EntityProperty bean class to indicate that serviceAgreementId is an object reference to serviceAgreement. Through the reference of serviceAgreementId, the searchable attributes on ServiceAgreement are available for search on ServiceCharge class.

<bean id="serviceChargeSearchMeta"
class="com.edocs.common.omf.search.SearchMetaDataSupport"
singleton="true">

<property name="beanClassName">
<value>com.edocs.common.omf.servicecharge.ServiceCharge</value>
</property>

<property name="propertyList">
<list>
<bean class="com.edocs.common.omf.search.EntityProperty">
<property name="name"><value>serviceAgreementId</value> </property>
<property name="searchMetaData"><ref local="serviceAgreementSearchMeta"/></property>
</bean>
<bean class="com.edocs.common.omf.search.EntityProperty">
<property name="name"><value>chargeTypeId</value></property>
<property name="searchMetaData"><ref local="chargeTypeSearchMeta"/></property>
</bean>
</list>
</property>
</bean>

In the BillingAccount class, MapProperty indicates that attr1 and attr2 are extended attributes that can be used in search criteria.

<bean id="accountSearchMeta"
class="com.edocs.common.omf.search.SearchMetaDataSupport" singleton="true">

<property name="beanClassName"> <value>com.edocs.domain.telco.amf.defaultimpl.BillingAccount</value>
</property>
<property name="propertyList">
<list>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name"><value>Name</value></property>
</bean>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name"><value>Description</value></property>
</bean>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name"><value>companyName</value></property>
</bean>
<bean class="com.edocs.common.omf.search.SimpleProperty">
<property name="name"><value>contactName</value></property>
</bean>
<bean class="com.edocs.common.omf.search.MapProperty">
<property name="name"><value>attributes</value></property>
<property name="key"><value>attr1</value></property>
</bean>
<bean class="com.edocs.common.omf.search.MapProperty">
<property name="name"><value>attributes</value></property>
<property name="key"><value>attr2</value></property>
</bean>
</list>
</property>
</bean>

Implementing Search Interfaces

Implement IOMFObjectSearchable to tell which attributes are available for search. The search component reads the preceding configuration file to get a list of attributes that can be used as searchable attributes.

public interface IOMFObjectSearchable
{

/**
* Finds IOMFObjects that match the provided attribute value.
* A "%" character is interpreted as the like wildcard.
* So for instance, "foo%" will match all strings that
* start with "foo". If there is no "%" character present
* in the value then an equals match is performed.
*
* @param criteria - the search criteria
* @return list of IOMFObject objects
*/
public List findLike(String attributeName, String value);


/**
* Finds IOMFObjects that satisfy the specified search criteria.
*
* @param criteria - the search criteria
* @return list of IOMFObject objects
*/
public List find(ISearchCriteria criteria);

/**
* Returns a new ISearchCriteria object.
*
* @return ISearchCriteria object.
*/
public ISearchCriteria getSearchCriteria();

/**
* Gets a list of IPropertyInfo - one for each searchable property.
*The IPropertyInfo
* object specifies the name and display name of a searchable property.
*
* @return List of IPropertyInfo objects.
*/
public List getPropertyInfo();
}

Constructing Search Criteria

Use ISearchCritieria and IPredicate to build search criteria. ISearchCritieria.toQueryString() converts the search criteria to a Hibernate SQL string, calls the hibernate API to do the final query, and returns the result set, for example:

IServiceAgreementManager saManager =

IOFMService.getOMFManagerByName(ServiceAgreementManager.getClassName());

ISearchCriteria criteria = saManager.getSearchCriteria();
criteria.add(criteria.equals("subscriberName", "John Willson" )).add( criteria.isNull( "extAttr1"));
IHierarchyNode foundNodes = rootNode.findNodeByLinkTargetTypeAndCriteria(saManager.getType(),criteria);

Hierarchy Developer's Guide for Oracle Billing Insight Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Legal Notices.