OpenKeyWord  Build Tag: jenkins-DoxyGen_EN-107, Build ID: 2015-03-08_20-51-06
 All Classes Namespaces Functions Variables Properties Pages
OKW.OKWConst Class Reference

OKW_Const manages the language dependent OKW-Constants. More...

Collaboration diagram for OKW.OKWConst:

Public Member Functions

string Boolean2YesNo (bool fpbTrueOrFalse)
 Converts true/false language dependent to yes/no. More...
 
string ConcatHSEP (List< string > fpLs_ListString2Concat)
 The method connects single strings of a list-string to one string and separates it with the constant ${HSEP}. More...
 
string ConcatSEP (List< string > fpLs_ListString2Concat)
 Method combines single strings of a liststring to one string and separates it with the constant ${SEP}. More...
 
string ConcatVSEP (List< string > fpLs_ListString2Concat)
 Method combines single strings of a liststring to a single string and separates it with the constant ${VSEP}. More...
 
string GetConst4Internalname (string fpsInternalname)
 Method detects the value for Const for the internalname and the actual selected language. More...
 
string GetOKWConst4Internalname (string fpsInternalname)
 Method detects for Internalname and the actual selected language the value for OKWConst. More...
 
List< string > SplitHSEP (string fpsString2Split)
 Method separates a string and converts it to a liststring. The cut is set at the constant ${HSEP}. More...
 
List< string > SplitSEP (string fpsString2Split)
 Method separates a string and converts it to a liststring. The cut is set at the constant ${SEP}. More...
 
List< string > SplitVSEP (string fps_String2Split)
 Method devides a string and converts it to a liststring. The cut is set at the constant ${VSEP}. More...
 
bool YesNo2Boolean (string fpsYesOrNo)
 Converts a Language dependent Yes/No to bool.
More...
 

Properties

static OKWConst Instance OKWConst.xml" [get]
 Gets the only instance of this class.
The instance of this class. More...
 

Private Member Functions

 OKWConst ()
 Private constructor without a parameter like singleton pattern: initializes the class OKWConst. More...
 

Private Attributes

OKWLanguage CL = OKWLanguage.Instance
 The actual language settings (current language) are administrated in the classe OKWLanguage.
http://en.wikipedia.org/wiki/ISO_3166-1. More...
 
LogMessenger MyLM = null
 Reference to OKW.Log.LogMessenger. More...
 
XPathDocument MyXPathDocument
 
XPathNavigator MyXPathNavigator
 
string OKWConst_xml = string.Empty
 Contains the complete path and filename referring to the file OKW_Const.xml. More...
 

Static Private Attributes

static readonly OKWConst instance = new OKWConst()
 

Detailed Description

OKW_Const manages the language dependent OKW-Constants.

Designpattern: Singleton - the Highlander-Principle is valid "There only can be one!".

This means there is only one instance of this class, which is responsible for reading the news. The language dependent values belonging to this class are in the file "OKWConst.xml"

This class itself is an OKW-fundamental-class and returns no logs for its own.

Terms
Here is a list of identifier / name / term created to be used in this class.

  • Const is the language dependent constant to an internal constant(no brackets)
  • OKWConst is the language dependent constant, appearing outward. It has the form for the German implementation: _${Bezeichner}_ and corresponds Const with brackets.
  • Internalname is the non language dependent internal identifier of a Const. Look following table:
Internal NameConst (EN) OKW_Const (EN)
SEP SEP ${SEP}
VSEP VSEP ${VSEP}
HSEP HSEP ${HSEP}
DELETE DELETE ${DELETE}
EMPTY EMPTY ${EMPTY}
IGNORE IGNORE ${IGNORE}
YES YES -
NO NO -
CHECKED CHECKED -
UNCHECKED UNCHECKED -
LEFTBRACE ${ -
RIGHTBRACE } -
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_22_jnic)
Todo:

