Added Interface for EstateAgents and Estates
Added the Command Line Interface for EstateAgents and Estates without functionality. Added Data Structures for Estates, Apartments and Houses.
This commit is contained in:
6
02/.classpath
Normal file
6
02/.classpath
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
0
02/.metadata/.lock
Normal file
0
02/.metadata/.lock
Normal file
10
02/.metadata/.log
Normal file
10
02/.metadata/.log
Normal file
@ -0,0 +1,10 @@
|
||||
!SESSION 2017-04-18 16:25:13.450 -----------------------------------------------
|
||||
eclipse.buildId=4.5.2.M20160212-1500
|
||||
java.version=1.8.0_77
|
||||
java.vendor=Oracle Corporation
|
||||
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
|
||||
Framework arguments: -product org.eclipse.epp.package.java.product -Xms256m -Xmx1024m -Declipse.p2.max.threads=10 -Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest -Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
|
||||
Command-line arguments: -data D:\Dokumente\GitHub\DIS\dis\02 -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -Xms256m -Xmx1024m -Declipse.p2.max.threads=10 -Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest -Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
|
||||
|
||||
!ENTRY org.eclipse.ui 2 2 2017-04-18 16:27:34.543
|
||||
!MESSAGE Invalid property category path: org.eclipse.cdt.managedbuilder.ui.properties.Page_head_build (bundle: org.eclipse.cdt.ui, propertyPage: org.eclipse.cdt.managedbuilder.ui.properties.BuildLogPreferencePage)
|
||||
BIN
02/.metadata/.mylyn/.taskListIndex/segments.gen
Normal file
BIN
02/.metadata/.mylyn/.taskListIndex/segments.gen
Normal file
Binary file not shown.
BIN
02/.metadata/.mylyn/.taskListIndex/segments_1
Normal file
BIN
02/.metadata/.mylyn/.taskListIndex/segments_1
Normal file
Binary file not shown.
BIN
02/.metadata/.mylyn/repositories.xml.zip
Normal file
BIN
02/.metadata/.mylyn/repositories.xml.zip
Normal file
Binary file not shown.
BIN
02/.metadata/.mylyn/tasks.xml.zip
Normal file
BIN
02/.metadata/.mylyn/tasks.xml.zip
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
@ -0,0 +1 @@
|
||||
|
||||
BIN
02/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree
Normal file
BIN
02/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
version=1
|
||||
@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
resetSendMode=KEEP
|
||||
resetSendModeOn=0
|
||||
sendMode=NOTIFY
|
||||
@ -0,0 +1,13 @@
|
||||
content_assist_proposals_background=255,255,255
|
||||
content_assist_proposals_foreground=0,0,0
|
||||
eclipse.preferences.version=1
|
||||
fontPropagated=true
|
||||
org.eclipse.jdt.ui.editor.tab.width=
|
||||
org.eclipse.jdt.ui.formatterprofiles.version=12
|
||||
org.eclipse.jdt.ui.javadoclocations.migrated=true
|
||||
org.eclipse.jface.textfont=1|Courier New|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Courier New;
|
||||
proposalOrderMigrated=true
|
||||
spelling_locale_initialized=true
|
||||
tabWidthPropagated=true
|
||||
useAnnotationsPrefPage=true
|
||||
useQuickDiffPrefPage=true
|
||||
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.m2e.discovery.pref.projects=
|
||||
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
mylyn.attention.migrated=true
|
||||
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true
|
||||
@ -0,0 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
migrated.task.repositories.secure.store=true
|
||||
org.eclipse.mylyn.tasks.ui.filters.nonmatching=true
|
||||
org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true
|
||||
org.eclipse.mylyn.tasks.ui.welcome.message=true
|
||||
@ -0,0 +1,5 @@
|
||||
PROBLEMS_FILTERS_MIGRATE=true
|
||||
eclipse.preferences.version=1
|
||||
platformState=1477429056778
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
||||
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
showIntro=false
|
||||
@ -0,0 +1,3 @@
|
||||
//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false
|
||||
PLUGINS_NOT_ACTIVATED_ON_STARTUP=org.eclipse.m2e.discovery;
|
||||
eclipse.preferences.version=1
|
||||
2290
02/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
Normal file
2290
02/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>version
|
||||
@ -0,0 +1 @@
|
||||
NRM<EFBFBD>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>version
|
||||
@ -0,0 +1 @@
|
||||
NRM<EFBFBD>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,71 @@
|
||||
{
|
||||
"version": "v1",
|
||||
"title": "Eclipse",
|
||||
"timestamp": 1492525522486,
|
||||
"ttl": 10080,
|
||||
"helpUrl": "https://dev.eclipse.org/recommenders/community/aeri/v2/help/",
|
||||
"feedbackUrl": "http://ctrlflow.com/automated-error-reporting",
|
||||
"aboutUrl": "https://wiki.eclipse.org/EPP/Logging",
|
||||
"submitUrl": "https://dev.eclipse.org/recommenders/community/confess/0.6/reports/",
|
||||
"maxReportSize": 262144,
|
||||
"problemsUrl": "https://www.eclipse.org/downloads/download.php?r\u003d1\u0026file\u003d/technology/epp/logging/problems.zip",
|
||||
"problemsTtl": 20160,
|
||||
"connectTimeout": 10,
|
||||
"socketTimeout": 10,
|
||||
"acceptedProducts": [
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*"
|
||||
],
|
||||
"acceptedPlugins": [
|
||||
"org.apache.log4j.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*"
|
||||
],
|
||||
"acceptedPackages": [
|
||||
"ch.qos.*",
|
||||
"com.cforcoding.*",
|
||||
"com.google.*",
|
||||
"com.gradleware.tooling.*",
|
||||
"com.mountainminds.eclemma.*",
|
||||
"com.naef.*",
|
||||
"com.sun.*",
|
||||
"java.*",
|
||||
"javafx.*",
|
||||
"javax.*",
|
||||
"org.apache.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*",
|
||||
"org.gradle.*",
|
||||
"org.jacoco.*",
|
||||
"org.osgi.*",
|
||||
"org.slf4j.*",
|
||||
"sun.*"
|
||||
],
|
||||
"requiredPackages": [
|
||||
"com.cforcoding.*",
|
||||
"com.gradleware.tooling.*",
|
||||
"com.mountainminds.eclemma.*",
|
||||
"com.naef.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*",
|
||||
"org.gradle.*",
|
||||
"org.jacoco.*"
|
||||
],
|
||||
"acceptOtherPackages": false,
|
||||
"acceptUiFreezes": true,
|
||||
"ignoredStatuses": [
|
||||
":java.io.IOException:There is not enough space on the disk",
|
||||
":java.net.*:",
|
||||
"org.eclipse.core.filesystem::Could not delete*",
|
||||
"org.eclipse.core.filesystem::Could not move*",
|
||||
"org.eclipse.core.resources:org.eclipse.core.internal.resources.ResourceException:Resource is out of sync with the file system*",
|
||||
"org.eclipse.core.runtime::Invalid input url*",
|
||||
"org.eclipse.epp.mpc.ui:java.io.IOException:",
|
||||
"org.eclipse.equinox.p2.*::",
|
||||
"org.eclipse.jface:java.io.IOException:Unable to resolve plug-in*",
|
||||
"org.eclipse.oomph.setup.core:$org.apache.http.ConnectionClosedException:",
|
||||
"org.eclipse.pde.core::The current target platform contains errors*",
|
||||
"org.eclipse.ui::Conflicting handlers for*"
|
||||
],
|
||||
"problemsZipLastDownloadTimestamp": 0
|
||||
}
|
||||
Binary file not shown.
BIN
02/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache
Normal file
BIN
02/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache
Normal file
Binary file not shown.
BIN
02/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
Normal file
BIN
02/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<typeInfoHistroy/>
|
||||
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<qualifiedTypeNameHistroy/>
|
||||
10
02/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
Normal file
10
02/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
|
||||
<item value="2" key="layout"/>
|
||||
<item value="true" key="group_libraries"/>
|
||||
<item value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1492525518852">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.mylyn.java.ui.MembersFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.m2e.MavenModuleFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>" key="memento"/>
|
||||
<item value="1" key="rootMode"/>
|
||||
<item value="false" key="linkWithEditor"/>
|
||||
</section>
|
||||
</section>
|
||||
@ -0,0 +1,43 @@
|
||||
<configuration scan="true">
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>OFF</level> <!-- change to DEBUG to mimic '-consolelog' behaviour -->
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${org.eclipse.m2e.log.dir}/0.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<FileNamePattern>${org.eclipse.m2e.log.dir}/%i.log</FileNamePattern>
|
||||
<MinIndex>1</MinIndex>
|
||||
<MaxIndex>10</MaxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<MaxFileSize>100MB</MaxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="EclipseLog" class="org.eclipse.m2e.logback.appender.EclipseLogAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="MavenConsoleLog" class="org.eclipse.m2e.logback.appender.MavenConsoleAppender">
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="EclipseLog" />
|
||||
<appender-ref ref="MavenConsoleLog" />
|
||||
</root>
|
||||
|
||||
<logger name="com.ning.http.client" level="INFO" />
|
||||
</configuration>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<setup:Workspace
|
||||
xmi:version="2.0"
|
||||
xmlns:xmi="http://www.omg.org/XMI"
|
||||
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
|
||||
name="workspace"/>
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.ui.internal.QuickAccess">
|
||||
<item value="-1" key="dialogHeight"/>
|
||||
<item value="-1" key="dialogWidth"/>
|
||||
<list key="textEntries">
|
||||
</list>
|
||||
<list key="orderedElements">
|
||||
</list>
|
||||
<list key="orderedProviders">
|
||||
</list>
|
||||
<list key="textArray">
|
||||
</list>
|
||||
</section>
|
||||
</section>
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workingSetManager>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1492525518853_0" label="Window Working Set" name="Aggregate for window 1492525518852"/>
|
||||
</workingSetManager>
|
||||
3
02/.metadata/version.ini
Normal file
3
02/.metadata/version.ini
Normal file
@ -0,0 +1,3 @@
|
||||
#Tue Apr 18 16:25:14 CEST 2017
|
||||
org.eclipse.core.runtime=2
|
||||
org.eclipse.platform=4.5.2.v20160212-1500
|
||||
17
02/.project
Normal file
17
02/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>02</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1,6 +1,9 @@
|
||||
package de.dis2017;
|
||||
|
||||
import de.dis2017.data.Apartment;
|
||||
import de.dis2017.data.Estate;
|
||||
import de.dis2017.data.EstateAgent;
|
||||
import de.dis2017.data.House;
|
||||
import de.dis2017.data.db.ORM;
|
||||
|
||||
/**
|
||||
@ -23,11 +26,13 @@ public class Main {
|
||||
private static void showMainMenu() {
|
||||
// menu options
|
||||
final int MENU_AGENT = 0;
|
||||
final int QUIT = 1;
|
||||
final int MENU_ESTATES = 1;
|
||||
final int QUIT = 2;
|
||||
|
||||
// create menu
|
||||
Menu mainMenu = new Menu("Main menu");
|
||||
mainMenu.addEntry("EstateAgent management", MENU_AGENT);
|
||||
mainMenu.addEntry("Estate management", MENU_ESTATES);
|
||||
mainMenu.addEntry("Quit", QUIT);
|
||||
|
||||
// process input
|
||||
@ -38,6 +43,9 @@ public class Main {
|
||||
case MENU_AGENT:
|
||||
showEstateAgentMenu();
|
||||
break;
|
||||
case MENU_ESTATES:
|
||||
showEstateMenu();
|
||||
break;
|
||||
case QUIT:
|
||||
return;
|
||||
}
|
||||
@ -45,16 +53,168 @@ public class Main {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the estate management.
|
||||
* TODO Shows the estate management.
|
||||
*/
|
||||
private static void showEstateMenu() {
|
||||
String username = FormUtil.readString("Username");
|
||||
String password = FormUtil.readString("Password");
|
||||
// TODO Check username password combination else back to MainMenu
|
||||
System.out.println("EstateAgent "+username+" logged in succesfully.");
|
||||
|
||||
// menu options
|
||||
final int NEW_ESTATE = 0;
|
||||
final int CHANGE_ESTATE = 1;
|
||||
final int DELETE_ESTATE = 2;
|
||||
final int BACK = 3;
|
||||
|
||||
// estate management menu
|
||||
Menu estateMenu = new Menu("Estate management");
|
||||
estateMenu.addEntry("Create Estate", NEW_ESTATE);
|
||||
estateMenu.addEntry("Change Estate", CHANGE_ESTATE);
|
||||
estateMenu.addEntry("Delete Estate", DELETE_ESTATE);
|
||||
estateMenu.addEntry("Back to the main menu", BACK);
|
||||
|
||||
// process input
|
||||
while(true) {
|
||||
int response = estateMenu.show();
|
||||
|
||||
switch(response) {
|
||||
case NEW_ESTATE:
|
||||
newEstate();
|
||||
break;
|
||||
case CHANGE_ESTATE:
|
||||
changeEstate();
|
||||
break;
|
||||
case DELETE_ESTATE:
|
||||
deleteEstate();
|
||||
break;
|
||||
case BACK:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new estate agent after the usesr has entered the necessary data.
|
||||
*/
|
||||
private static void newEstate() {
|
||||
String input = FormUtil.readString("Apartmnet(A)/House(H)");
|
||||
boolean apartment = input=="A"||input=="a";
|
||||
if(apartment){
|
||||
Apartment estate = new Apartment();
|
||||
|
||||
estate.setCity(FormUtil.readString("Name"));
|
||||
estate.setPostalcode(FormUtil.readInt("Postal Code"));
|
||||
estate.setStreet(FormUtil.readString("Street"));
|
||||
estate.setStreetnumber(FormUtil.readInt("Street Number"));
|
||||
estate.setSquareArea(FormUtil.readInt("Square Area"));
|
||||
|
||||
estate.setFloor(FormUtil.readInt("Floor"));
|
||||
estate.setRent(FormUtil.readInt("Rent"));
|
||||
estate.setRooms(FormUtil.readInt("Rooms"));
|
||||
input = FormUtil.readString("Balcony(Y/N)");
|
||||
estate.setBalcony(input=="Y"||input=="y");
|
||||
input = FormUtil.readString("Built-in Kitchen(Y/N)");
|
||||
estate.setBuiltinKitchen(input=="Y"||input=="y");
|
||||
|
||||
//_orm.persist(estate);
|
||||
|
||||
System.out.println("Estate with the ID " + estate.getId() + " was created.");
|
||||
}
|
||||
else{
|
||||
House estate = new House();
|
||||
|
||||
estate.setCity(FormUtil.readString("Name"));
|
||||
estate.setPostalcode(FormUtil.readInt("Postal Code"));
|
||||
estate.setStreet(FormUtil.readString("Street"));
|
||||
estate.setStreetnumber(FormUtil.readInt("Street Number"));
|
||||
estate.setSquareArea(FormUtil.readInt("Square Area"));
|
||||
|
||||
estate.setFloors(FormUtil.readInt("Floors"));
|
||||
estate.setPrice(FormUtil.readInt("Price"));
|
||||
input = FormUtil.readString("Garden(Y/N)");
|
||||
estate.setGarden(input=="Y"||input=="y");
|
||||
|
||||
//_orm.persist(estate);
|
||||
|
||||
System.out.println("Estate with the ID " + estate.getId() + " was created.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Change an estate agent after the usesr has entered the necessary data.
|
||||
*/
|
||||
private static void changeEstate() {
|
||||
//Choose Estate from List
|
||||
Estate estate = new Apartment();//choosen Estate
|
||||
|
||||
estate.setCity(FormUtil.readString("Name"));
|
||||
estate.setPostalcode(FormUtil.readInt("Postal Code"));
|
||||
estate.setStreet(FormUtil.readString("Street"));
|
||||
estate.setStreetnumber(FormUtil.readInt("Street Number"));
|
||||
estate.setSquareArea(FormUtil.readInt("Square Area"));
|
||||
|
||||
if(estate instanceof Apartment){
|
||||
Apartment apartment = (Apartment) estate;
|
||||
|
||||
|
||||
apartment.setFloor(FormUtil.readInt("Floor"));
|
||||
apartment.setRent(FormUtil.readInt("Rent"));
|
||||
apartment.setRooms(FormUtil.readInt("Rooms"));
|
||||
String input = FormUtil.readString("Balcony(Y/N)");
|
||||
apartment.setBalcony(input=="Y"||input=="y");
|
||||
input = FormUtil.readString("Built-in Kitchen(Y/N)");
|
||||
apartment.setBuiltinKitchen(input=="Y"||input=="y");
|
||||
|
||||
//_orm.persist(apartment);
|
||||
|
||||
System.out.println("Estate with the ID " + estate.getId() + " was updated.");
|
||||
}
|
||||
else{
|
||||
House house = (House)estate;
|
||||
|
||||
estate.setCity(FormUtil.readString("Name"));
|
||||
estate.setPostalcode(FormUtil.readInt("Postal Code"));
|
||||
estate.setStreet(FormUtil.readString("Street"));
|
||||
estate.setStreetnumber(FormUtil.readInt("Street Number"));
|
||||
estate.setSquareArea(FormUtil.readInt("Square Area"));
|
||||
|
||||
house.setFloors(FormUtil.readInt("Floors"));
|
||||
house.setPrice(FormUtil.readInt("Price"));
|
||||
String input = FormUtil.readString("Garden(Y/N)");
|
||||
house.setGarden(input=="Y"||input=="y");
|
||||
|
||||
//_orm.persist(house);
|
||||
|
||||
System.out.println("Estate with the ID " + estate.getId() + " was updated.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Deletes an estate.
|
||||
*/
|
||||
private static void deleteEstate() {
|
||||
//Choose estate from list.
|
||||
Estate estate = new Apartment();//choosen estate.
|
||||
//Delete Agent
|
||||
System.out.println("Estate with the ID " + estate.getId() + " was deleted.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the estate agent management.
|
||||
*/
|
||||
private static void showEstateAgentMenu() {
|
||||
// menu options
|
||||
final int NEW_AGENT = 0;
|
||||
final int BACK = 1;
|
||||
final int CHANGE_AGENT = 1;
|
||||
final int DELETE_AGENT = 2;
|
||||
final int BACK = 3;
|
||||
|
||||
// estate management menu
|
||||
Menu estateAgentMenu = new Menu("EstateAgent management");
|
||||
estateAgentMenu.addEntry("Create EstateAgent", NEW_AGENT);
|
||||
estateAgentMenu.addEntry("Change EstateAgent", CHANGE_AGENT);
|
||||
estateAgentMenu.addEntry("Delete EstateAgent", DELETE_AGENT);
|
||||
estateAgentMenu.addEntry("Back to the main menu", BACK);
|
||||
|
||||
// process input
|
||||
@ -65,6 +225,12 @@ public class Main {
|
||||
case NEW_AGENT:
|
||||
newEstateAgent();
|
||||
break;
|
||||
case CHANGE_AGENT:
|
||||
changeEstateAgent();
|
||||
break;
|
||||
case DELETE_AGENT:
|
||||
deleteEstateAgent();
|
||||
break;
|
||||
case BACK:
|
||||
return;
|
||||
}
|
||||
@ -86,4 +252,29 @@ public class Main {
|
||||
|
||||
System.out.println("EstateAgent with the ID " + agent.getId() + " was created.");
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Change an estate agent after the usesr has entered the necessary data.
|
||||
*/
|
||||
private static void changeEstateAgent() {
|
||||
EstateAgent agent = new EstateAgent();//logged in Agent
|
||||
|
||||
agent.setName(FormUtil.readString("Name"));
|
||||
agent.setAddress(FormUtil.readString("Address"));
|
||||
agent.setLogin(FormUtil.readString("Login"));
|
||||
agent.setPassword(FormUtil.readString("Password"));
|
||||
|
||||
//_orm.persist(agent);
|
||||
|
||||
System.out.println("EstateAgent with the ID " + agent.getId() + " was updated.");
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Deletes an estate agent.
|
||||
*/
|
||||
private static void deleteEstateAgent() {
|
||||
//Delete Agent
|
||||
EstateAgent agent = new EstateAgent();//logged in Agent
|
||||
System.out.println("EstateAgent with the ID " + agent.getId() + " was deleted.");
|
||||
}
|
||||
}
|
||||
|
||||
40
02/src/de/dis2017/data/Apartment.java
Normal file
40
02/src/de/dis2017/data/Apartment.java
Normal file
@ -0,0 +1,40 @@
|
||||
package de.dis2017.data;
|
||||
|
||||
public class Apartment extends Estate{
|
||||
int floor;
|
||||
int rent;
|
||||
int rooms;
|
||||
boolean balcony;
|
||||
boolean builtinKitchen;
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
public void setFloor(int floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
public int getRent() {
|
||||
return rent;
|
||||
}
|
||||
public void setRent(int rent) {
|
||||
this.rent = rent;
|
||||
}
|
||||
public int getRooms() {
|
||||
return rooms;
|
||||
}
|
||||
public void setRooms(int rooms) {
|
||||
this.rooms = rooms;
|
||||
}
|
||||
public boolean isBalcony() {
|
||||
return balcony;
|
||||
}
|
||||
public void setBalcony(boolean balcony) {
|
||||
this.balcony = balcony;
|
||||
}
|
||||
public boolean isBuiltinKitchen() {
|
||||
return builtinKitchen;
|
||||
}
|
||||
public void setBuiltinKitchen(boolean builtinKitchen) {
|
||||
this.builtinKitchen = builtinKitchen;
|
||||
}
|
||||
}
|
||||
61
02/src/de/dis2017/data/Estate.java
Normal file
61
02/src/de/dis2017/data/Estate.java
Normal file
@ -0,0 +1,61 @@
|
||||
package de.dis2017.data;
|
||||
|
||||
/**
|
||||
* EstateAgent data class
|
||||
*/
|
||||
public abstract class Estate {
|
||||
private int id = -1;
|
||||
private String city;
|
||||
private int postalcode;
|
||||
private String street;
|
||||
private int streetnumber;
|
||||
private int squarearea;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public int getPostalcode() {
|
||||
return postalcode;
|
||||
}
|
||||
|
||||
public void setPostalcode(int postalcode) {
|
||||
this.postalcode = postalcode;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public int getStreetNumber() {
|
||||
return streetnumber;
|
||||
}
|
||||
|
||||
public void setStreetnumber(int streetnumber) {
|
||||
this.streetnumber = streetnumber;
|
||||
}
|
||||
|
||||
public int getSquareArea() {
|
||||
return streetnumber;
|
||||
}
|
||||
|
||||
public void setSquareArea(int squarearea) {
|
||||
this.squarearea = squarearea;
|
||||
}
|
||||
}
|
||||
28
02/src/de/dis2017/data/House.java
Normal file
28
02/src/de/dis2017/data/House.java
Normal file
@ -0,0 +1,28 @@
|
||||
package de.dis2017.data;
|
||||
|
||||
public class House extends Estate {
|
||||
int floors;
|
||||
int price;
|
||||
boolean garden;
|
||||
|
||||
public int getFloors() {
|
||||
return floors;
|
||||
}
|
||||
public void setFloors(int floors) {
|
||||
this.floors = floors;
|
||||
}
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
public void setPrice(int price) {
|
||||
this.price = price;
|
||||
}
|
||||
public boolean isGarden() {
|
||||
return garden;
|
||||
}
|
||||
public void setGarden(boolean garden) {
|
||||
this.garden = garden;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user