package org.motechproject.eventlogging.service;

import org.motechproject.eventlogging.domain.EventLog;
import org.motechproject.mds.annotations.Lookup;
import org.motechproject.mds.service.MotechDataService;

import java.util.List;

/**
 * Motech Data Service interface for {@link EventLog}s. The implementation is generated
 * and injected by the MDS module.
 */
public interface EventLogService extends MotechDataService<EventLog> {

    /**
     * Finds all recorded events with the given subject
     * @param name A subject to filter by
     * @return A collection of all recorded events with the given subject.
     */
    @Lookup
    List<EventLog> findBySubject(String name);

}

package org.motechproject.eventlogging.service;

import org.motechproject.eventlogging.domain.EventLog;
import org.motechproject.mds.annotations.Lookup;
import org.motechproject.mds.annotations.LookupField;
import org.motechproject.mds.service.MotechDataService;

import java.util.List;

/**
 * Motech Data Service interface for {@link EventLog}s. The implementation is generated
 * and injected by the MDS module.
 */
public interface EventLogService extends MotechDataService<EventLog> {

    /**
     * Finds all recorded events with the given subject
     * @param name A subject to filter by
     * @return A collection of all recorded events with the given subject.
     */
    @Lookup
    List<EventLog> findBySubject(@LookupField(name = "subject") String name);

}

Support for collection fields in lookups
MOTECH-1040: Support for collection fields in lookups

This commit adds support for collection fields in lookups. For now there
will be possible to create a lookup that will find instances for which
passed value will be inside collection field.

For example assume that there is a User class with roles field that have
java.util.List type. Before these changes a developer could not create a
lookup that will find a users that have the given role. Currently, there
is a possibility.

Change-Id: Ibf7c18c142f7794a304732eb9c52aaef8abd5e6f