(Zeile 22) Zukünftige Funktionalität: Nachricht auf einen anderen Tag weiterverlinken.

(Zeile 41) Tabellenüberschrift wird als Verlinkung gelesen und blau auf blau dargestellt - OKWConst/DE

(Zeile 75) Tabellenüberschrift wird als Verlinkung gelesen und blau auf blau dargestellt - OKWConst/EN

Constructor & Destructor Documentation

OKW.OKWConst.OKWConst ( )
private

Private constructor without a parameter like singleton pattern: initializes the class OKWConst.

The initialization is effected as follows:

OKWConst_en.png
Remarks
This class is a singleton, therefore the constructor is private. Use OKWConst.Instance to receive the instance of the class.

Example:

// Split giveneExpected Value
List&gt;string&lt; lvlsExpected = OKWConst.Instance.SplitSEP(fpsExpectedValue);
Exceptions
ASystem.IO.FileNotFoundException is triggered, if the file OKWConst.xml is not found.
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
266  {
267  this.OKWConst_xml = System.IO.Path.Combine(OKW_Ini.Instance.OKW_Enviroment.PathXML, @"OKWConst.xml");
268 
269  MyLM = new LogMessenger(this.GetType().Name);
270 
271  if (!System.IO.File.Exists(this.OKWConst_xml))
272  {
273  string lvsMessage = this.MyLM.GetMessage("OKWConst", "FileNotFoundException", this.OKWConst_xml);
274  throw new FileNotFoundException(lvsMessage);
275  }
276  else
277  {
278  MyXPathDocument = new XPathDocument(this.OKWConst_xml);
279  MyXPathNavigator = this.MyXPathDocument.CreateNavigator();
280  }
281  }
string OKWConst_xml
Contains the complete path and filename referring to the file OKW_Const.xml.
Definition: OKWConst.cs:180
LogMessenger MyLM
Reference to OKW.Log.LogMessenger.
Definition: OKWConst.cs:161

Member Function Documentation

string OKW.OKWConst.Boolean2YesNo ( bool  fpbTrueOrFalse)

Converts true/false language dependent to yes/no.

Parameters
fps_YesOrNotrue or false
Returns
"yes" in case of true
"no" in case of false
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
334  {
335  string lvs_Return = string.Empty;
336  string lvsInternalname = string.Empty;
337 
338  try
339  {
340  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".Boolean2YesNo", "fpbTrueOrFalse", fpbTrueOrFalse.ToString());
341 
342  if (fpbTrueOrFalse)
343  {
344  // If TRUE -> YES
345  lvs_Return = this.GetConst4Internalname("YES");
346  }
347  else
348  {
349  // Else FALSE -> NO
350  lvs_Return = this.GetConst4Internalname("NO");
351  }
352  }
353  finally
354  {
355  Logger.Instance.LogFunctionEndDebug(lvs_Return);
356  }
357 
358  return lvs_Return;
359  }
string OKW.OKWConst.ConcatHSEP ( List< string >  fpLs_ListString2Concat)

The method connects single strings of a list-string to one string and separates it with the constant ${HSEP}.

The method is working language dependent meaning that the separation constant is used in the actual language.

Parameters
fpLs_ListString2ConcatList-String, to be combined to a single string.
Example: {"Value1", "Value2", "Value3", "Value4"}
Returns
Combined Values "Value1${HSEP}Value2${HSEP}Value3${HSEP}Value
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
392  {
393  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".ConcatHSEP", "fpLs_ListString2Concat", fpLs_ListString2Concat.ToString());
394 
395  string lvs_Return = string.Empty;
396 
397  try
398  {
399  lvs_Return = OKWHelper.ListStringConcat(fpLs_ListString2Concat, this.GetOKWConst4Internalname("HSEP"));
400  }
401  finally
402  {
403  Logger.Instance.LogFunctionEndDebug(lvs_Return);
404  }
405 
406  return lvs_Return;
407  }
string OKW.OKWConst.ConcatSEP ( List< string >  fpLs_ListString2Concat)

