BrightSide Workbench Full Report + Source Code
org.turro.parser.FinancialsParser Class Reference
Inheritance diagram for org.turro.parser.FinancialsParser:
Collaboration diagram for org.turro.parser.FinancialsParser:

Public Member Functions

String getParserName ()
 
String getPublished (boolean grouped, IConstructor constructor, int count, String summaryTemplate, String fullTemplate, String context, boolean promoted)
 
- Public Member Functions inherited from org.turro.parser.AbstractParser
 AbstractParser ()
 
ParserMacroSet getParserMacros ()
 
boolean execute (IConstructor constructor, PrintWriter out, String[] tokens)
 

Protected Member Functions

boolean doExecute ()
 
void explainMacros (ParserMacroSet macros)
 
- Protected Member Functions inherited from org.turro.parser.AbstractParser
String getMacroName ()
 
String getToken (String name)
 
String getToken (String name, boolean defParameter)
 
String getToken (String name, String def)
 
String getToken (int index)
 
String getToken (int index, boolean defParameter)
 
String getToken (int index, String def)
 
int getTokenSize ()
 
String getDefaultFor (int index)
 
void prepareProperties (ElephantMarker marker, String properties)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.parser.AbstractParser
IConstructor constructor
 
String[] tokens
 
PrintWriter out
 
String parserName
 
ParserMacroSet parserMacros = new ParserMacroSet()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 47 of file FinancialsParser.java.

Member Function Documentation

◆ doExecute()

boolean org.turro.parser.FinancialsParser.doExecute ( )
protected

Reimplemented from org.turro.parser.AbstractParser.

Definition at line 55 of file FinancialsParser.java.

55  {
56  boolean done = false;
57  if("contracts".equals(getMacroName()) || "contract-list".equals(getMacroName())) {
58  //{@contracts:context:count:intervention}
59  boolean grouped = "contracts".equals(getMacroName());
60  ContractContentIterator ci = new ContractContentIterator(constructor, out,
61  Authentication.getIContact(), false,
62  ElephantContext.getRootWebPath() + getToken(1, "/user/contracts"));
63  ci.setNavigatorTop(grouped);
64  ci.setNavigatorBottom(grouped);
65  ci.setPage((Integer) ObjectString.parseNativeString(getToken(2), Integer.class, true));
66  ci.setCheckParticipation("true".equals(getToken(3)));
67  ci.setAllowAttachments(true);
68  ci.load();
69  ci.render();
70  done = true;
71  } else if("contract-type".equals(getMacroName()) || "contract-type-list".equals(getMacroName())) {
72  boolean grouped = "contract-type".equals(tokens[0]);
73  //{@contract-type:context:count:intervention:type[:template]}
74  ContractContentIterator ci = new ContractContentIterator(constructor, out,
75  Authentication.getIContact(), false,
76  ElephantContext.getRootWebPath() + getToken(1, "/user/contracts"));
77  ci.setNavigatorTop(grouped);
78  ci.setNavigatorBottom(grouped);
79  ci.setPage((Integer) ObjectString.parseNativeString(getToken(2), Integer.class, true));
80  ci.setType((Integer) ObjectString.parseNativeString(getToken(4), Integer.class, true));
81  ci.setCheckParticipation("true".equals(getToken(3)));
82  ci.setAllowAttachments(true);
83  ci.setSummaryTemplate(getToken(5));
84  ci.load();
85  ci.render();
86  done = true;
87  } else if("checkout".equals(getMacroName())) {
88  Checkout checkout = new Checkout(constructor);
89  checkout.renderCheckout();
90  done = true;
91  } else if("clear-cart".equals(getMacroName())) {
92  ShoppingCart.removeCart(constructor);
93  done = true;
94  } else if("products".equals(getMacroName()) || "product-list".equals(getMacroName()) ||
95  "promoted".equals(getMacroName()) || "promoted-list".equals(getMacroName())) {
96  boolean grouped = "products".equals(getMacroName()) || "promoted".equals(getMacroName());
97  boolean promoted = "promoted".equals(getMacroName()) || "promoted-list".equals(getMacroName());
98  ProductContentIterator pci = new ProductContentIterator(constructor, out,
99  Authentication.getIContact(), false,
100  ElephantContext.getRootWebPath() + getToken(1, "/user/products"));
101  pci.setNavigatorTop(grouped);
102  pci.setNavigatorBottom(grouped);
103  pci.setPage((Integer) ObjectString.parseNativeString(getToken(2), Integer.class, true));
104  pci.setOnlyPromoted(promoted);
105  pci.setAllowInterest(true);
106  pci.setAllowDescriptions(true);
107  pci.setAllowComments(true);
108  pci.setAllowAttachments(true);
109  pci.setAllowFiles(true);
110  pci.setAllowGroups(grouped);
111  pci.setSummaryTemplate(getToken(3));
112  pci.setFullTemplate(getToken(4));
113  pci.setPublishable(true);
114  pci.setFullSearch(true);
115  pci.load();
116  pci.render();
117 // out.write(getPublished(grouped, constructor,
118 // (Integer) ObjectString.parseNativeString(getToken(2), Integer.class, true),
119 // getToken(3),
120 // getToken(4),
121 // getToken(1),
122 // promoted));
123  done = true;
124  } else if("product-name".equals(getMacroName()) || "product-name-list".equals(getMacroName())) {
125  boolean anchor = "product-name".equals(getMacroName());
126  out.write(createLinks(anchor, constructor, getToken(1), getToken(2)));
127  done = true;
128  } else if("product-price".equals(getMacroName())) {
129  out.write(createPrice(constructor, getToken(1), getToken(2)));
130  done = true;
131  } else if("cart".equals(getMacroName())) {
132  ShoppingCart sc = new ShoppingCart(constructor, getToken(1), getToken(2));
133  sc.renderCart();
134  done = true;
135  }
136  return done;
137  }
Here is the call graph for this function:

