Pixel Core Tutorial – Service Layer
Service layer is a bit more involved, as it hold following functionality
Secure methods by assigning permissions per method
Define default transaction demarcation on service methods
Export methods via DWR
In order to create a service, we will define interface (similar to persistence manager)
package com.pixelnation.gaming.engine.service.iface;
import com.pixelnation.common.service.iface.INlsService;
import com.pixelnation.common.service.iface.IService;
import com.pixelnation.gaming.engine.domain.GameDef;
public interface IGameDefService extends IService<GameDef, Integer>, INlsService
{
}
This interface extends from two other interfaces IService and INlsService.
INlsService is required only for services working with Localizable domain objects. IService on the other hand define many utility methods that simplify implementation of custom services a breeze.
Implementation of GameDefService will take a bit of explanation
@Service
@RemoteProxy
@Transactional
public class GameDefService extends GenericService<GameDef, Integer> implements IGameDefService
{
@Autowired
private IGameDefManager m_manager;
@Autowired
[…] Read more