# nhelterbrand/sfdc-import-csv-page architecture

> Architecture diagram of the GitHub repository nhelterbrand/sfdc-import-csv-page, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhelterbrand/sfdc-import-csv-page
- Repository: https://github.com/nhelterbrand/sfdc-import-csv-page

## Overview

##### Main Components

a) User Interface Layer:
- Three Visualforce pages:
- ImportDataFromCSVPage (Step 1)
- ImportDataFromCSVPageStep2 (Step 2)
- ImportDataFromCSVPageTemplateExport (Template download)

b) Controller Layer:
- ImportDataFromCSVCtrl (Main controller class)
- Test class connection (ImportDataFromCSVCtrlTest)

c) Salesforce Platform Components:
- Field Sets
- Permission Sets
- Custom Tab
- SObject Records

**[User Interface Layer]**

- ▼
**[Controller Layer]**

- ▼
**[Salesforce Platform Layer]**

##### Key Elements to Highlight

a) Data Flow Paths:
- CSV File Upload → Page → Controller → SObject Records
- Field Set Selection → Page → Controller → Template Generation
- Manual Record Entry → Page → Controller → SObject Records

b) Security Layer:
- Permission Set (Import_CSV_Page_Permissions)
- User Access Controls

##### Important Interactions

- File Processing Flow:
- CSV Upload → Parsing → Validation → Record Creation
- Template Generation Flow:
- Field Set Selection → Template Generation → CSV Download
- Manual Entry Flow:
- UI Input → Validation → Record Creation

##### Technical Constraints to Note
- 1000 record limit
- View state limitations
- Field Set configuration requirements

##### Specific Elements

a) External Interfaces:
- CSV File Input
- CSV Template Download
- Browser Interface

b) Processing Components:
- Date Format Handler
- Partial Success Logic
- Field Set Parser

##### The different data input methods (CSV upload vs. manual entry)

Remember to:
- Keep the component relationships clear and logical
- Notes about technical limitations
- Both success and error paths
- Where configuration is required

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef platform fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        Browser["Browser Interface"]
        VF1["ImportDataFromCSVPage<br/>(Step 1)"]
        VF2["ImportDataFromCSVPageStep2<br/>(Step 2)"]
        VFT["ImportDataFromCSVPage<br/>TemplateExport"]
    end

    %% Controller Layer
    subgraph Controllers
        MainCtrl["ImportDataFromCSVCtrl"]
        TestCtrl["ImportDataFromCSVCtrlTest"]
        DateHandler["Date Format Handler"]
        Validator["Field Validation"]
    end

    %% Platform Layer
    subgraph Platform
        FieldSets["Field Sets"]
        SObjects["SObject Records"]
        CustomTab["Import From CSV Tab"]
        CustomLabels["Custom Labels"]
    end

    %% Security Layer
    subgraph Security
        PermSet["Import CSV Page<br/>Permissions"]
        UserAccess["User Access Controls"]
    end

    %% Relationships
    Browser --> VF1
    Browser --> VF2
    Browser --> VFT
    VF1 --> MainCtrl
    VF2 --> MainCtrl
    VFT --> MainCtrl
    MainCtrl --> TestCtrl
    MainCtrl --> DateHandler
    MainCtrl --> Validator
    MainCtrl --> FieldSets
    MainCtrl --> SObjects
    FieldSets --> VFT
    PermSet --> UserAccess
    UserAccess --> VF1
    UserAccess --> VF2
    UserAccess --> VFT

    %% Styling Classes
    class VF1,VF2,VFT,Browser ui
    class MainCtrl,TestCtrl,DateHandler,Validator controller
    class FieldSets,SObjects,CustomTab,CustomLabels platform
    class PermSet,UserAccess security

    %% Click Events
    click VF1 "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/pages/ImportDataFromCSVPage.page"
    click VF2 "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/pages/ImportDataFromCSVPageStep2.page"
    click VFT "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/pages/ImportDataFromCSVPageTemplateExport.page"
    click MainCtrl "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/classes/ImportDataFromCSVCtrl.cls"
    click TestCtrl "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/classes/ImportDataFromCSVCtrlTest.cls"
    click PermSet "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/permissionsets/Import_CSV_Page_Permissions.permissionset"
    click CustomTab "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/tabs/Import_From_CSV.tab"
    click CustomLabels "https://github.com/nhelterbrand/sfdc-import-csv-page/blob/master/src/labels/CustomLabels.labels"
```
