no.dusken.common.service.GenericService.java Source code

Java tutorial

Introduction

Here is the source code for no.dusken.common.service.GenericService.java

Source

/*
 Copyright 2006 - 2010 Under Dusken
    
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
    
     http://www.apache.org/licenses/LICENSE-2.0
    
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

package no.dusken.common.service;

import no.dusken.common.model.DuskenObject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

/**
 * Service offering generic methods that make sense on all AraneaObjects.
 * getAllEntities is not included since the ordering is important.
 */
@NoRepositoryBean
public interface GenericService<T extends DuskenObject>
        extends JpaRepository<T, Long>, JpaSpecificationExecutor<T> {

    /**
     * Gets the object based on the field external_id
     *
     * @param ID is the id from the system the entity was imported from
     * @return the lazy object if found
     */
    public T getByExternalID(Long ID);

}