# Module: dataStringParsing

Contains all system defined business rules for parsing strings as related to data.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 1

### Requires

- module:ruleParsing
- module:loggers
- @haystacks/constants
- path

### Methods

#### (inner) getAttributeName(inputData, inputMetaData) → {string}

Takes a string representation of a JSON attribute and gets the name (left hand assignment key).

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | Teh string representation of the JSON attribute that should be parsed.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 26

##### Returns:

The name of the attribute.

Type
  string

#### (inner) getAttributeValue(inputData, inputMetaData) → {string}

Takes a string representation of a JSON attribute and gets the value (Right hand assignment value).

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string representation of the JSON attribute that should be parsed.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 55

##### Returns:

The value of the attribute.

Type
  string

#### (inner) getDataCategoryDetailNameFromDataContextName(inputData, inputMetaData) → {string}

Gets the data category detail name from the context name, E.G. Input: Page_ProjectList, data category is 'ProjectList'.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The data context name, which should also contain the data category and data category detail name separated by an underscore.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 136

##### Returns:

The data category detail name, such as ProjectDetails or ProjectList.

Type
  string

#### (inner) getDataCategoryFromDataContextName(inputData, inputMetaData) → {string}

Gets the data category from the context name, E.g. Input: Page_ProjectList, data category is 'Page'.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The data context name, which should also contain the data category separated by underscore.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 110

##### Returns:

The data category, such as Page or Test.

Type
  string

#### (inner) getKeywordNameFromDataContextName(inputData, inputMetaData) → {string}

Gets the keyword name from the context name, E.g. Input: Keywords_ProjectDetails_DeleteEntireProject, keyword is: 'DeleteEntireProject'.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The data context name, which should also contain the data category and data category detail name and keyword name separated by an underscore.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 163

##### Returns:

The keyword name, such as DeleteEntireProject or EditProjectInfoClick.

Type
  string

#### (inner) getUserNameFromEmail(inputData, inputMetaData) → {string}

Converts an email input into a username.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | A string that contains an email address value.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 276

##### Returns:

A string value of the sub-string from before the '@' symbol.

Type
  string

#### (inner) getValueFromAssignmentOperationString(inputData, inputMetaData) → {string}

Parses the input string and finds the value on the right side of the '=' sign.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The string that should be parsed for the value on the right side of the assignment operator.
`inputMetaData` | string | Not used for this business rule.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 84

##### Returns:

The string value of whatever is on the right side of the assignment operator.

Type
  string

#### (inner) loadDataFile(inputData, inputMetaData) → {boolean}

Loads data from a specified file and stores it in the specified data hive path.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The full path and file name for the file that should be loaded into memory.
`inputMetaData` | string | The data hive path where the data should be stored once it is loaded.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 190

##### Returns:

The data that was loaded, because sometimes a client command might need to use this to load data.

Type
  boolean

#### (inner) saveDataFile(inputData, inputMetaData) → {boolean}

Saves data from a specified data to a specified path and file name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`inputData` | string | The full path and file name were the data should be saved.
`inputMetaData` | object | The data that should be saved out to the specified file.

Author:
  - Seth Hollingsead
Source:
  - businessRules/rules/stringParsing/dataStringParsing.js, line 238

##### Returns:

True or False value to indicate if the file was saved successfully or not.

Type
  boolean