Method combines single strings of a liststring to one string and separates it with the constant ${SEP}.

The method works language dependent using the separation constant with the actual language.

Parameters
fpLs_ListString2ConcatListstring to be combined to one string. Example: {"Value1", "Value2", "Value3", "Value4"}
Returns
Combined values "Value${SEP}Value2${SEP}Value3${SEP}Value
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
438  {
439  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".ConcatSEP", "fpLs_ListString2Concat", fpLs_ListString2Concat.ToString());
440 
441  string lvs_Return = string.Empty;
442 
443  try
444  {
445  lvs_Return = OKWHelper.ListStringConcat(fpLs_ListString2Concat, this.GetOKWConst4Internalname("SEP"));
446  }
447  finally
448  {
449  Logger.Instance.LogFunctionEndDebug(lvs_Return);
450  }
451 
452  return lvs_Return;
453  }
string OKW.OKWConst.ConcatVSEP ( List< string >  fpLs_ListString2Concat)

Method combines single strings of a liststring to a single string and separates it with the constant ${VSEP}.

The method is working language dependent using the separation constant of the actual language

Parameters
fpLs_ListString2ConcatList-String, to be combined to a single string. Example: {"Value1", "Value2", "Value3", "Value"}
Returns
Combined values "Value1${VSEP}Value2${VSEP}Value3${VSEP}Value4
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
484  {
485  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".ConcatVSEP", "fpLs_ListString2Concat", fpLs_ListString2Concat.ToString());
486 
487  string lvs_Return = string.Empty;
488 
489  try
490  {
491  lvs_Return = OKWHelper.ListStringConcat(fpLs_ListString2Concat, this.GetOKWConst4Internalname("VSEP"));
492  }
493  finally
494  {
495  Logger.Instance.LogFunctionEndDebug(lvs_Return);
496  }
497 
498  return lvs_Return;
499  }
string OKW.OKWConst.GetConst4Internalname ( string  fpsInternalname)

Method detects the value for Const for the internalname and the actual selected language.

GetConst4Internalname is the core method of this class and detects for

  • fpsInternalname and
  • CL.Language corresponds to OKWLanguage.Instance.Language

the language dependent constant.

Exceptions
Ifno value is found for fpsInternalname, then the exception OKWConst4InternalnameNotFoundException is triggered.
Parameters
fpsInternalnameInternal identifier of a constant, which is converted to a language dependent constant. (Internalname -> Const)
Returns
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
549  {
550  Log.Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".ReadConst", "fpsInternalname", fpsInternalname);
551 
552  string lvs_temp = string.Empty;
553 
554  string myXPath = "//okwconst[@internalname='" + fpsInternalname + "']/name/" + CL.Language;
555 
556  Log.Logger.Instance.LogPrintDebug("myXPath: " + myXPath);
557 
558  try
559  {
560  XPathNodeIterator iter = this.MyXPathNavigator.Select(myXPath);
561 
562  if (iter.Count > 0)
563  {
564  while (iter.MoveNext())
565  {
566  lvs_temp = iter.Current.Value;
567  }
568  }
569  else
570  {
571  string lvsMessage = this.MyLM.GetMessage("GetConst4Internalname",
572  "ExceptionConst4Internalname",
573  fpsInternalname,
574  CL.Language,
575  this.OKWConst_xml);
576  throw new OKWConst4InternalnameNotFoundException(lvsMessage);
577  }
578  }
579  finally
580  {
581  if (lvs_temp == string.Empty)
582  {
583  Log.Logger.Instance.LogFunctionEndDebug();
584  }
585  else
586  {
587  Log.Logger.Instance.LogFunctionEndDebug(lvs_temp);
588  }
589  }
590 
591  return lvs_temp;
592  }

Here is the caller graph for this function:

