Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* This file is part of Port@l
* Port@l 3.0 - Portal Engine and Management System
* Copyright (C) 2010 Isotrol, SA. http://www.isotrol.com
*
* Port@l is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Port@l is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Port@l. If not, see .
*/
package com.isotrol.impe3.mappings.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.isotrol.impe3.mappings.MappingDTO;
import com.isotrol.impe3.mappings.MappingsDTO;
import com.isotrol.impe3.mappings.MappingsService;
/**
* MappingsService jdbc implementation
* @author Emilio Escobar Reyero
*/
public class MappingsServiceImpl extends NamedParameterJdbcDaoSupport implements MappingsService {
private Map mappings;
private String sqlSelectVersion = "SELECT S.ID, S.VERSION "
+ "FROM SOURCE_MAPPING S INNER JOIN ENVIRONMENT E ON S.ENVT_ID = E.ID WHERE E.NAME = :env AND S.NAME = :name";
private String sqlSelectContents = "SELECT COTP_ID, MAPPING FROM CONTENT_TYPE_MAPPING WHERE SRCM_ID = :id";
private String sqlSelectCategories = "SELECT CTGY_ID, MAPPING FROM CATEGORY_MAPPING WHERE SRCM_ID = :id";
private String sqlSelectSets = "SELECT SRCM_SET, MAPPING FROM SET_MAPPING WHERE SRCM_ID = :id";
private static final String ID = "id";
/**
* Instance hash map
*/
@Override
protected void initDao() throws Exception {
super.initDao();
this.mappings = Maps.newHashMap();
}
private static final ParameterizedRowMapper MAPPING_UUID = new ParameterizedRowMapper() {
public MappingDTO mapRow(ResultSet rs, int rowNum) throws SQLException {
final MappingDTO dto = new MappingDTO();
final String id = rs.getString(1);
final String mapping = rs.getString(2);
dto.setId(UUID.fromString(id).toString());
dto.setMapping(mapping);
return dto;
}
};
private static final ParameterizedRowMapper MAPPING_STRING = new ParameterizedRowMapper() {
public MappingDTO mapRow(ResultSet rs, int rowNum) throws SQLException {
final MappingDTO dto = new MappingDTO();
final String id = rs.getString(1);
final String mapping = rs.getString(2);
dto.setId(id);
dto.setMapping(mapping);
return dto;
}
};
private static final ParameterizedRowMapper