BrightSide Workbench Full Report + Source Code
org.turro.dossier.issue.parser.CommentParser Class Reference
Collaboration diagram for org.turro.dossier.issue.parser.CommentParser:

Public Member Functions

 CommentParser (String text)
 
String getComment ()
 
List< PairValuegetParticipants ()
 
List< String > getAttachments ()
 
PairValue getDescription ()
 
PairValue getPriority ()
 
PairValue getType ()
 
PairValue getGrouping ()
 
PairValue getDossier ()
 
PairValue getVersion ()
 
PairValue getPublishable ()
 
PairValue getControl ()
 
PairValue getDelivery ()
 
PairValue getStartDate ()
 
PairValue getStatus ()
 
PairValue getResolution ()
 
PairValue getDuplicated ()
 
String getHours ()
 
String getExpenses ()
 
String getPrice ()
 
PairValue getPrevisionHours ()
 
PairValue getPrevisionExpenses ()
 
PairValue getPrevisionPrice ()
 
String getText (StringJoiner block)
 
String getSingleValue (StringJoiner options)
 
PairValue getPairValue (StringJoiner options)
 
PairValue getPairValue (StringJoiner prefix, StringJoiner options, String separator)
 

Detailed Description

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

Definition at line 34 of file CommentParser.java.

Constructor & Destructor Documentation

◆ CommentParser()

org.turro.dossier.issue.parser.CommentParser.CommentParser ( String  text)

Definition at line 42 of file CommentParser.java.

42  {
43  this.text = text;
44  changes = toRegExp(Application.getAllLocales("Changes"));
45  comment = toRegExp(Application.getAllLocales("Comment"));
46  participants = toRegExp(Application.getAllLocales("Participants"));
47  attachments = toRegExp(Application.getAllLocales("Attachments"));
48  relations = toRegExp(Application.getAllLocales("Relations"));
49  endBlock = new StringJoiner("|");
50  endBlock.merge(changes)
51  .merge(comment)
52  .merge(participants)
53  .merge(attachments)
54  .merge(relations);
55  upload = toRegExp(Application.getAllLocales("Upload"));
56  description = toRegExp(Application.getAllLocales("Description"));
57  priority = toRegExp(Application.getAllLocales("Priority"));
58  type = toRegExp(Application.getAllLocales("Type"));
59  grouping = toRegExp(Application.getAllLocales("Grouping"));
60  dossier = toRegExp(Application.getAllLocales("Dossier"));
61  version = toRegExp(Application.getAllLocales("Version"));
62  publishable = toRegExp(Application.getAllLocales("Publishable"));
63  control = toRegExp(Application.getAllLocales("Control"));
64  delivery = toRegExp(Application.getAllLocales("Delivery"));
65  startDate = toRegExp(Application.getAllLocales("Start date"));
66  status = toRegExp(Application.getAllLocales("Status"));
67  resolution = toRegExp(Application.getAllLocales("Resolution"));
68  duplicated = toRegExp(Application.getAllLocales("Duplicated"));
69  hours = toRegExp(Application.getAllLocales("Hours"));
70  expenses = toRegExp(Application.getAllLocales("Expenses"));
71  price = toRegExp(Application.getAllLocales("Price"));
72  prevision = toRegExp(Application.getAllLocales("Prevision"));
73  proppart = getText(changes);
74  attachpart = getText(attachments);
75  }
Here is the call graph for this function:

Member Function Documentation

◆ getAttachments()

List<String> org.turro.dossier.issue.parser.CommentParser.getAttachments ( )

Definition at line 93 of file CommentParser.java.

93  {
94  return Strings.isBlank(attachpart) ? null : Pattern.compile("\\R(" + upload + ")\\s*\\[\\s*(.+)\\](\\R|$)")
95  .matcher(attachpart)
96  .results()
97  .map((m) -> m.group(2))
98  .collect(Collectors.toList());
99  }

◆ getComment()

String org.turro.dossier.issue.parser.CommentParser.getComment ( )

Definition at line 77 of file CommentParser.java.

77  {
78  return getText(comment);
79  }
Here is the call graph for this function:

