Skip to content

Commit

Permalink
bridge pattern completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooks Johnson committed Jan 20, 2023
1 parent ad4aeed commit 7b8c54f
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 1 deletion.
19 changes: 19 additions & 0 deletions force-app/main/default/classes/Bridge/BlogFramework.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Created by bjohnson on 1/20/23.
*/

public with sharing class BlogFramework extends WebFramework {

public BlogFramework(ITheme theme){
super(theme);
}

public override void capability() {
System.debug('This app does not support menu and it is not styled');
}


public override void showMenuBody() {
theme.styleContent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
15 changes: 15 additions & 0 deletions force-app/main/default/classes/Bridge/CMSFramework.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Created by bjohnson on 1/20/23.
*/

public with sharing class CMSFramework extends WebFramework {

public CMSFramework(ITheme theme) {
super(theme);
}

public override void capability() {
System.debug('This is a CMS Framework and supports workflow to ' +
'publish public content');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
11 changes: 11 additions & 0 deletions force-app/main/default/classes/Bridge/ITheme.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Created by bjohnson on 1/19/23.
*/

public interface ITheme {

void styleHeader();
void styleFooter();
void styleMenu();
void styleContent();
}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/Bridge/ITheme.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
27 changes: 27 additions & 0 deletions force-app/main/default/classes/Bridge/Theme_WhiteBlue.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Created by bjohnson on 1/19/23.
*/

public with sharing class Theme_WhiteBlue implements ITheme {


public void styleHeader() {
System.debug('Header font size : 16 px');
System.debug('Background: Blue, Color: black');
}

public void styleFooter() {
System.debug('Footer - font size : 14 px');
System.debug('Background : White, Color: blue');
}

public void styleMenu() {
System.debug('Menu - font size : 12 px');
System.debug('Background : blue, Color: white');
}

public void styleContent() {
System.debug('Content - font size : 16px');
System.debug('Background : white, Color: blue');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
27 changes: 27 additions & 0 deletions force-app/main/default/classes/Bridge/Theme_WhiteGreen.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Created by bjohnson on 1/19/23.
*/

public with sharing class Theme_WhiteGreen implements ITheme {


public void styleHeader() {
System.debug('Header - font size : 16px');
System.debug('Background : Green, Color : Black');
}

public void styleFooter() {
System.debug('Footer - font size : 14px');
System.debug('Background : White, Color : Green');
}

public void styleMenu() {
System.debug('Footer, Font size : 14px');
System.debug('Background : White, Color : Green');
}

public void styleContent() {
System.debug('menu - font size : 14px');
System.debug('Background : White, Color : Green');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
43 changes: 43 additions & 0 deletions force-app/main/default/classes/Bridge/WebFramework.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Created by bjohnson on 1/20/23.
*/

public with sharing abstract class WebFramework {

protected ITheme theme;
private String title;
private String keyword;
private String content;

public WebFramework(ITheme theme){
this.theme = theme;
}

//concrete web framework must implement this
public abstract void capability();

private void setProperties(String title, String keyword, String content){
this.title = title;
this.keyword = keyword;
this.content = content;
}

private void printTitle() {
System.debug('Title: ' + this.title);
}

private void printKeyword() {
system.debug('Keyword: ' + this.keyword);
}

public virtual void showHeader_Footer(){
this.theme.styleHeader();
this.theme.styleFooter();
}

public virtual void showMenuBody(){
this.theme.styleMenu();
this.theme.styleContent();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
1 change: 0 additions & 1 deletion force-app/main/default/classes/Builder/UserBuilder.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

public with sharing class UserBuilder {

public with sharing class Admin implements IUserBuilder {
public User user { get; private set; }

Expand Down
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b8c54f

Please sign in to comment.