string OKW.OKWConst.GetOKWConst4Internalname ( string  fpsInternalname)

Method detects for Internalname and the actual selected language the value for OKWConst.

GetOKWConst4Internalname selects for

  • fpsInternalname and
  • CL.Language (local reference for OKWLanguage.Instance.Language)

the language dependent constant and places it in brackets.

Internalname OKW_Const (DE)
SEP ${SEP}
VSEP ${VSEP}
HSEP ${HSEP}
DELETE ${DELETE}
EMPTY ${EMPTY}
IGNORE ${IGNORE}

Example: "$IGNORE" == GetOKWConst4Internalname("IGNORE")

Parameters
fpsInternalnameInternalname of constant. Example: "IGNORE"
Returns
Bracketed constant. Example: "${IGNORIEREN}" for "IGNORE"
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
652  {
653  string lvsReturn = string.Empty;
654 
655  Logger.Instance.LogFunctionStartDebug( this.GetType().FullName + ".GetOKWConst4Internalname", "fpsInternalname", fpsInternalname);
656 
657  try
658  {
659  lvsReturn =
660  this.GetConst4Internalname("LEFTBRACE") +
661  this.GetConst4Internalname(fpsInternalname) +
662  this.GetConst4Internalname("RIGHTBRACE");
663  }
664  finally
665  {
666  Logger.Instance.LogFunctionEndDebug(lvsReturn);
667  }
668 
669  return lvsReturn;
670  }
string GetConst4Internalname(string fpsInternalname)
Method detects the value for Const for the internalname and the actual selected language.
Definition: OKWConst.cs:548

Here is the call graph for this function:

List<string> OKW.OKWConst.SplitHSEP ( string  fpsString2Split)

Method separates a string and converts it to a liststring. The cut is set at the constant ${HSEP}.

The method is working language dependent meaning it is used the separation constant of the actual language.

See also
OKWConst::ConcatSEP()
OKWConst::ConcatHSEP()
OKWConst::ConcatVSEP()
OKWConst::SplitSEP()
OKWConst::SplitVSEP()
Parameters
fpsString2SplitOne or more values, which are divided with ${HSEP}.
Example: "Value1${HSEP}Value2${HSEP}Value2"
Returns
Separated values as a list. Example: {"Value1", "Value2", "Value3"}
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
720  {
721  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".SplitHSEP", "fpsString2Split", fpsString2Split);
722  List<string> lvls_2Plit = new List<string>();
723 
724  try
725  {
726  lvls_2Plit = OKWHelper.StrSplit(fpsString2Split, this.GetOKWConst4Internalname("HSEP"));
727  }
728  finally
729  {
730  Logger.Instance.LogFunctionEndDebug(lvls_2Plit.ToString());
731  }
732 
733  return lvls_2Plit;
734  }
List<string> OKW.OKWConst.SplitSEP ( string  fpsString2Split)

Method separates a string and converts it to a liststring. The cut is set at the constant ${SEP}.

The method is working language dependant meaning it is used the separation constant of the actual language.

See also
OKWConst::ConcatSEP()
OKWConst::ConcatHSEP()
OKWConst::ConcatVSEP()
OKWConst::SplitHSEP()
OKWConst::SplitVSEP()
Parameters
fpsString2SplitOne or more values, which are separated with ${SEP}.
Example: "Value1${SEP}Value2${SEP}Value2"
Returns
Separated values as a list: {"value1", "value2", "value3"}
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
784  {
785  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".SplitSEP", "fpsString2Split", fpsString2Split);
786 
787  List<string> lvls_2Plit = null;
788 
789  try
790  {
791  lvls_2Plit = OKWHelper.StrSplit(fpsString2Split, this.GetOKWConst4Internalname("SEP"));
792  }
793  finally
794  {
795  Logger.Instance.LogFunctionEndDebug(lvls_2Plit.ToString());
796  }
797 
798  return lvls_2Plit;
799  }
List<string> OKW.OKWConst.SplitVSEP ( string  fps_String2Split)