◆ getControl()

PairValue org.turro.dossier.issue.parser.CommentParser.getControl ( )

Definition at line 129 of file CommentParser.java.

129  {
130  return getPairValue(control);
131  }
PairValue getPairValue(StringJoiner options)
Here is the call graph for this function:

◆ getDelivery()

PairValue org.turro.dossier.issue.parser.CommentParser.getDelivery ( )

Definition at line 133 of file CommentParser.java.

133  {
134  return getPairValue(delivery);
135  }
Here is the call graph for this function:

◆ getDescription()

PairValue org.turro.dossier.issue.parser.CommentParser.getDescription ( )

Definition at line 101 of file CommentParser.java.

101  {
102  return getPairValue(description);
103  }
Here is the call graph for this function:

◆ getDossier()

PairValue org.turro.dossier.issue.parser.CommentParser.getDossier ( )

Definition at line 117 of file CommentParser.java.

117  {
118  return getPairValue(dossier);
119  }
Here is the call graph for this function:

◆ getDuplicated()

PairValue org.turro.dossier.issue.parser.CommentParser.getDuplicated ( )

Definition at line 149 of file CommentParser.java.

149  {
150  return getPairValue(duplicated);
151  }
Here is the call graph for this function:

◆ getExpenses()

String org.turro.dossier.issue.parser.CommentParser.getExpenses ( )

Definition at line 157 of file CommentParser.java.

157  {
158  return getSingleValue(expenses);
159  }
String getSingleValue(StringJoiner options)
Here is the call graph for this function:

◆ getGrouping()

PairValue org.turro.dossier.issue.parser.CommentParser.getGrouping ( )

Definition at line 113 of file CommentParser.java.

113  {
114  return getPairValue(grouping);
115  }
Here is the call graph for this function:

◆ getHours()

String org.turro.dossier.issue.parser.CommentParser.getHours ( )

Definition at line 153 of file CommentParser.java.

153  {
154  return getSingleValue(hours);
155  }
Here is the call graph for this function:

◆ getPairValue() [1/2]

PairValue org.turro.dossier.issue.parser.CommentParser.getPairValue ( StringJoiner  options)

Definition at line 210 of file CommentParser.java.

210  {
211  if(!Strings.isBlank(proppart)) {
212  Pattern pattern = Pattern.compile("\\R(" + options + ")\\s*\\[\\s*(.*)\\s*\\]:\\h*(.*)(\\R|$)");
213  Matcher matcher = pattern.matcher(proppart);
214  if(matcher.find()) {
215  return new PairValue(matcher.group(2), matcher.group(3));
216  }
217  }
218  return null;
219  }
Here is the caller graph for this function:

◆ getPairValue() [2/2]

PairValue org.turro.dossier.issue.parser.CommentParser.getPairValue ( StringJoiner  prefix,
StringJoiner  options,
String  separator 
)

Definition at line 221 of file CommentParser.java.

221  {
222  if(!Strings.isBlank(proppart)) {
223  Pattern pattern = Pattern.compile("\\R((" + prefix + ")" + separator + "(" + options + "))\\s*\\[\\s*(.*)\\s*\\]:\\h*(.*)(\\R|$)");
224  Matcher matcher = pattern.matcher(proppart);
225  if(matcher.find()) {
226  return new PairValue(matcher.group(4), matcher.group(5));
227  }
228  }
229  return null;
230  }

◆ getParticipants()

List<PairValue> org.turro.dossier.issue.parser.CommentParser.getParticipants ( )

Definition at line 81 of file CommentParser.java.

81  {
82  String block = getText(participants);
83  if(!Strings.isBlank(block)) {
84  return Pattern.compile("\\R*(.+)\\s*:\\s*(.+)(\\R|$)")
85  .matcher(block)
86  .results()
87  .map((m) -> new PairValue(m.group(1), m.group(2)))
88  .collect(Collectors.toList());
89  }
90  return Collections.EMPTY_LIST;
91  }
Here is the call graph for this function:

◆ getPrevisionExpenses()

PairValue org.turro.dossier.issue.parser.CommentParser.getPrevisionExpenses ( )