◆ explainMacros()

void org.turro.parser.FinancialsParser.explainMacros ( ParserMacroSet  macros)
protected

Reimplemented from org.turro.parser.AbstractParser.

Definition at line 140 of file FinancialsParser.java.

140  {
141  macros.addMacro("contracts")
142  .addParameter("context", true, "/user/contracts")
143  .addParameter("count", true, "10")
144  .addParameter("intervention", true, "true");
145  macros.addMacro("contract-list")
146  .copyParametersFrom("contracts", macros);
147  macros.addMacro("contract-type")
148  .addParameter("context", true, "/user/contracts")
149  .addParameter("count", true, "10")
150  .addParameter("intervention", true, "true")
151  .addParameter("type", true, "0")
152  .addParameter("template", true, "summary");
153  macros.addMacro("contract-type-list")
154  .copyParametersFrom("contract-type", macros);
155  macros.addMacro("checkout");
156  macros.addMacro("clean-cart");
157  macros.addMacro("products")
158  .addParameter("context", false)
159  .addParameter("count", true, "10")
160  .addParameter("summaryTemplate", true, "summary")
161  .addParameter("fullTemplate", true, "full");
162  macros.addMacro("product-list")
163  .copyParametersFrom("products", macros);
164  macros.addMacro("promoted")
165  .copyParametersFrom("products", macros);
166  macros.addMacro("promoted-list")
167  .copyParametersFrom("products", macros);
168  macros.addMacro("product-name")
169  .addParameter("context", false)
170  .addParameter("ids", false, null, true);
171  macros.addMacro("product-name-list")
172  .copyParametersFrom("product-name", macros);
173  macros.addMacro("product-price")
174  .addParameter("format", false)
175  .addParameter("ids", false, null, true);
176  macros.addMacro("cart")
177  .addParameter("shopping", false)
178  .addParameter("template", true, "cart");
179  }
Here is the call graph for this function:

◆ getParserName()

String org.turro.parser.FinancialsParser.getParserName ( )

Reimplemented from org.turro.parser.AbstractParser.

Definition at line 50 of file FinancialsParser.java.

50  {
51  return "Financials";
52  }

◆ getPublished()

String org.turro.parser.FinancialsParser.getPublished ( boolean  grouped,
IConstructor  constructor,
int  count,
String  summaryTemplate,
String  fullTemplate,
String  context,
boolean  promoted 
)

Definition at line 181 of file FinancialsParser.java.

182  {
183  try {
185  ProductIterator pi = new ProductIterator(constructor, context, null);
186  pi.setAllowInterest(true);
187  pi.setAllowVotes(false);
188  pi.setAllowComments(true);
189  pi.setShowDescriptions(true);
190  pi.setShowAttachments(true);
191  pi.setAllowGroups(grouped);
192  pi.setNavigatorTop(true);
193  pi.setNavigatorBottom(true);
194  pi.setFullTemplate(fullTemplate);
195  pi.setSummaryTemplate(summaryTemplate);
196  pi.setPage(count);
197  pi.setOnlyPromoted(promoted);
198  pi.setPublishable(true);
199  pi.load();
200  pi.render();
201  constructor.setOut(null);
202  return constructor.getOutputString();
203  } catch (IOException ex) {
204  Logger.getLogger(FinancialsParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
205  }
206  return null;
207  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: