| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.xtext.datamart.common; |
| |
| import java.util.HashMap; |
| import java.util.Map; |
| |
| import org.eclipse.osbp.ui.api.datamart.IDataMart.EType; |
| |
| public class DatamartDtoMapper { |
| |
| private final Map<String, String> dtoToIdAttribute; |
| private final Map<String, EType> dtoToIdDataTypeClassName; |
| private final Map<String, String> dtoToIdAliasName; |
| |
| public DatamartDtoMapper() { |
| dtoToIdAttribute = new HashMap<String, String>(); |
| dtoToIdDataTypeClassName = new HashMap<String, EType>(); |
| dtoToIdAliasName = new HashMap<String, String>(); |
| } |
| |
| public DatamartDtoMapper add(String dtoFqn, String entityIdAttribute, EType entityIdDataTypeClassName, String entityIdAliasName) { |
| dtoToIdAttribute.put(dtoFqn, entityIdAttribute); |
| dtoToIdDataTypeClassName.put(dtoFqn, entityIdDataTypeClassName); |
| dtoToIdAliasName.put(dtoFqn, entityIdAliasName); |
| return this; |
| } |
| |
| public boolean contains(String dtoFqn) { |
| return dtoToIdAttribute.containsKey(dtoFqn); |
| } |
| |
| public String getEntityIdAttribute(String dtoFqn) { |
| return dtoToIdAttribute.get(dtoFqn); |
| } |
| |
| public EType getEntityIdDataTypeClassName(String dtoFqn) { |
| return dtoToIdDataTypeClassName.get(dtoFqn); |
| } |
| |
| public String getEntityIdAliasName(String dtoFqn) { |
| return dtoToIdAliasName.get(dtoFqn); |
| } |
| } |