Skip to content

Commit 5f64183

Browse files
Pattern section refactoring (AbstractFunction)
- AbstractionFunctionDocGen refactoring. Split template content into section-specific templates. - Add BuletteList and Table generic templates. - Add AbstractFunction focused test model. - Add .keep file to keep src folder - Add .gitignore rule for keep files Change-Id: Ia49fcf6835dccbc049b478a56cbd10f054f3985d
1 parent 5ff9289 commit 5f64183

File tree

128 files changed

+6935
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+6935
-431
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ target/
3131
# PDT-specific
3232
.buildpath
3333

34+
######
35+
## Git
36+
######
37+
38+
!.keep
39+
!.gitkeep
40+
3441
########
3542
## Sonar
3643
########

docgenhtml/plugins/org.polarsys.capella.docgen/META-INF/MANIFEST.MF

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Export-Package: org.polarsys.capella.docgen,
3737
org.polarsys.capella.docgen.index,
3838
org.polarsys.capella.docgen.index.items.builder,
3939
org.polarsys.capella.docgen.search,
40+
org.polarsys.capella.docgen.sections,
41+
org.polarsys.capella.docgen.sections.display,
42+
org.polarsys.capella.docgen.sections.template,
4043
org.polarsys.capella.docgen.sidebar,
4144
org.polarsys.capella.docgen.task,
4245
org.polarsys.capella.docgen.util,

docgenhtml/plugins/org.polarsys.capella.docgen/egf/HTMLDocGenCapella.fcore

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

docgenhtml/plugins/org.polarsys.capella.docgen/generated/org/polarsys/capella/docgen/content/AbstractFunctionDocGen.java