Definition at line 169 of file CommentParser.java.

169  {
170  return getPairValue(prevision, expenses, "/");
171  }
Here is the call graph for this function:

◆ getPrevisionHours()

PairValue org.turro.dossier.issue.parser.CommentParser.getPrevisionHours ( )

Definition at line 165 of file CommentParser.java.

165  {
166  return getPairValue(prevision, hours, "/");
167  }
Here is the call graph for this function:

◆ getPrevisionPrice()

PairValue org.turro.dossier.issue.parser.CommentParser.getPrevisionPrice ( )

Definition at line 173 of file CommentParser.java.

173  {
174  return getPairValue(prevision, price, "/");
175  }
Here is the call graph for this function:

◆ getPrice()

String org.turro.dossier.issue.parser.CommentParser.getPrice ( )

Definition at line 161 of file CommentParser.java.

161  {
162  return getSingleValue(price);
163  }
Here is the call graph for this function:

◆ getPriority()

PairValue org.turro.dossier.issue.parser.CommentParser.getPriority ( )

Definition at line 105 of file CommentParser.java.

105  {
106  return getPairValue(priority);
107  }
Here is the call graph for this function:

◆ getPublishable()

PairValue org.turro.dossier.issue.parser.CommentParser.getPublishable ( )

Definition at line 125 of file CommentParser.java.

125  {
126  return getPairValue(publishable);
127  }
Here is the call graph for this function:

◆ getResolution()

PairValue org.turro.dossier.issue.parser.CommentParser.getResolution ( )

Definition at line 145 of file CommentParser.java.

145  {
146  return getPairValue(resolution);
147  }
Here is the call graph for this function:

◆ getSingleValue()

String org.turro.dossier.issue.parser.CommentParser.getSingleValue ( StringJoiner  options)

Definition at line 199 of file CommentParser.java.

199  {
200  if(!Strings.isBlank(proppart)) {
201  Pattern pattern = Pattern.compile("\\R(" + options + ")\\s*:\\s*(.+)(\\R|$)");
202  Matcher matcher = pattern.matcher(proppart);
203  if(matcher.find()) {
204  return matcher.group(2);
205  }
206  }
207  return null;
208  }
Here is the caller graph for this function:

◆ getStartDate()

PairValue org.turro.dossier.issue.parser.CommentParser.getStartDate ( )

Definition at line 137 of file CommentParser.java.

137  {
138  return getPairValue(startDate);
139  }
Here is the call graph for this function:

◆ getStatus()

PairValue org.turro.dossier.issue.parser.CommentParser.getStatus ( )

Definition at line 141 of file CommentParser.java.

141  {
142  return getPairValue(status);
143  }
Here is the call graph for this function:

◆ getText()

String org.turro.dossier.issue.parser.CommentParser.getText ( StringJoiner  block)

Definition at line 177 of file CommentParser.java.

177  {
178  int idxStart = 0, idxEnd;
179  Pattern pstart = Pattern.compile("(\\R|^)(" + block + ")\\R");
180  Matcher mstart = pstart.matcher(text);
181  if(mstart.find()) {
182  idxStart = mstart.end() - 1;
183  }
184  if(idxStart > 0) {
185  Pattern pend = Pattern.compile("\\R((" + endBlock + ")\\R|$)");
186  Matcher mend = pend.matcher(text);
187  if(mend.find(idxStart + 1)) {
188  idxEnd = mend.start();
189  } else {
190  idxEnd = text.length();
191  }
192  if(idxEnd > idxStart) {
193  return text.substring(idxStart, idxEnd);
194  }
195  }
196  return null;
197  }
Here is the caller graph for this function:

◆ getType()

PairValue org.turro.dossier.issue.parser.CommentParser.getType ( )

Definition at line 109 of file CommentParser.java.

109  {
110  return getPairValue(type);
111  }
Here is the call graph for this function:

◆ getVersion()

PairValue org.turro.dossier.issue.parser.CommentParser.getVersion ( )

Definition at line 121 of file CommentParser.java.

121  {
122  return getPairValue(version);
123  }
Here is the call graph for this function:

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