Method devides a string and converts it to a liststring. The cut is set at the constant ${VSEP}.

The method is working language dependent meaning it is used the separation constant of the actual language.

See also
OKWConst::ConcatSEP()
OKWConst::ConcatHSEP()
OKWConst::ConcatVSEP()
OKWConst::SplitHSEP()
OKWConst::SplitSEP()
Parameters
fpsString2SplitOne or more values, which are separated with ${VSEP}.
Example: "value1${VSEP}value2${VSEP}value2"
Returns
Separated values as a list. Example: {"value1", "value2", "value3"}
Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
848  {
849  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".SplitHSEP", "fps_String2Split", fps_String2Split);
850  List<string> lvls_2Plit = new List<string>();
851 
852  try
853  {
854  lvls_2Plit = OKWHelper.StrSplit(fps_String2Split, this.GetOKWConst4Internalname("VSEP"));
855  }
856  finally
857  {
858  Logger.Instance.LogFunctionEndDebug(lvls_2Plit.ToString());
859  }
860 
861  return lvls_2Plit;
862  }
bool OKW.OKWConst.YesNo2Boolean ( string  fpsYesOrNo)

Converts a Language dependent Yes/No to bool.

e.g. Language is "en": Input "Yes" returns true
e.g. Language is "en": Input "No" returns false
e.g. Language is "de": Input "Yes" or "No" - raises the exception OKWNotAllowedValueException.

Parameters
fpsYesOrNoLanguage dependent Yes/No
Returns
true if Language dependent value is "yes"
false if language dependent "No"
Author
Zoltan Hrabovszki
Date
2013_12_09
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)
898  {
899  Logger.Instance.LogFunctionStartDebug(this.GetType().FullName + ".YesNo2Boolean", "fpsYesOrNo", fpsYesOrNo);
900  bool lvb_Return = false;
901 
902  string lvs_Yes = string.Empty;
903  string lvs_No = string.Empty;
904 
905  try
906  {
907  lvs_Yes = this.GetConst4Internalname("YES");
908  lvs_No = this.GetConst4Internalname("NO");
909 
910  if (lvs_Yes.ToUpper() == fpsYesOrNo.ToUpper())
911  {
912  lvb_Return = true;
913  }
914  else if (lvs_No.ToUpper() == fpsYesOrNo.ToUpper())
915  {
916  lvb_Return = false;
917  }
918  else
919  {
920  Logger.Instance.LogFunctionEndDebug();
921 
922  string lvsMessage = this.MyLM.GetMessage("YesNo2Boolean", "ValueNotAllowed", fpsYesOrNo, lvs_Yes + "'/'" + lvs_No);
923  throw new OKWNotAllowedValueException(lvsMessage);
924  }
925  }
926  finally
927  {
928  Logger.Instance.LogFunctionEndDebug(lvb_Return);
929  }
930 
931  return lvb_Return;
932  }

Member Data Documentation

OKWLanguage OKW.OKWConst.CL = OKWLanguage.Instance
private

The actual language settings (current language) are administrated in the classe OKWLanguage.
http://en.wikipedia.org/wiki/ISO_3166-1.

Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_22_jnic)
LogMessenger OKW.OKWConst.MyLM = null
private

Reference to OKW.Log.LogMessenger.

Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_22_jnic)
string OKW.OKWConst.OKWConst_xml = string.Empty
private

Contains the complete path and filename referring to the file OKW_Const.xml.

Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_22_jnic)

Property Documentation

OKWConst OKW.OKWConst.Instance OKWConst.xml"
staticget

Gets the only instance of this class.
The instance of this class.

Author
Zoltan Hrabovszki
Date
2013_12_22
Reviews:(2014_12_18_jnic, 2014_12_22_zh, 2014_12_26_jnic)

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