Lines changed: 304 additions & 208 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
//Generated with EGF 1.6.2.202001031546
2+
package org.polarsys.capella.docgen.sections;
3+
4+
import java.util.*;
5+
import org.eclipse.egf.model.pattern.*;
6+
import org.eclipse.egf.pattern.execution.*;
7+
import org.eclipse.egf.pattern.query.*;
8+
import org.polarsys.capella.docgen.util.pattern.helper.FunctionHelper;
9+
10+
public class AbstractFunction_AllocatingComponents {
11+
protected static String nl;
12+
13+
public static synchronized AbstractFunction_AllocatingComponents create(String lineSeparator) {
14+
nl = lineSeparator;
15+
AbstractFunction_AllocatingComponents result = new AbstractFunction_AllocatingComponents();
16+
nl = null;
17+
return result;
18+
}
19+
20+
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
21+
protected final String TEXT_1 = "";
22+
protected final String TEXT_2 = NL;
23+
24+
public AbstractFunction_AllocatingComponents() {
25+
//Here is the constructor
26+
StringBuffer stringBuffer = new StringBuffer();
27+
28+
// add initialisation of the pattern variables (declaration has been already done).
29+
30+
}
31+
32+
public String generate(Object argument) throws Exception {
33+
final StringBuffer stringBuffer = new StringBuffer();
34+
35+
InternalPatternContext ctx = (InternalPatternContext) argument;
36+
Map<String, String> queryCtx = null;
37+
IQuery.ParameterDescription paramDesc = null;
38+
Node.Container currentNode = ctx.getNode();
39+
40+
List<Object> parameterList = null;
41+
//this pattern can only be called by another (i.e. it's not an entry point in execution)
42+
List<Object> projectNameParameterList = null;
43+
//this pattern can only be called by another (i.e. it's not an entry point in execution)
44+
List<Object> outputFolderParameterList = null;
45+
//this pattern can only be called by another (i.e. it's not an entry point in execution)
46+
List<Object> elementNameParameterList = null;
47+
//this pattern can only be called by another (i.e. it's not an entry point in execution)
48+
List<Object> elementTypeParameterList = null;
49+
//this pattern can only be called by another (i.e. it's not an entry point in execution)
50+
51+
for (Object parameterParameter : parameterList) {
52+
for (Object projectNameParameterParameter : projectNameParameterList) {
53+
for (Object outputFolderParameterParameter : outputFolderParameterList) {
54+
for (Object elementNameParameterParameter : elementNameParameterList) {
55+
for (Object elementTypeParameterParameter : elementTypeParameterList) {
56+
57+
this.parameter = (org.polarsys.capella.core.data.fa.AbstractFunction) parameterParameter;
58+
this.projectNameParameter = (java.lang.String) projectNameParameterParameter;
59+
this.outputFolderParameter = (java.lang.String) outputFolderParameterParameter;
60+
this.elementNameParameter = (java.lang.String) elementNameParameterParameter;
61+
this.elementTypeParameter = (java.lang.String) elementTypeParameterParameter;
62+
63+
if (preCondition(ctx)) {
64+
ctx.setNode(new Node.Container(currentNode, getClass()));
65+
orchestration(ctx);
66+
}
67+
68+
}
69+
}
70+
}
71+
}
72+
}
73+
ctx.setNode(currentNode);
74+
if (ctx.useReporter()) {
75+
ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx);
76+
}
77+
78+
stringBuffer.append(TEXT_2);
79+
stringBuffer.append(TEXT_2);
80+
return stringBuffer.toString();
81+
}
82+
83+
public String orchestration(PatternContext ctx) throws Exception {
84+
InternalPatternContext ictx = (InternalPatternContext) ctx;
85+
86+
method_body(new StringBuffer(), ictx);
87+
88+
if (ictx.useReporter()) {
89+
Map<String, Object> parameterValues = new HashMap<String, Object>();
90+
parameterValues.put("parameter", this.parameter);
91+
parameterValues.put("projectNameParameter", this.projectNameParameter);
92+
parameterValues.put("outputFolderParameter", this.outputFolderParameter);
93+
parameterValues.put("elementNameParameter", this.elementNameParameter);
94+
parameterValues.put("elementTypeParameter", this.elementTypeParameter);
95+
String outputWithCallBack = OutputManager.computeLoopOutput(ictx);
96+
String loop = OutputManager.computeLoopOutputWithoutCallback(ictx);
97+
ictx.getReporter().loopFinished(loop, outputWithCallBack, ictx, parameterValues);
98+
}
99+
return null;
100+
}
101+
102+
protected org.polarsys.capella.core.data.fa.AbstractFunction parameter = null;
103+
104+
public void set_parameter(org.polarsys.capella.core.data.fa.AbstractFunction object) {
105+
this.parameter = object;
106+
}
107+
108+
protected java.lang.String projectNameParameter = null;
109+
110+
public void set_projectNameParameter(java.lang.String object) {
111+
this.projectNameParameter = object;
112+
}
113+
114+
protected java.lang.String outputFolderParameter = null;
115+
116+
public void set_outputFolderParameter(java.lang.String object) {
117+
this.outputFolderParameter = object;
118+
}
119+
120+
protected java.lang.String elementNameParameter = null;
121+
122+
public void set_elementNameParameter(java.lang.String object) {
123+
this.elementNameParameter = object;
124+
}
125+
126+
protected java.lang.String elementTypeParameter = null;
127+
128+
public void set_elementTypeParameter(java.lang.String object) {
129+
this.elementTypeParameter = object;
130+
}
131+
132+
public Map<String, Object> getParameters() {
133+
final Map<String, Object> parameters = new HashMap<String, Object>();
134+
parameters.put("parameter", this.parameter);
135+
parameters.put("projectNameParameter", this.projectNameParameter);
136+
parameters.put("outputFolderParameter", this.outputFolderParameter);
137+
parameters.put("elementNameParameter", this.elementNameParameter);
138+
parameters.put("elementTypeParameter", this.elementTypeParameter);
139+
return parameters;
140+
}
141+
142+
protected void method_body(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception {
143+
144+
Collection<String> allocatingComponents = FunctionHelper.getAllocatingComponents(projectNameParameter,
145+
outputFolderParameter, parameter);
146+
if (allocatingComponents.size() > 0) {
147+
String title = "Allocating Component";
148+
Integer level = 2;
149+
150+
stringBuffer.append(TEXT_1);
151+
{
152+
//<%@ egf:patternCall patternId="platform:/plugin/org.polarsys.capella.docgen/egf/HTMLDocGenCapella.fcore#LogicalName=org.polarsys.capella.docgen.sections.display.BuletteListFromStringCollection" args="allocatingComponents:parameterListParameter, projectNameParameter:projectNameParameter, outputFolderParameter:outputFolderParameter, title:sectionTitleParameter, level:sectionLevelParameter"%>
153+
154+
InternalPatternContext ictx = (InternalPatternContext) ctx;
155+
new Node.DataLeaf(ictx.getNode(), getClass(), null, stringBuffer.toString());
156+
stringBuffer.setLength(0);
157+
158+
final Map<String, Object> callParameters = new HashMap<String, Object>();
159+
callParameters.put("parameterListParameter", allocatingComponents);
160+
callParameters.put("projectNameParameter", projectNameParameter);
161+
callParameters.put("outputFolderParameter", outputFolderParameter);
162+
callParameters.put("sectionTitleParameter", title);
163+
callParameters.put("sectionLevelParameter", level);
164+
CallHelper.executeWithParameterInjection(
165+
"platform:/plugin/org.polarsys.capella.docgen/egf/HTMLDocGenCapella.fcore#_WyRCkKawEeuJhsj8yYqhhw",
166+
new ExecutionContext((InternalPatternContext) ctx), callParameters);
167+
stringBuffer.setLength(0);
168+
}
169+
170+
}
171+
172+
InternalPatternContext ictx = (InternalPatternContext) ctx;
173+
new Node.DataLeaf(ictx.getNode(), getClass(), "body", stringBuffer.toString());
174+
}
175+
176+
public boolean preCondition(PatternContext ctx) throws Exception {
177+
return true;
178+
}
179+
}

0 commit comments

Comments
 (0)