package com.eactive.eai.rms.data.entity.onl.layout;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eactive.eai.data.entity.onl.transformer.layout.LayoutItemEntity;
import com.eactive.eai.data.entity.onl.transformer.layout.LayoutItemEntityId;
import com.eactive.eai.data.jpa.AbstractDataService;

@Service
@Transactional
public class LayoutItemService
		extends AbstractDataService<LayoutItemEntity, LayoutItemEntityId, LayoutItemEMSRepository> {

	public LayoutItemEntity findOrNew(String layoutName, String layoutItemName, Integer layoutItemSerNo) {
		LayoutItemEntityId id = new LayoutItemEntityId();
		id.setLoutname(layoutName);
		id.setLoutitemname(layoutItemName);
		id.setLoutitemserno(layoutItemSerNo);

		return findById(id).orElse(new LayoutItemEntity(id));
	}

}
