Skip to main content
summaryrefslogtreecommitdiffstats
blob: 895c17ba8350e0e7f75837e957ee71b46cfc32d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/********************************************************************************
 * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 ********************************************************************************/


package org.eclipse.mdm.api.base;

import java.util.Collection;
import java.util.Map;

import org.eclipse.mdm.api.base.adapter.ChildrenStore;
import org.eclipse.mdm.api.base.adapter.Core;
import org.eclipse.mdm.api.base.adapter.EntityStore;
import org.eclipse.mdm.api.base.adapter.RelationStore;
import org.eclipse.mdm.api.base.model.Value;

/**
 * 
 * Very basic implementation of the Core class. The contents is initialized via
 * a given map (instead of using a database or some other method)
 * 
 * @author Florian Schmitt
 */
public class CoreImpl implements Core {

	private Map<String, Value> values;
	private EntityStore mutableStore;

	public CoreImpl(Map<String, Value> values) {
		super();
		this.values = values;
		this.mutableStore = new EntityStore();
	}

	@Override
	public String getSourceName() {
		return "UnitTestSource";
	}

	@Override
	public String getTypeName() {
		return "UnitTestType";
	}

	@Override
	public String getID() {
		return "4711l";
	}

	@Override
	public void setID(String instanceID) {

	}

	@Override
	public Map<String, Value> getValues() {
		return values;
	}

	@Override
	public void hideValues(Collection<String> names) {

	}

	@Override
	public Map<String, Value> getAllValues() {
		return values;
	}

	@Override
	public EntityStore getMutableStore() {
		return mutableStore;
	}

	@Override
	public EntityStore getPermanentStore() {
		return new EntityStore();
	}

	@Override
	public ChildrenStore getChildrenStore() {
		return new ChildrenStore();
	}

	@Override
	public RelationStore getNtoMStore() {
		return new RelationStore();
	}

}

Back to the top