package com.skyline.base.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.skyline.base.model.Notification;
import com.skyline.base.type.NotificationType;
/**
* Notificationçš„Mapper
*
* @author jairus
*
*@version 0.1
*/
public class NotificationMapper implements RowMapper<Notification> {
private static final NotificationMapper MAPPER = new NotificationMapper();
public static NotificationMapper getMapper() {
return MAPPER;
}
public Notification mapRow(ResultSet rs, int rowNum) throws SQLException {
Notification notification = new Notification();
notification.setId(rs.getLong("id"));
notification.setNotifierId(rs.getLong("notifierId"));
notification.setNotifierNickname(rs.getString("notifierNickname"));
notification.setOwnerId(rs.getLong("ownerId"));
notification.setResourceId(rs.getLong("resourceId"));
notification.setResourceTitle(rs.getString("resourceTitle"));
notification.setType(NotificationType.valueOf(rs.getString("type")));
return notification;
}
}