-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract interface from SimpleEmployeeApplication
- Loading branch information
1 parent
cc4cc2e
commit c8ef602
Showing
5 changed files
with
49 additions
and
32 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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=14 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=14 | ||
org.eclipse.jdt.core.compiler.compliance=11 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=14 | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=11 |
28 changes: 4 additions & 24 deletions
28
hr-domain/src/com/example/hr/application/EmployeeApplication.java
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 |
---|---|---|
@@ -1,31 +1,11 @@ | ||
package com.example.hr.application; | ||
|
||
import com.example.hr.domain.Employee; | ||
import com.example.hr.events.EmployeeFiredEvent; | ||
import com.example.hr.events.EmployeeHiredEvent; | ||
import com.example.hr.infrastructure.EventPushlisher; | ||
import com.example.hr.repository.EmployeeRepository; | ||
|
||
public class EmployeeApplication { | ||
private EmployeeRepository employeeRepository; | ||
private EventPushlisher eventPushlisher; | ||
public interface EmployeeApplication { | ||
|
||
public void setEmployeeRepository(EmployeeRepository employeeRepository) { | ||
this.employeeRepository = employeeRepository; | ||
} | ||
void hireEmployee(Employee employee); | ||
|
||
public void setEventPushlisher(EventPushlisher eventPushlisher) { | ||
this.eventPushlisher = eventPushlisher; | ||
} | ||
void fireEmployee(Employee employee); | ||
|
||
public void hireEmployee(Employee employee) { | ||
employeeRepository.save(employee); | ||
eventPushlisher.publishEvent(new EmployeeHiredEvent("", "employees", employee)); | ||
} | ||
|
||
public void fireEmployee(Employee employee) { | ||
employeeRepository.remove(employee); | ||
eventPushlisher.publishEvent(new EmployeeFiredEvent("", "employees", employee)); | ||
} | ||
|
||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
hr-domain/src/com/example/hr/application/business/SimpleEmployeeApplication.java
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.example.hr.application.business; | ||
|
||
import com.example.hr.application.EmployeeApplication; | ||
import com.example.hr.domain.Employee; | ||
import com.example.hr.events.EmployeeFiredEvent; | ||
import com.example.hr.events.EmployeeHiredEvent; | ||
import com.example.hr.infrastructure.EventPushlisher; | ||
import com.example.hr.repository.EmployeeRepository; | ||
|
||
public class SimpleEmployeeApplication implements EmployeeApplication { | ||
private EmployeeRepository employeeRepository; | ||
private EventPushlisher eventPushlisher; | ||
|
||
public void setEmployeeRepository(EmployeeRepository employeeRepository) { | ||
this.employeeRepository = employeeRepository; | ||
} | ||
|
||
public void setEventPushlisher(EventPushlisher eventPushlisher) { | ||
this.eventPushlisher = eventPushlisher; | ||
} | ||
|
||
@Override | ||
public void hireEmployee(Employee employee) { | ||
employeeRepository.save(employee); | ||
eventPushlisher.publishEvent(new EmployeeHiredEvent("", "employees", employee)); | ||
} | ||
|
||
@Override | ||
public void fireEmployee(Employee employee) { | ||
employeeRepository.remove(employee); | ||
eventPushlisher.publishEvent(new EmployeeFiredEvent("", "employees", employee)); | ||
} | ||
|
||
} |
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