Loading bundles/ch.elexis.core.data/src/ch/elexis/data/Mandant.java +13 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package ch.elexis.data; import java.util.Objects; import ch.elexis.core.constants.StringConstants; import ch.elexis.core.model.IPersistentObject; import ch.rgw.tools.JdbcLink; /** Loading Loading @@ -130,4 +131,16 @@ public class Mandant extends Anwender { return Kontakt.TABLENAME; } public IPersistentObject getReferencedObject(String fieldl){ if (fieldl != null) { if ("Responsible".equals(fieldl)) { String responsibleId = (String) getExtInfoStoredObjectByKey("ch.elexis.tarmedprefs.responsible"); if (responsibleId != null && !responsibleId.isEmpty()) { return Mandant.load(responsibleId); } } } return null; } } bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/text/TextContainer.java +55 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipInputStream; import org.apache.commons.lang3.StringUtils; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; Loading Loading @@ -113,6 +114,9 @@ public class TextContainer { + "]?[-a-zA-ZäöüÄÖÜéàè_ ]+(\\.[-a-zA-Z0-9äöüÄÖÜéàè_ ]+)+\\]"; public static final String MATCH_GENDERIZE = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS + "]?[a-zA-Z]+:mwn?:[^\\[]+\\]"; //$NON-NLS-1$ public static final String MATCH_EXISTS = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS //$NON-NLS-1$ + "]?[a-zA-Z\\.]+:exists?:[-a-zA-Z0-9\\.]:?[^\\]]*\\]"; //public static final String MATCH_IDATACCESS = "\\[[-_a-zA-Z0-9]+:[-a-zA-Z0-9]+:[-a-zA-Z0-9\\.]+:[-a-zA-Z0-9\\.]:?.*\\]"; //$NON-NLS-1$ public static final String MATCH_IDATACCESS = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS //$NON-NLS-1$ + "]?[-_a-zA-Z0-9]+:[-a-zA-Z0-9]+:[-a-zA-Z0-9\\.]+:[-a-zA-Z0-9\\.]:?[^\\]]*\\]"; Loading Loading @@ -272,6 +276,11 @@ public class TextContainer { in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); } }); plugin.findOrReplace(MATCH_EXISTS, new ReplaceCallback() { public String replace(final String in){ return exists(ret, in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); } }); plugin.findOrReplace(MATCH_GENDERIZE, new ReplaceCallback() { public String replace(final String in){ return genderize(ret, in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); Loading Loading @@ -453,6 +462,14 @@ public class TextContainer { Fall fall = (Fall) parent; return fall.getReferencedObject(fieldl); } else if (parent instanceof Mandant) { String fieldl = field; if (fieldl.substring(0, 1).equalsIgnoreCase(DONT_SHOW_REPLACEMENT_ERRORS)) { fieldl = fieldl.substring(1); } Mandant mandant = (Mandant) parent; return mandant.getReferencedObject(fieldl); } else { // not yet supported return null; Loading Loading @@ -485,6 +502,44 @@ public class TextContainer { } } /** * Format für Exists: [Feld:exists:text] */ private String exists(Brief brief, String in){ String inl = in; if (inl.substring(0, 1).equalsIgnoreCase(DONT_SHOW_REPLACEMENT_ERRORS)) { inl = inl.substring(1); } String[] q = inl.split(":"); //$NON-NLS-1$ Object o = resolveObject(brief, q[0]); if (o == null) { String[] tokens = q[0].split("\\."); //$NON-NLS-1$ if (tokens.length >= 2) { String firstToken = tokens[0]; // resolve the first field IPersistentObject first = resolveObject(brief, firstToken); if (first != null) { IPersistentObject current = first; for (int i = 1; i < tokens.length; i++) { IPersistentObject next = resolveIndirectObject(current, tokens[i]); if (next == null && current instanceof PersistentObject) { String value = readFromPo((PersistentObject) current, tokens[i], false); if (StringUtils.isNotEmpty(value)) { break; } } current = next; } o = current; } } } if (o != null) { return q[2]; } return ""; } /** * Format für Genderize: [Feld:mw:formulierung Mann/formulierung Frau] oder * [Feld:mwn:mann/frau/neutral] Loading Loading
bundles/ch.elexis.core.data/src/ch/elexis/data/Mandant.java +13 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package ch.elexis.data; import java.util.Objects; import ch.elexis.core.constants.StringConstants; import ch.elexis.core.model.IPersistentObject; import ch.rgw.tools.JdbcLink; /** Loading Loading @@ -130,4 +131,16 @@ public class Mandant extends Anwender { return Kontakt.TABLENAME; } public IPersistentObject getReferencedObject(String fieldl){ if (fieldl != null) { if ("Responsible".equals(fieldl)) { String responsibleId = (String) getExtInfoStoredObjectByKey("ch.elexis.tarmedprefs.responsible"); if (responsibleId != null && !responsibleId.isEmpty()) { return Mandant.load(responsibleId); } } } return null; } }
bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/text/TextContainer.java +55 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipInputStream; import org.apache.commons.lang3.StringUtils; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; Loading Loading @@ -113,6 +114,9 @@ public class TextContainer { + "]?[-a-zA-ZäöüÄÖÜéàè_ ]+(\\.[-a-zA-Z0-9äöüÄÖÜéàè_ ]+)+\\]"; public static final String MATCH_GENDERIZE = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS + "]?[a-zA-Z]+:mwn?:[^\\[]+\\]"; //$NON-NLS-1$ public static final String MATCH_EXISTS = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS //$NON-NLS-1$ + "]?[a-zA-Z\\.]+:exists?:[-a-zA-Z0-9\\.]:?[^\\]]*\\]"; //public static final String MATCH_IDATACCESS = "\\[[-_a-zA-Z0-9]+:[-a-zA-Z0-9]+:[-a-zA-Z0-9\\.]+:[-a-zA-Z0-9\\.]:?.*\\]"; //$NON-NLS-1$ public static final String MATCH_IDATACCESS = "\\[[" + DONT_SHOW_REPLACEMENT_ERRORS //$NON-NLS-1$ + "]?[-_a-zA-Z0-9]+:[-a-zA-Z0-9]+:[-a-zA-Z0-9\\.]+:[-a-zA-Z0-9\\.]:?[^\\]]*\\]"; Loading Loading @@ -272,6 +276,11 @@ public class TextContainer { in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); } }); plugin.findOrReplace(MATCH_EXISTS, new ReplaceCallback() { public String replace(final String in){ return exists(ret, in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); } }); plugin.findOrReplace(MATCH_GENDERIZE, new ReplaceCallback() { public String replace(final String in){ return genderize(ret, in.replaceAll(MATCH_SQUARE_BRACKET, StringTool.leer)); Loading Loading @@ -453,6 +462,14 @@ public class TextContainer { Fall fall = (Fall) parent; return fall.getReferencedObject(fieldl); } else if (parent instanceof Mandant) { String fieldl = field; if (fieldl.substring(0, 1).equalsIgnoreCase(DONT_SHOW_REPLACEMENT_ERRORS)) { fieldl = fieldl.substring(1); } Mandant mandant = (Mandant) parent; return mandant.getReferencedObject(fieldl); } else { // not yet supported return null; Loading Loading @@ -485,6 +502,44 @@ public class TextContainer { } } /** * Format für Exists: [Feld:exists:text] */ private String exists(Brief brief, String in){ String inl = in; if (inl.substring(0, 1).equalsIgnoreCase(DONT_SHOW_REPLACEMENT_ERRORS)) { inl = inl.substring(1); } String[] q = inl.split(":"); //$NON-NLS-1$ Object o = resolveObject(brief, q[0]); if (o == null) { String[] tokens = q[0].split("\\."); //$NON-NLS-1$ if (tokens.length >= 2) { String firstToken = tokens[0]; // resolve the first field IPersistentObject first = resolveObject(brief, firstToken); if (first != null) { IPersistentObject current = first; for (int i = 1; i < tokens.length; i++) { IPersistentObject next = resolveIndirectObject(current, tokens[i]); if (next == null && current instanceof PersistentObject) { String value = readFromPo((PersistentObject) current, tokens[i], false); if (StringUtils.isNotEmpty(value)) { break; } } current = next; } o = current; } } } if (o != null) { return q[2]; } return ""; } /** * Format für Genderize: [Feld:mw:formulierung Mann/formulierung Frau] oder * [Feld:mwn:mann/frau/neutral] Loading