-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding better error message and improved charset handling
- Loading branch information
Pieter Van Eeckhout
committed
Apr 23, 2018
1 parent
ac0bd92
commit 1cf2c29
Showing
7 changed files
with
742 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,74 +25,69 @@ | |
|
||
import com.honeyedoak.waypointcoverter.controller.file.FileController; | ||
import com.honeyedoak.waypointcoverter.controller.waypoint.WaypointController; | ||
import com.honeyedoak.waypointcoverter.exceptions.ProcessingException; | ||
import com.honeyedoak.waypointcoverter.exceptions.FatalException; | ||
import com.honeyedoak.waypointcoverter.exceptions.FileException; | ||
import com.honeyedoak.waypointcoverter.exceptions.InvalidModelStateException; | ||
import com.honeyedoak.waypointcoverter.exceptions.ParseException; | ||
import com.honeyedoak.waypointcoverter.exceptions.WaypointAlreadyExistsException; | ||
import com.honeyedoak.waypointcoverter.exceptions.WaypointDoesNotExistException; | ||
import com.honeyedoak.waypointcoverter.exceptions.*; | ||
import org.apache.log4j.Logger; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* DomainFacade.java (UTF-8) | ||
* | ||
* <p> | ||
* <p>Entry point into the domain layer. Delegates and coordinates the tasks to | ||
* the respective controllers</p> | ||
* | ||
* <p> | ||
* 2013/06/21 | ||
* | ||
* @author Pieter Van Eeckhout <[email protected]> | ||
* @since 1.0.2 | ||
* @version 1.0.2 | ||
* @since 1.0.2 | ||
*/ | ||
public class DomainFacade { | ||
|
||
private WaypointController waypointController; | ||
private FileController fileController; | ||
private Logger logger; | ||
private WaypointController waypointController; | ||
private FileController fileController; | ||
private Logger logger; | ||
|
||
public DomainFacade(WaypointController waypointController, FileController fileController) { | ||
logger = Logger.getLogger(DomainFacade.class); | ||
this.waypointController = waypointController; | ||
this.fileController = fileController; | ||
} | ||
public DomainFacade(WaypointController waypointController, FileController fileController) { | ||
logger = Logger.getLogger(DomainFacade.class); | ||
this.waypointController = waypointController; | ||
this.fileController = fileController; | ||
} | ||
|
||
public WaypointController getWaypointController() { | ||
return waypointController; | ||
} | ||
public WaypointController getWaypointController() { | ||
return waypointController; | ||
} | ||
|
||
public void setWaypointController(WaypointController waypointController) { | ||
this.waypointController = waypointController; | ||
} | ||
public void setWaypointController(WaypointController waypointController) { | ||
this.waypointController = waypointController; | ||
} | ||
|
||
public FileController getFileController() { | ||
return fileController; | ||
} | ||
public FileController getFileController() { | ||
return fileController; | ||
} | ||
|
||
public void setFileController(FileController fileController) { | ||
this.fileController = fileController; | ||
} | ||
public void setFileController(FileController fileController) { | ||
this.fileController = fileController; | ||
} | ||
|
||
public void loadFile(String filePath) throws FileException, FatalException, ProcessingException { | ||
try { | ||
waypointController.addWaypoints(fileController.readWaypointsFromFile(filePath)); | ||
public void loadFile(String filePath) throws FileException, FatalException, ProcessingException { | ||
try { | ||
waypointController.addWaypoints(fileController.readWaypointsFromFile(filePath)); | ||
|
||
} catch (WaypointAlreadyExistsException | InvalidModelStateException | ParseException ex) { | ||
throw new ProcessingException(ex.getMessage()); | ||
} | ||
} | ||
} catch (WaypointAlreadyExistsException | InvalidModelStateException | ParseException ex) { | ||
throw new ProcessingException(ex.getMessage()); | ||
} | ||
} | ||
|
||
public void toggleWaypointExport(String waypointName) throws WaypointDoesNotExistException { | ||
waypointController.toggleWaypointExport(waypointName); | ||
} | ||
public void toggleWaypointExport(String waypointName) throws WaypointDoesNotExistException { | ||
waypointController.toggleWaypointExport(waypointName); | ||
} | ||
|
||
public void exportWaypoints(String filePath, boolean overwrite) throws FileException, ProcessingException { | ||
try { | ||
fileController.writeOpelWaypointsToFile(filePath, waypointController.getWaypointRepository().getWaypointsToExport(), overwrite); | ||
} catch (InvalidModelStateException e) { | ||
throw new ProcessingException(e.getMessage()); | ||
} | ||
|
||
} | ||
public void exportWaypoints(String filePath, boolean overwrite) throws IOException, ProcessingException { | ||
try { | ||
fileController.writeOpelWaypointsToFile(filePath, waypointController.getWaypointRepository().getWaypointsToExport(), overwrite); | ||
} catch (InvalidModelStateException e) { | ||
throw new ProcessingException(e.getMessage()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.