Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c262f6a6e23b3be8a7ee4cf73758762522ef99c0 (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
101
102
103
104
105
106
107
108
/*******************************************************************************
 * Copyright (c) 2010 Oracle Corporation and others.
 * 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:
 *    Oracle Corporation - initial API and implementation and/or initial documentation
 *******************************************************************************/

package org.eclipse.jst.jsf.common.metadata.query.internal;

import org.eclipse.jst.jsf.common.metadata.Entity;
import org.eclipse.jst.jsf.common.metadata.Model;
import org.eclipse.jst.jsf.common.metadata.Trait;
import org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor;
import org.eclipse.jst.jsf.common.metadata.query.IResultSet;
import org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor;

/**
 * Interface for accessing 'raw' meta data query capabilities.
 * <p>
 * May be subclassed, but implementers must extend {@link MetaDataQueryHelper}
 *
 */
public interface IMetaDataQueryHelper {

	/**
	 * @param modelId
	 * @return Model object for given context.   May return null if not located.
	 */
	public Model getModel(final String modelId);

	/**
	 * @param modelId
	 * @param entityKey relative to root of the model
	 * @return the first entity match from the root of the model.   May return null.
	 */
	public Entity getEntity(final String modelId,
			final String entityKey);

	/**
	 * @param modelId 
	 * @param entityKey relative to root of model 
	 * @param visitor 
	 * @return an IResultSet of entity objects
	 */
	public IResultSet<Entity> getEntities(
			final String modelId, final String entityKey,
			final IEntityQueryVisitor visitor);

	/**
	 * @param entity
	 * @param traitKey
	 * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl 
	 */
	public Trait getTrait(final Entity entity, final String traitKey);

	/**
	 * @param entity
	 * @param traitKey
	 * @param traitQueryVisitor
	 * @return an IResultSet of trait objects using supplied traitQueryVisitor.  IResultSet should NOT be null.
	 */
	public IResultSet<Trait> getTraits(Entity entity, String traitKey,
			ITraitQueryVisitor traitQueryVisitor);

	/**
	 * @param initialEntityContext
	 * @param entityKey relative to initial passed entity
	 * @return the first entity located by key using SimpleEntityQueryVisitorImpl
	 */
	public Entity getEntity(Entity initialEntityContext, String entityKey);

	/**
	 * @param initialEntityContext
	 * @param entityQuery relative to initial passed entity
	 * @param entityKeyQueryVisitor
	 * @return IResultSet of entities located by key using entityQueryVisitor.  IResultSet should NOT be null.
	 */
	public IResultSet<Entity> getEntities(Entity initialEntityContext,
			String entityQuery, IEntityQueryVisitor entityKeyQueryVisitor);

	/**
	 * @param modelId
	 * @param entityKey
	 * @param traitKey
	 * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl
	 */
	public Trait getTrait(final String modelId,
			final String entityKey, final String traitKey);

	/**
	 * @param <T>
	 * @param results
	 * @return first <T> from result set.  May return null.
	 */
	public <T> T getFirstFromResultSet(final IResultSet<T> results);
//	/**
//	 * @param tagEntity
//	 * @return QName for entity
//	 */
//	public QName getQNameForEntity(final Entity tagEntity);

}

Back to the top