Skip to content

Commit

Permalink
use square brackets for y m d placeholders. close #2573
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Sep 28, 2024
1 parent 78a8316 commit 8a0f98e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
Binary file modified j-lawyer-client/lib/j-lawyer-cloud/j-lawyer-cloud.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" value="y m d (y...Jahr m...Monat d...Tag)"/>
<Property name="toolTipText" type="java.lang.String" value="Platzhalter f&#xfc;r Jahr / Monat / Tag sind in eckigen Klammern anzugeben:&#xa;&#xa;[yy] - zweistellige Jahreszahl&#xa;[yyyy] - vierstellige Jahreszahl&#xa;[mm] - Monat&#xa;[dd] - Tag"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ public void keyReleased(java.awt.event.KeyEvent evt) {

jLabel10.setFont(jLabel10.getFont());
jLabel10.setText("y m d (y...Jahr m...Monat d...Tag)");
jLabel10.setToolTipText("Platzhalter für Jahr / Monat / Tag sind in eckigen Klammern anzugeben:\n\n[yy] - zweistellige Jahreszahl\n[yyyy] - vierstellige Jahreszahl\n[mm] - Monat\n[dd] - Tag");

jLabel11.setFont(jLabel11.getFont());
jLabel11.setText("weitere Zeichen als fixe Bestandteile");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
update document_name_tpls set schema_syntax='[yyyy]-[mm]-[dd]_DATEINAME' where id='default-tpl';
insert into server_settings(settingKey, settingValue) values('jlawyer.server.database.version','2.7.0.15') ON DUPLICATE KEY UPDATE settingValue = '2.7.0.15';
commit;
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,17 @@ public class FileNameGenerator {

public static boolean compilePattern(String pattern) throws InvalidSchemaPatternException {

if (pattern.contains("yyy") && !pattern.contains("yyyy")) {
if (pattern.contains("[yyy]") && !pattern.contains("[yyyy]")) {
throw new InvalidSchemaPatternException("y muss als yy oder yyyy enthalten sein");
}
if (pattern.contains("yyyyy")) {
if (pattern.contains("[yyyyy]")) {
throw new InvalidSchemaPatternException("y muss als yy oder yyyy enthalten sein");
}

if (pattern.contains("mmm")) {
if (pattern.contains("[mmm]")) {
throw new InvalidSchemaPatternException("m muss als m oder mm enthalten sein");
}
if (pattern.contains("ddd")) {
if (pattern.contains("[ddd]")) {
throw new InvalidSchemaPatternException("d muss als d oder dd enthalten sein");
}

Expand Down Expand Up @@ -730,27 +730,27 @@ private static synchronized String next(String pattern, Date date, String fileNa
}

// fixed values
while (pattern.contains("yyyy")) {
pattern = pattern.replace("yyyy", longYear.format(current));
while (pattern.contains("[yyyy]")) {
pattern = pattern.replace("[yyyy]", longYear.format(current));
}
while (pattern.contains("yy")) {
pattern = pattern.replace("yy", shortYear.format(current));
while (pattern.contains("[yy")) {
pattern = pattern.replace("[yy]", shortYear.format(current));
}

while (pattern.contains("mm")) {
pattern = pattern.replace("mm", longMonth.format(current));
while (pattern.contains("[mm]")) {
pattern = pattern.replace("[mm]", longMonth.format(current));
}
while (pattern.contains("m")) {
pattern = pattern.replace("m", shortMonth.format(current));
while (pattern.contains("[m]")) {
pattern = pattern.replace("[m]", shortMonth.format(current));
}

while (pattern.contains("dd")) {
pattern = pattern.replace("dd", longDay.format(current));
while (pattern.contains("[dd]")) {
pattern = pattern.replace("[dd]", longDay.format(current));
}
while (pattern.contains("d")) {
pattern = pattern.replace("d", shortDay.format(current));
while (pattern.contains("[d]")) {
pattern = pattern.replace("[d]", shortDay.format(current));
}

// variable values
pattern = pattern.replace("DATEINAME", fileName);

Expand Down

0 comments on commit 8a0f98e

Please sign in to comment.