├── .gitattributes
├── .gitignore
├── CoffeeShopWithCustomerIdentityAuth
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ └── org.eclipse.jdt.core.prefs
└── src
│ ├── Abstract
│ ├── BaseCustomerManager.java
│ ├── ICustomerCheckService.java
│ ├── ICustomerService.java
│ └── IEntity.java
│ ├── Adapters
│ └── MernisServiceAdapter.java
│ ├── Concrete
│ ├── FakeCustomerCheckManager.java
│ ├── NeroCustomerManager.java
│ └── StarbucksCustomerManager.java
│ ├── Entities
│ └── Customer.java
│ ├── Main
│ └── Main.java
│ └── MernisServiceReference
│ ├── KPSPublic.java
│ ├── KPSPublicLocator.java
│ ├── KPSPublicSoap.java
│ ├── KPSPublicSoapProxy.java
│ └── KPSPublicSoapStub.java
├── GameSellingAndDiscountSystem
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ ├── Abstract
│ ├── AuthService.java
│ ├── GameService.java
│ ├── GamerService.java
│ └── OfferService.java
│ ├── Concrete
│ ├── AuthManager.java
│ ├── GameManager.java
│ ├── GamerManager.java
│ └── OfferManager.java
│ ├── Entities
│ ├── Game.java
│ ├── Gamer.java
│ └── Offer.java
│ └── Main.java
├── README.md
├── abstractClasses
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ ├── abstractClasses
│ ├── GameCalculator.java
│ ├── KidsGameCalculator.java
│ ├── Main.java
│ ├── ManGameCalculator.java
│ ├── OlderGameCalculator.java
│ └── WomanGameCalculator.java
│ └── abstractClasses2
│ ├── BaseDatabaseManager.java
│ ├── CustomerManager.java
│ ├── Main.java
│ ├── OracleDatabaseManager.java
│ └── SqlServerDatabaseManager.java
├── hrms.rar
├── hrms
├── .gitignore
├── .mvn
│ └── wrapper
│ │ ├── MavenWrapperDownloader.java
│ │ ├── maven-wrapper.jar
│ │ └── maven-wrapper.properties
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── tamerm
│ │ │ └── hrms
│ │ │ ├── HrmsApplication.java
│ │ │ ├── MernisTest
│ │ │ └── MernisVerification.java
│ │ │ ├── api
│ │ │ └── controllers
│ │ │ │ ├── CandidateController.java
│ │ │ │ ├── EmployerController.java
│ │ │ │ ├── JobAdvertisementController.java
│ │ │ │ ├── JobController.java
│ │ │ │ ├── SystemEmployeeConfirmController.java
│ │ │ │ └── SystemEmployeeController.java
│ │ │ ├── business
│ │ │ ├── abstracts
│ │ │ │ ├── CandidateService.java
│ │ │ │ ├── CandidateVerificationCodeService.java
│ │ │ │ ├── EmployerService.java
│ │ │ │ ├── EmployerVerificationCodeService.java
│ │ │ │ ├── JobAdvertisementService.java
│ │ │ │ ├── JobService.java
│ │ │ │ ├── SystemEmployeeConfirmEmployerService.java
│ │ │ │ ├── SystemEmployeeConfirmService.java
│ │ │ │ ├── SystemEmployeeService.java
│ │ │ │ ├── UserService.java
│ │ │ │ ├── VerificationCodeService.java
│ │ │ │ └── VerificationService.java
│ │ │ └── concretes
│ │ │ │ ├── CandidateManager.java
│ │ │ │ ├── CandidateVerificationCodeManager.java
│ │ │ │ ├── EmailVerificationManager.java
│ │ │ │ ├── EmployerManager.java
│ │ │ │ ├── EmployerVerificationCodeManager.java
│ │ │ │ ├── JobAdvertisementManager.java
│ │ │ │ ├── JobManager.java
│ │ │ │ ├── SystemEmployeeConfirmEmployerManager.java
│ │ │ │ ├── SystemEmployeeConfirmManager.java
│ │ │ │ ├── SystemEmployeeManager.java
│ │ │ │ └── UserManager.java
│ │ │ ├── core
│ │ │ └── utilities
│ │ │ │ ├── adapters
│ │ │ │ └── MernisServiceAdapter.java
│ │ │ │ ├── results
│ │ │ │ ├── DataResult.java
│ │ │ │ ├── ErrorDataResult.java
│ │ │ │ ├── ErrorResult.java
│ │ │ │ ├── Result.java
│ │ │ │ ├── SuccessDataResult.java
│ │ │ │ └── SuccessResult.java
│ │ │ │ └── senders
│ │ │ │ └── email
│ │ │ │ └── EmailSender.java
│ │ │ ├── dataAccess
│ │ │ └── abstracts
│ │ │ │ ├── CandidateDao.java
│ │ │ │ ├── CandidateVerificationCodeDao.java
│ │ │ │ ├── CityDao.java
│ │ │ │ ├── EmployerDao.java
│ │ │ │ ├── EmployerVerificationCodeDao.java
│ │ │ │ ├── JobAdvertisementDao.java
│ │ │ │ ├── JobDao.java
│ │ │ │ ├── SystemEmployeeConfirmDao.java
│ │ │ │ ├── SystemEmployeeConfirmEmployerDao.java
│ │ │ │ ├── SystemEmployeeDao.java
│ │ │ │ ├── UserDao.java
│ │ │ │ └── VerificationCodeDao.java
│ │ │ └── entities
│ │ │ └── concretes
│ │ │ ├── Candidate.java
│ │ │ ├── CandidateVerificationCode.java
│ │ │ ├── City.java
│ │ │ ├── Employer.java
│ │ │ ├── EmployerVerificationCode.java
│ │ │ ├── Job.java
│ │ │ ├── JobAdvertisement.java
│ │ │ ├── SystemEmployee.java
│ │ │ ├── SystemEmployeeConfirm.java
│ │ │ ├── SystemEmployeeConfirmEmployer.java
│ │ │ ├── User.java
│ │ │ └── VerificationCode.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── tamerm
│ └── hrms
│ └── HrmsApplicationTests.java
├── inheritance
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ └── inheritance
│ ├── CorporateCustomer.java
│ ├── Customer.java
│ ├── CustomerManager.java
│ ├── IndividualCustomer.java
│ └── Main.java
├── inheritance2
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ ├── extraWork
│ ├── Course.java
│ ├── CourseManager.java
│ ├── Instructor.java
│ ├── InstructorManager.java
│ ├── Main.java
│ ├── Student.java
│ ├── StudentManager.java
│ ├── User.java
│ └── UserManager.java
│ └── inheritance2
│ ├── CustomerManager.java
│ ├── DatabaseLogger.java
│ ├── EmailLogger.java
│ ├── FileLogger.java
│ ├── LogManager.java
│ ├── Logger.java
│ └── Main.java
├── innerclassAndStatic
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ └── innerclassAndStatic
│ ├── DatabaseHelper.java
│ ├── Main.java
│ ├── Product.java
│ ├── ProductManager.java
│ └── ProductValidator.java
├── interfaces
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ ├── interfaces
│ ├── Customer.java
│ ├── CustomerManager.java
│ ├── DatabaseLogger.java
│ ├── FileLogger.java
│ ├── Logger.java
│ ├── Main.java
│ ├── SmsLogger.java
│ └── Utils.java
│ ├── interfaces2
│ ├── CustomerDal.java
│ ├── CustomerManager.java
│ ├── Main.java
│ ├── MySqlCustomerDal.java
│ └── OracleCustomerDal.java
│ └── multi_implementation
│ ├── Eatable.java
│ ├── Main.java
│ ├── OutsideWorker.java
│ ├── Payable.java
│ ├── Robot.java
│ ├── Workable.java
│ └── Worker.java
├── intro
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ ├── intro
│ │ └── Main.class
│ └── someSamples
│ │ └── IsPrimeNumberFunction.class
└── src
│ ├── intro
│ └── Main.java
│ └── someSamples
│ └── IsPrimeNumberFunction.java
├── loginAndAuthSystemWithRegex
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ └── loginAndAuthSystemWithRegex
│ ├── Main.java
│ ├── business
│ ├── abstracts
│ │ ├── EmailVerificationService.java
│ │ ├── UserService.java
│ │ └── ValidateService.java
│ └── concretes
│ │ ├── EmailVerificationManager.java
│ │ ├── RegexValidateManager.java
│ │ └── UserManager.java
│ ├── core
│ ├── abstracts
│ │ └── RegisterService.java
│ └── concretes
│ │ └── GoogleRegisterServiceAdapter.java
│ ├── dataAccess
│ ├── abstracts
│ │ └── UserDao.java
│ └── concretes
│ │ └── HibernateUserDao.java
│ ├── entities
│ ├── abstracts
│ │ └── Entity.java
│ └── concretes
│ │ └── User.java
│ └── googleRegisterServiceReference
│ └── GoogleRegisterServiceManager.java
├── nLayeredDemo
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── src
│ └── nLayeredDemo
│ ├── Main.java
│ ├── business
│ ├── abstracts
│ │ └── ProductService.java
│ └── concretes
│ │ └── ProductManager.java
│ ├── core
│ ├── JLoggerServiceAdapter.java
│ └── LoggerService.java
│ ├── dataAccess
│ ├── abstracts
│ │ └── ProductDao.java
│ └── concretes
│ │ ├── AbcProductDao.java
│ │ └── HibernateProductDao.java
│ ├── entities
│ ├── abstracts
│ │ └── Entity.java
│ └── concretes
│ │ └── Product.java
│ └── jLogger
│ └── JLoggerManager.java
├── northwind
├── .gitignore
├── .mvn
│ └── wrapper
│ │ ├── MavenWrapperDownloader.java
│ │ ├── maven-wrapper.jar
│ │ └── maven-wrapper.properties
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── kodlamaio
│ │ │ └── northwind
│ │ │ ├── NorthwindApplication.java
│ │ │ ├── api
│ │ │ └── controllers
│ │ │ │ └── ProductsController.java
│ │ │ ├── business
│ │ │ ├── abstracts
│ │ │ │ └── ProductService.java
│ │ │ └── concretes
│ │ │ │ └── ProductManager.java
│ │ │ ├── core
│ │ │ └── utilities
│ │ │ │ └── results
│ │ │ │ ├── DataResult.java
│ │ │ │ ├── ErrorDataResult.java
│ │ │ │ ├── ErrorResult.java
│ │ │ │ ├── Result.java
│ │ │ │ ├── SuccessDataResult.java
│ │ │ │ └── SuccessResult.java
│ │ │ ├── dataAccess
│ │ │ └── abstracts
│ │ │ │ └── ProductDao.java
│ │ │ └── entities
│ │ │ └── concretes
│ │ │ ├── Category.java
│ │ │ └── Product.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── kodlamaio
│ └── northwind
│ └── NorthwindApplicationTests.java
└── oopIntro
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── bin
├── extraWork
│ ├── Category.class
│ ├── Course.class
│ ├── CourseManager.class
│ ├── Instructor.class
│ └── Main.class
└── oopIntro
│ ├── Category.class
│ ├── Main.class
│ ├── Product.class
│ └── ProductManager.class
└── src
├── extraWork
├── Category.java
├── Course.java
├── CourseManager.java
├── Instructor.java
└── Main.java
└── oopIntro
├── Category.java
├── Main.java
├── Product.java
└── ProductManager.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.metadata/
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | CoffeeShopWithCustomerIdentityAuth
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jem.workbench.JavaEMFNature
16 | org.eclipse.jdt.core.javanature
17 |
18 |
19 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/MernisServiceReference/KPSPublic.java=UTF-8
3 | encoding//src/MernisServiceReference/KPSPublicLocator.java=UTF-8
4 | encoding//src/MernisServiceReference/KPSPublicSoap.java=UTF-8
5 | encoding//src/MernisServiceReference/KPSPublicSoapStub.java=UTF-8
6 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.8
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
14 | org.eclipse.jdt.core.compiler.release=enabled
15 | org.eclipse.jdt.core.compiler.source=1.8
16 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Abstract/BaseCustomerManager.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Customer;
4 |
5 | public abstract class BaseCustomerManager implements ICustomerService{
6 |
7 | public void save(Customer customer) throws Exception {
8 | System.out.println("Validation successful. Customer saved to db: " +
9 | customer.getFirstName() + " " + customer.getLastName());
10 | }
11 |
12 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Abstract/ICustomerCheckService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import java.rmi.RemoteException;
4 |
5 | import Entities.Customer;
6 |
7 | public interface ICustomerCheckService {
8 | boolean checkIfRealPerson(Customer customer) throws RemoteException;
9 | }
10 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Abstract/ICustomerService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Customer;
4 |
5 | public interface ICustomerService {
6 | void save(Customer customer) throws Exception;
7 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Abstract/IEntity.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | public interface IEntity {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Adapters/MernisServiceAdapter.java:
--------------------------------------------------------------------------------
1 | package Adapters;
2 |
3 | import java.rmi.RemoteException;
4 |
5 | import Abstract.ICustomerCheckService;
6 | import Entities.Customer;
7 | import MernisServiceReference.*;
8 |
9 |
10 | public class MernisServiceAdapter implements ICustomerCheckService {
11 |
12 | @Override
13 | public boolean checkIfRealPerson(Customer customer) throws RemoteException {
14 |
15 | KPSPublicSoapProxy proxy = new KPSPublicSoapProxy();
16 | return proxy.TCKimlikNoDogrula(Long.parseLong(customer.getNationalityId()), customer.getFirstName().toUpperCase(),
17 | customer.getLastName().toUpperCase(), customer.getDateOfBirth().getYear());
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Concrete/FakeCustomerCheckManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import java.rmi.RemoteException;
4 |
5 | import Abstract.ICustomerCheckService;
6 | import Entities.Customer;
7 |
8 | public class FakeCustomerCheckManager implements ICustomerCheckService {
9 |
10 | @Override
11 | public boolean checkIfRealPerson(Customer customer) throws RemoteException {
12 | return true;
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Concrete/NeroCustomerManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.BaseCustomerManager;
4 |
5 | public class NeroCustomerManager extends BaseCustomerManager{
6 | // Nero don't want customer authentication.
7 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Concrete/StarbucksCustomerManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.BaseCustomerManager;
4 | import Abstract.ICustomerCheckService;
5 | import Entities.Customer;
6 |
7 | public class StarbucksCustomerManager extends BaseCustomerManager {
8 |
9 | ICustomerCheckService customerCheckService;
10 |
11 | public StarbucksCustomerManager(ICustomerCheckService customerCheckService) {
12 | this.customerCheckService = customerCheckService;
13 | }
14 |
15 | @Override
16 | public void save(Customer customer) throws Exception {
17 | if (customerCheckService.checkIfRealPerson(customer)) {
18 | super.save(customer);
19 | } else {
20 | throw new Exception("Not a valid person");
21 | }
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Entities/Customer.java:
--------------------------------------------------------------------------------
1 | package Entities;
2 |
3 | import java.time.LocalDate;
4 |
5 | import Abstract.IEntity;
6 |
7 | public class Customer implements IEntity{
8 |
9 | private int id;
10 | private String firstName;
11 | private String lastName;
12 | private LocalDate dateOfBirth;
13 | private String nationalityId;
14 |
15 | public Customer(int id, String firstName, String lastName, LocalDate dateOfBirth, String nationalityId) {
16 | super();
17 | this.id = id;
18 | this.firstName = firstName;
19 | this.lastName = lastName;
20 | this.dateOfBirth = dateOfBirth;
21 | this.nationalityId = nationalityId;
22 | }
23 |
24 | public int getId() {
25 | return id;
26 | }
27 |
28 | public void setId(int id) {
29 | this.id = id;
30 | }
31 |
32 | public String getFirstName() {
33 | return firstName;
34 | }
35 |
36 | public void setFirstName(String firstName) {
37 | this.firstName = firstName;
38 | }
39 |
40 | public String getLastName() {
41 | return lastName;
42 | }
43 |
44 | public void setLastName(String lastName) {
45 | this.lastName = lastName;
46 | }
47 |
48 | public LocalDate getDateOfBirth() {
49 | return dateOfBirth;
50 | }
51 |
52 | public void setDateOfBirth(LocalDate dateOfBirth) {
53 | this.dateOfBirth = dateOfBirth;
54 | }
55 |
56 | public String getNationalityId() {
57 | return nationalityId;
58 | }
59 |
60 | public void setNationalityId(String nationalityId) {
61 | this.nationalityId = nationalityId;
62 | }
63 |
64 |
65 |
66 |
67 |
68 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/Main/Main.java:
--------------------------------------------------------------------------------
1 | package Main;
2 |
3 | import java.time.LocalDate;
4 | import Abstract.BaseCustomerManager;
5 | import Adapters.MernisServiceAdapter;
6 | // import Concrete.FakeCustomerCheckManager; // always return true
7 | import Concrete.StarbucksCustomerManager;
8 | import Entities.Customer;
9 |
10 | public class Main {
11 |
12 | public static void main(String[] args) throws Exception {
13 | BaseCustomerManager customerManager = new StarbucksCustomerManager(new MernisServiceAdapter()); //
14 | // BaseCustomerManager customerManager = new StarbucksCustomerManager(new FakeCustomerCheckManager());
15 | try {
16 | customerManager.save(new Customer(1,"Tamer","Murtazaoglu",LocalDate.of(2000,01,01),"0"));
17 | } catch (Exception e) {
18 | System.out.println("Validation unsuccessful. Customer don't saved to db.");
19 | }
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/MernisServiceReference/KPSPublic.java:
--------------------------------------------------------------------------------
1 | /**
2 | * KPSPublic.java
3 | *
4 | * This file was auto-generated from WSDL
5 | * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
6 | */
7 |
8 | package MernisServiceReference;
9 |
10 | public interface KPSPublic extends javax.xml.rpc.Service {
11 | public java.lang.String getKPSPublicSoapAddress();
12 |
13 | public MernisServiceReference.KPSPublicSoap getKPSPublicSoap() throws javax.xml.rpc.ServiceException;
14 |
15 | public MernisServiceReference.KPSPublicSoap getKPSPublicSoap(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
16 | }
17 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/MernisServiceReference/KPSPublicLocator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * KPSPublicLocator.java
3 | *
4 | * This file was auto-generated from WSDL
5 | * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
6 | */
7 |
8 | package MernisServiceReference;
9 |
10 | public class KPSPublicLocator extends org.apache.axis.client.Service implements MernisServiceReference.KPSPublic {
11 |
12 | public KPSPublicLocator() {
13 | }
14 |
15 |
16 | public KPSPublicLocator(org.apache.axis.EngineConfiguration config) {
17 | super(config);
18 | }
19 |
20 | public KPSPublicLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
21 | super(wsdlLoc, sName);
22 | }
23 |
24 | // Use to get a proxy class for KPSPublicSoap
25 | private java.lang.String KPSPublicSoap_address = "https://tckimlik.nvi.gov.tr/service/kpspublic.asmx";
26 |
27 | public java.lang.String getKPSPublicSoapAddress() {
28 | return KPSPublicSoap_address;
29 | }
30 |
31 | // The WSDD service name defaults to the port name.
32 | private java.lang.String KPSPublicSoapWSDDServiceName = "KPSPublicSoap";
33 |
34 | public java.lang.String getKPSPublicSoapWSDDServiceName() {
35 | return KPSPublicSoapWSDDServiceName;
36 | }
37 |
38 | public void setKPSPublicSoapWSDDServiceName(java.lang.String name) {
39 | KPSPublicSoapWSDDServiceName = name;
40 | }
41 |
42 | public MernisServiceReference.KPSPublicSoap getKPSPublicSoap() throws javax.xml.rpc.ServiceException {
43 | java.net.URL endpoint;
44 | try {
45 | endpoint = new java.net.URL(KPSPublicSoap_address);
46 | }
47 | catch (java.net.MalformedURLException e) {
48 | throw new javax.xml.rpc.ServiceException(e);
49 | }
50 | return getKPSPublicSoap(endpoint);
51 | }
52 |
53 | public MernisServiceReference.KPSPublicSoap getKPSPublicSoap(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
54 | try {
55 | MernisServiceReference.KPSPublicSoapStub _stub = new MernisServiceReference.KPSPublicSoapStub(portAddress, this);
56 | _stub.setPortName(getKPSPublicSoapWSDDServiceName());
57 | return _stub;
58 | }
59 | catch (org.apache.axis.AxisFault e) {
60 | return null;
61 | }
62 | }
63 |
64 | public void setKPSPublicSoapEndpointAddress(java.lang.String address) {
65 | KPSPublicSoap_address = address;
66 | }
67 |
68 | /**
69 | * For the given interface, get the stub implementation.
70 | * If this service has no port for the given interface,
71 | * then ServiceException is thrown.
72 | */
73 | public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
74 | try {
75 | if (MernisServiceReference.KPSPublicSoap.class.isAssignableFrom(serviceEndpointInterface)) {
76 | MernisServiceReference.KPSPublicSoapStub _stub = new MernisServiceReference.KPSPublicSoapStub(new java.net.URL(KPSPublicSoap_address), this);
77 | _stub.setPortName(getKPSPublicSoapWSDDServiceName());
78 | return _stub;
79 | }
80 | }
81 | catch (java.lang.Throwable t) {
82 | throw new javax.xml.rpc.ServiceException(t);
83 | }
84 | throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
85 | }
86 |
87 | /**
88 | * For the given interface, get the stub implementation.
89 | * If this service has no port for the given interface,
90 | * then ServiceException is thrown.
91 | */
92 | public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
93 | if (portName == null) {
94 | return getPort(serviceEndpointInterface);
95 | }
96 | java.lang.String inputPortName = portName.getLocalPart();
97 | if ("KPSPublicSoap".equals(inputPortName)) {
98 | return getKPSPublicSoap();
99 | }
100 | else {
101 | java.rmi.Remote _stub = getPort(serviceEndpointInterface);
102 | ((org.apache.axis.client.Stub) _stub).setPortName(portName);
103 | return _stub;
104 | }
105 | }
106 |
107 | public javax.xml.namespace.QName getServiceName() {
108 | return new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "KPSPublic");
109 | }
110 |
111 | private java.util.HashSet ports = null;
112 |
113 | public java.util.Iterator getPorts() {
114 | if (ports == null) {
115 | ports = new java.util.HashSet();
116 | ports.add(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "KPSPublicSoap"));
117 | }
118 | return ports.iterator();
119 | }
120 |
121 | /**
122 | * Set the endpoint address for the specified port name.
123 | */
124 | public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
125 |
126 | if ("KPSPublicSoap".equals(portName)) {
127 | setKPSPublicSoapEndpointAddress(address);
128 | }
129 | else
130 | { // Unknown Port Name
131 | throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
132 | }
133 | }
134 |
135 | /**
136 | * Set the endpoint address for the specified port name.
137 | */
138 | public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
139 | setEndpointAddress(portName.getLocalPart(), address);
140 | }
141 |
142 | }
143 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/MernisServiceReference/KPSPublicSoap.java:
--------------------------------------------------------------------------------
1 | /**
2 | * KPSPublicSoap.java
3 | *
4 | * This file was auto-generated from WSDL
5 | * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
6 | */
7 |
8 | package MernisServiceReference;
9 |
10 | public interface KPSPublicSoap extends java.rmi.Remote {
11 | public boolean TCKimlikNoDogrula(long TCKimlikNo, java.lang.String ad, java.lang.String soyad, int dogumYili) throws java.rmi.RemoteException;
12 | }
13 |
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/MernisServiceReference/KPSPublicSoapProxy.java:
--------------------------------------------------------------------------------
1 | package MernisServiceReference;
2 |
3 | public class KPSPublicSoapProxy implements MernisServiceReference.KPSPublicSoap {
4 | private String _endpoint = null;
5 | private MernisServiceReference.KPSPublicSoap kPSPublicSoap = null;
6 |
7 | public KPSPublicSoapProxy() {
8 | _initKPSPublicSoapProxy();
9 | }
10 |
11 | public KPSPublicSoapProxy(String endpoint) {
12 | _endpoint = endpoint;
13 | _initKPSPublicSoapProxy();
14 | }
15 |
16 | private void _initKPSPublicSoapProxy() {
17 | try {
18 | kPSPublicSoap = (new MernisServiceReference.KPSPublicLocator()).getKPSPublicSoap();
19 | if (kPSPublicSoap != null) {
20 | if (_endpoint != null)
21 | ((javax.xml.rpc.Stub)kPSPublicSoap)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
22 | else
23 | _endpoint = (String)((javax.xml.rpc.Stub)kPSPublicSoap)._getProperty("javax.xml.rpc.service.endpoint.address");
24 | }
25 |
26 | }
27 | catch (javax.xml.rpc.ServiceException serviceException) {}
28 | }
29 |
30 | public String getEndpoint() {
31 | return _endpoint;
32 | }
33 |
34 | public void setEndpoint(String endpoint) {
35 | _endpoint = endpoint;
36 | if (kPSPublicSoap != null)
37 | ((javax.xml.rpc.Stub)kPSPublicSoap)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
38 |
39 | }
40 |
41 | public MernisServiceReference.KPSPublicSoap getKPSPublicSoap() {
42 | if (kPSPublicSoap == null)
43 | _initKPSPublicSoapProxy();
44 | return kPSPublicSoap;
45 | }
46 |
47 | public boolean TCKimlikNoDogrula(long TCKimlikNo, java.lang.String ad, java.lang.String soyad, int dogumYili) throws java.rmi.RemoteException{
48 | if (kPSPublicSoap == null)
49 | _initKPSPublicSoapProxy();
50 | return kPSPublicSoap.TCKimlikNoDogrula(TCKimlikNo, ad, soyad, dogumYili);
51 | }
52 |
53 |
54 | }
--------------------------------------------------------------------------------
/CoffeeShopWithCustomerIdentityAuth/src/MernisServiceReference/KPSPublicSoapStub.java:
--------------------------------------------------------------------------------
1 | /**
2 | * KPSPublicSoapStub.java
3 | *
4 | * This file was auto-generated from WSDL
5 | * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
6 | */
7 |
8 | package MernisServiceReference;
9 |
10 | public class KPSPublicSoapStub extends org.apache.axis.client.Stub implements MernisServiceReference.KPSPublicSoap {
11 | private java.util.Vector cachedSerClasses = new java.util.Vector();
12 | private java.util.Vector cachedSerQNames = new java.util.Vector();
13 | private java.util.Vector cachedSerFactories = new java.util.Vector();
14 | private java.util.Vector cachedDeserFactories = new java.util.Vector();
15 |
16 | static org.apache.axis.description.OperationDesc [] _operations;
17 |
18 | static {
19 | _operations = new org.apache.axis.description.OperationDesc[1];
20 | _initOperationDesc1();
21 | }
22 |
23 | private static void _initOperationDesc1(){
24 | org.apache.axis.description.OperationDesc oper;
25 | org.apache.axis.description.ParameterDesc param;
26 | oper = new org.apache.axis.description.OperationDesc();
27 | oper.setName("TCKimlikNoDogrula");
28 | param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "TCKimlikNo"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), long.class, false, false);
29 | oper.addParameter(param);
30 | param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "Ad"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
31 | param.setOmittable(true);
32 | oper.addParameter(param);
33 | param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "Soyad"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
34 | param.setOmittable(true);
35 | oper.addParameter(param);
36 | param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "DogumYili"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, false, false);
37 | oper.addParameter(param);
38 | oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
39 | oper.setReturnClass(boolean.class);
40 | oper.setReturnQName(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "TCKimlikNoDogrulaResult"));
41 | oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
42 | oper.setUse(org.apache.axis.constants.Use.LITERAL);
43 | _operations[0] = oper;
44 |
45 | }
46 |
47 | public KPSPublicSoapStub() throws org.apache.axis.AxisFault {
48 | this(null);
49 | }
50 |
51 | public KPSPublicSoapStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
52 | this(service);
53 | super.cachedEndpoint = endpointURL;
54 | }
55 |
56 | public KPSPublicSoapStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
57 | if (service == null) {
58 | super.service = new org.apache.axis.client.Service();
59 | } else {
60 | super.service = service;
61 | }
62 | ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
63 | }
64 |
65 | protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
66 | try {
67 | org.apache.axis.client.Call _call = super._createCall();
68 | if (super.maintainSessionSet) {
69 | _call.setMaintainSession(super.maintainSession);
70 | }
71 | if (super.cachedUsername != null) {
72 | _call.setUsername(super.cachedUsername);
73 | }
74 | if (super.cachedPassword != null) {
75 | _call.setPassword(super.cachedPassword);
76 | }
77 | if (super.cachedEndpoint != null) {
78 | _call.setTargetEndpointAddress(super.cachedEndpoint);
79 | }
80 | if (super.cachedTimeout != null) {
81 | _call.setTimeout(super.cachedTimeout);
82 | }
83 | if (super.cachedPortName != null) {
84 | _call.setPortName(super.cachedPortName);
85 | }
86 | java.util.Enumeration keys = super.cachedProperties.keys();
87 | while (keys.hasMoreElements()) {
88 | java.lang.String key = (java.lang.String) keys.nextElement();
89 | _call.setProperty(key, super.cachedProperties.get(key));
90 | }
91 | return _call;
92 | }
93 | catch (java.lang.Throwable _t) {
94 | throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
95 | }
96 | }
97 |
98 | public boolean TCKimlikNoDogrula(long TCKimlikNo, java.lang.String ad, java.lang.String soyad, int dogumYili) throws java.rmi.RemoteException {
99 | if (super.cachedEndpoint == null) {
100 | throw new org.apache.axis.NoEndPointException();
101 | }
102 | org.apache.axis.client.Call _call = createCall();
103 | _call.setOperation(_operations[0]);
104 | _call.setUseSOAPAction(true);
105 | _call.setSOAPActionURI("http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula");
106 | _call.setEncodingStyle(null);
107 | _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
108 | _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
109 | _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
110 | _call.setOperationName(new javax.xml.namespace.QName("http://tckimlik.nvi.gov.tr/WS", "TCKimlikNoDogrula"));
111 |
112 | setRequestHeaders(_call);
113 | setAttachments(_call);
114 | try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Long(TCKimlikNo), ad, soyad, new java.lang.Integer(dogumYili)});
115 |
116 | if (_resp instanceof java.rmi.RemoteException) {
117 | throw (java.rmi.RemoteException)_resp;
118 | }
119 | else {
120 | extractAttachments(_call);
121 | try {
122 | return ((java.lang.Boolean) _resp).booleanValue();
123 | } catch (java.lang.Exception _exception) {
124 | return ((java.lang.Boolean) org.apache.axis.utils.JavaUtils.convert(_resp, boolean.class)).booleanValue();
125 | }
126 | }
127 | } catch (org.apache.axis.AxisFault axisFaultException) {
128 | throw axisFaultException;
129 | }
130 | }
131 |
132 | }
133 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | GameSellingAndDiscountSystem
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Abstract/AuthService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Gamer;
4 |
5 | public abstract class AuthService {
6 | public boolean auth(Gamer gamer) {
7 | return true;
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Abstract/GameService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Game;
4 | import Entities.Gamer;
5 | import Entities.Offer;
6 |
7 | public abstract class GameService {
8 | public void sell(Game game, Gamer gamer, Offer offer) {
9 | System.out.println(game.getName() + " buyed by " + gamer.getNickname() + " with \"" + offer.getName()
10 | + "\" offer!" );
11 | }
12 |
13 | public void sell(Game game, Gamer gamer) {
14 | System.out.println(game.getName() + " buyed by " + gamer.getNickname() + "!");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Abstract/GamerService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Gamer;
4 |
5 | public interface GamerService {
6 | void update(Gamer gamer);
7 | void delete(Gamer gamer);
8 | void register(Gamer gamer);
9 | }
10 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Abstract/OfferService.java:
--------------------------------------------------------------------------------
1 | package Abstract;
2 |
3 | import Entities.Offer;
4 |
5 | public interface OfferService {
6 | void add(Offer offer);
7 | void update(Offer offer);
8 | void delete(Offer offer);
9 | }
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Concrete/AuthManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.AuthService;
4 | import Entities.Gamer;
5 |
6 | public class AuthManager extends AuthService {
7 |
8 | @Override
9 | public boolean auth(Gamer gamer) {
10 | return super.auth(gamer);
11 | }
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Concrete/GameManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.GameService;
4 | import Entities.Game;
5 | import Entities.Gamer;
6 | import Entities.Offer;
7 |
8 | public class GameManager extends GameService {
9 |
10 | @Override
11 | public void sell(Game game, Gamer gamer) {
12 | super.sell(game, gamer);
13 | }
14 |
15 | @Override
16 | public void sell(Game game, Gamer gamer, Offer offer) {
17 | super.sell(game, gamer, offer);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Concrete/GamerManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.AuthService;
4 | import Abstract.GamerService;
5 | import Entities.Gamer;
6 |
7 | public class GamerManager implements GamerService{
8 |
9 | AuthService authService;
10 |
11 | public GamerManager(AuthService authService) {
12 | this.authService = authService;
13 | }
14 |
15 | @Override
16 | public void register(Gamer gamer) {
17 | if(authService.auth(gamer))
18 | {
19 | System.out.println("Gamer verified and registered as " + gamer.getNickname());
20 | }
21 | else
22 | {
23 | System.out.println("Gamer info not verified, registration fail.");
24 | }
25 | }
26 |
27 | @Override
28 | public void update(Gamer gamer) {
29 | if(authService.auth(gamer))
30 | {
31 | System.out.println("Gamer verified and updated as " + gamer.getNickname());
32 | }
33 | else
34 | {
35 | System.out.println("Gamer info not verified, update fail.");
36 | }
37 | }
38 |
39 | @Override
40 | public void delete(Gamer gamer) {
41 | System.out.println("Gamer deleted: " + gamer.getNickname());
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Concrete/OfferManager.java:
--------------------------------------------------------------------------------
1 | package Concrete;
2 |
3 | import Abstract.OfferService;
4 | import Entities.Offer;
5 |
6 | public class OfferManager implements OfferService {
7 |
8 | @Override
9 | public void add(Offer offer) {
10 | System.out.println("Offer added");
11 |
12 | }
13 |
14 | @Override
15 | public void update(Offer offer) {
16 | System.out.println("Offer updated");
17 |
18 | }
19 |
20 | @Override
21 | public void delete(Offer offer) {
22 | System.out.println("Offer deleted");
23 |
24 | }
25 |
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Entities/Game.java:
--------------------------------------------------------------------------------
1 | package Entities;
2 |
3 | public class Game {
4 |
5 | int id;
6 | String name;
7 | String description;
8 | String producer;
9 | double price;
10 |
11 | public Game(int id, String name, String description, String producer, double price) {
12 | super();
13 | this.id = id;
14 | this.name = name;
15 | this.description = description;
16 | this.producer = producer;
17 | this.price = price;
18 | }
19 |
20 | public int getId() {
21 | return id;
22 | }
23 | public void setId(int id) {
24 | this.id = id;
25 | }
26 | public String getName() {
27 | return name;
28 | }
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 | public String getDescription() {
33 | return description;
34 | }
35 | public void setDescription(String description) {
36 | this.description = description;
37 | }
38 | public String getProducer() {
39 | return producer;
40 | }
41 | public void setProducer(String producer) {
42 | this.producer = producer;
43 | }
44 | public double getPrice() {
45 | return price;
46 | }
47 | public void setPrice(double price) {
48 | this.price = price;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Entities/Gamer.java:
--------------------------------------------------------------------------------
1 | package Entities;
2 |
3 | public class Gamer {
4 | int id;
5 | String nickname;
6 | String firstName;
7 | String lastName;
8 | String email;
9 | String yearOfBirth;
10 | String nationalityNumber;
11 |
12 | public Gamer(int id, String nickname, String firstName, String lastName, String email, String yearOfBirth,
13 | String nationalityNumber) {
14 | super();
15 | this.id = id;
16 | this.nickname = nickname;
17 | this.firstName = firstName;
18 | this.lastName = lastName;
19 | this.email = email;
20 | this.yearOfBirth = yearOfBirth;
21 | this.nationalityNumber = nationalityNumber;
22 | }
23 |
24 |
25 | public int getId() {
26 | return id;
27 | }
28 | public void setId(int id) {
29 | this.id = id;
30 | }
31 | public String getNickname() {
32 | return nickname;
33 | }
34 | public void setNickname(String nickname) {
35 | this.nickname = nickname;
36 | }
37 | public String getFirstName() {
38 | return firstName;
39 | }
40 | public void setFirstName(String firstName) {
41 | this.firstName = firstName;
42 | }
43 | public String getLastName() {
44 | return lastName;
45 | }
46 | public void setLastName(String lastName) {
47 | this.lastName = lastName;
48 | }
49 | public String getEmail() {
50 | return email;
51 | }
52 | public void setEmail(String email) {
53 | this.email = email;
54 | }
55 | public String getYearOfBirth() {
56 | return yearOfBirth;
57 | }
58 | public void setYearOfBirth(String yearOfBirth) {
59 | this.yearOfBirth = yearOfBirth;
60 | }
61 | public String getNationalityNumber() {
62 | return nationalityNumber;
63 | }
64 | public void setNationalityNumber(String nationalityNumber) {
65 | this.nationalityNumber = nationalityNumber;
66 | }
67 |
68 |
69 |
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Entities/Offer.java:
--------------------------------------------------------------------------------
1 | package Entities;
2 |
3 | public class Offer {
4 |
5 | int id;
6 | String name;
7 | double discountPercent;
8 | double discountAmount;
9 |
10 |
11 | public Offer(int id, String name, double discountPercent, double discountAmount) {
12 | super();
13 | this.id = id;
14 | this.name = name;
15 | this.discountPercent = discountPercent;
16 | this.discountAmount = discountAmount;
17 | }
18 |
19 |
20 | public int getId() {
21 | return id;
22 | }
23 | public void setId(int id) {
24 | this.id = id;
25 | }
26 | public String getName() {
27 | return name;
28 | }
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 | public double getDiscountPercent() {
33 | return discountPercent;
34 | }
35 | public void setDiscountPercent(double discountPercent) {
36 | this.discountPercent = discountPercent;
37 | }
38 | public double getDiscountAmount() {
39 | return discountAmount;
40 | }
41 | public void setDiscountAmount(double discountAmount) {
42 | this.discountAmount = discountAmount;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/GameSellingAndDiscountSystem/src/Main.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/GameSellingAndDiscountSystem/src/Main.java
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Hi 👋, I'm Tamer
2 |
3 |
4 |
5 | 🛠 ❤ I’m currently working on [Java] (https://github.com/tamermurtazaoglu/Java)
6 |
7 | Connect with me:
8 |
9 |
10 |
11 |
12 |
13 | Languages and Tools:
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 
22 |
23 |
--------------------------------------------------------------------------------
/abstractClasses/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/abstractClasses/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/abstractClasses/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | abstractClasses
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/abstractClasses/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/GameCalculator.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public abstract class GameCalculator {
4 | public abstract void calc();
5 | public final void gameOver() {
6 | System.out.println("Game over.");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/KidsGameCalculator.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public class KidsGameCalculator extends GameCalculator{
4 |
5 | @Override
6 | public void calc() {
7 | System.out.println("Score: 95");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/Main.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 |
7 | GameCalculator manGameCalculator = new ManGameCalculator();
8 | manGameCalculator.calc();
9 | manGameCalculator.gameOver();
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/ManGameCalculator.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public class ManGameCalculator extends GameCalculator{
4 |
5 | @Override
6 | public void calc() {
7 | System.out.println("Score: 90");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/OlderGameCalculator.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public class OlderGameCalculator extends GameCalculator{
4 |
5 | @Override
6 | public void calc() {
7 | System.out.println("Score: 85");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses/WomanGameCalculator.java:
--------------------------------------------------------------------------------
1 | package abstractClasses;
2 |
3 | public class WomanGameCalculator extends GameCalculator {
4 |
5 | @Override
6 | public void calc() {
7 | System.out.println("Score: 90");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses2/BaseDatabaseManager.java:
--------------------------------------------------------------------------------
1 | package abstractClasses2;
2 |
3 | public abstract class BaseDatabaseManager {
4 | public abstract void getData();
5 | }
6 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses2/CustomerManager.java:
--------------------------------------------------------------------------------
1 | package abstractClasses2;
2 |
3 | public class CustomerManager {
4 |
5 | BaseDatabaseManager databaseManager;
6 | public void getCustomers() {
7 | databaseManager.getData();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses2/Main.java:
--------------------------------------------------------------------------------
1 | package abstractClasses2;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | CustomerManager customerManager = new CustomerManager();
7 | customerManager.databaseManager = new OracleDatabaseManager();
8 | customerManager.getCustomers();
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses2/OracleDatabaseManager.java:
--------------------------------------------------------------------------------
1 | package abstractClasses2;
2 |
3 | public class OracleDatabaseManager extends BaseDatabaseManager{
4 | @Override
5 | public void getData() {
6 | System.out.println("Data fetched: Oracle");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/abstractClasses/src/abstractClasses2/SqlServerDatabaseManager.java:
--------------------------------------------------------------------------------
1 | package abstractClasses2;
2 |
3 | public class SqlServerDatabaseManager extends BaseDatabaseManager {
4 | @Override
5 | public void getData() {
6 | System.out.println("Data fetched: SQL server");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/hrms.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/hrms.rar
--------------------------------------------------------------------------------
/hrms/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/hrms/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.6";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/hrms/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/hrms/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/hrms/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/hrms/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.5.0
9 |
10 |
11 | com.tamerm
12 | hrms
13 | 0.0.1-SNAPSHOT
14 | hrms
15 | HRMS Project
16 |
17 | 11
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-data-jpa
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-starter-web
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-devtools
32 | runtime
33 | true
34 |
35 |
36 | org.postgresql
37 | postgresql
38 | runtime
39 |
40 |
41 | org.projectlombok
42 | lombok
43 | true
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-test
48 | test
49 |
50 |
51 | io.springfox
52 | springfox-swagger2
53 | 2.9.2
54 |
55 |
56 | io.springfox
57 | springfox-swagger-ui
58 | 2.9.2
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.boot
66 | spring-boot-maven-plugin
67 |
68 |
69 |
70 | org.projectlombok
71 | lombok
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/HrmsApplication.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.Bean;
6 |
7 | import springfox.documentation.builders.PathSelectors;
8 | import springfox.documentation.builders.RequestHandlerSelectors;
9 | import springfox.documentation.spi.DocumentationType;
10 | import springfox.documentation.spring.web.plugins.Docket;
11 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
12 |
13 | @SpringBootApplication
14 | @EnableSwagger2
15 | public class HrmsApplication {
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(HrmsApplication.class, args);
19 | }
20 |
21 | @Bean
22 | public Docket api() {
23 | return new Docket(DocumentationType.SWAGGER_2)
24 | .select()
25 | .apis(RequestHandlerSelectors.basePackage("com.tamerm.hrms"))
26 | .build();
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/MernisTest/MernisVerification.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.MernisTest;
2 |
3 | import com.tamerm.hrms.entities.concretes.User;
4 |
5 | public class MernisVerification {
6 | public boolean verify(User user) {
7 | return true;
8 | }
9 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/CandidateController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | import com.tamerm.hrms.business.abstracts.CandidateService;
13 | import com.tamerm.hrms.core.utilities.results.Result;
14 | import com.tamerm.hrms.entities.concretes.Candidate;
15 |
16 | @RestController
17 | @RequestMapping("/api/candidate")
18 | public class CandidateController {
19 |
20 | private CandidateService candidateService;
21 |
22 | @Autowired
23 | public CandidateController(CandidateService candidateService) {
24 | super();
25 | this.candidateService = candidateService;
26 | }
27 |
28 | @GetMapping("/getall")
29 | public List getAll() {
30 | return this.candidateService.getAll();
31 | }
32 |
33 | @PostMapping("/add")
34 | public Result add(@RequestBody Candidate candidate, String passwordAgain) {
35 | return this.candidateService.add(candidate);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/EmployerController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | import com.tamerm.hrms.business.abstracts.EmployerService;
13 | import com.tamerm.hrms.core.utilities.results.Result;
14 | import com.tamerm.hrms.entities.concretes.Employer;
15 |
16 | @RestController
17 | @RequestMapping("/api/employers")
18 | public class EmployerController {
19 |
20 | private EmployerService employerService;
21 |
22 | @Autowired
23 | public EmployerController(EmployerService employerService) {
24 | this.employerService = employerService;
25 | }
26 |
27 | @GetMapping("/getall")
28 | public List getAll() {
29 | return this.employerService.getAll();
30 | }
31 |
32 | @PostMapping("/add")
33 | public Result add(@RequestBody Employer employer, @RequestBody String passwordAgain) {
34 | return this.employerService.add(employer);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/JobAdvertisementController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | public class JobAdvertisementController {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/JobController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | import com.tamerm.hrms.business.abstracts.JobService;
13 | import com.tamerm.hrms.core.utilities.results.Result;
14 | import com.tamerm.hrms.entities.concretes.Job;
15 |
16 | @RestController
17 | @RequestMapping("/api/jobs")
18 | public class JobController {
19 |
20 | private JobService jobService;
21 |
22 | @Autowired
23 | public JobController(JobService jobService) {
24 | this.jobService = jobService;
25 | }
26 |
27 | @GetMapping("/getall")
28 | public List getAll() {
29 | return this.jobService.getAll();
30 | }
31 |
32 | @PostMapping("/add")
33 | public Result add(@RequestBody Job job) {
34 | return this.jobService.add(job);
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/SystemEmployeeConfirmController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.PostMapping;
5 | import org.springframework.web.bind.annotation.RequestBody;
6 |
7 | import com.tamerm.hrms.business.abstracts.SystemEmployeeConfirmEmployerService;
8 | import com.tamerm.hrms.core.utilities.results.Result;
9 | import com.tamerm.hrms.entities.concretes.SystemEmployeeConfirmEmployer;
10 |
11 | public class SystemEmployeeConfirmController {
12 |
13 | private SystemEmployeeConfirmEmployerService systemEmployeeConfirmEmployerService;
14 |
15 | @Autowired
16 | public SystemEmployeeConfirmController(SystemEmployeeConfirmEmployerService systemEmployeeConfirmEmployerService) {
17 | this.systemEmployeeConfirmEmployerService = systemEmployeeConfirmEmployerService;
18 | }
19 |
20 | @PostMapping("/confirmemployer")
21 | public Result confirm(@RequestBody SystemEmployeeConfirmEmployer systemEmployeeConfirmEmployer) {
22 | return this.systemEmployeeConfirmEmployerService.confirmEmployer(systemEmployeeConfirmEmployer);
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/api/controllers/SystemEmployeeController.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.api.controllers;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | import com.tamerm.hrms.business.abstracts.SystemEmployeeService;
13 | import com.tamerm.hrms.core.utilities.results.Result;
14 | import com.tamerm.hrms.entities.concretes.SystemEmployee;
15 |
16 | @RestController
17 | @RequestMapping("api/systememployee")
18 | public class SystemEmployeeController {
19 |
20 | private SystemEmployeeService systemEmployeeService;
21 |
22 | @Autowired
23 | public SystemEmployeeController(SystemEmployeeService systemEmployeeService) {
24 | this.systemEmployeeService = systemEmployeeService;
25 | }
26 |
27 | @GetMapping("/getall")
28 | public List getAll() {
29 | return this.systemEmployeeService.getAll();
30 | }
31 |
32 | @PostMapping("/add")
33 | public Result add(@RequestBody SystemEmployee systemEmployee, @RequestBody String passwordAgain) {
34 | return this.systemEmployeeService.add(systemEmployee);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/CandidateService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import com.tamerm.hrms.core.utilities.results.Result;
6 | import com.tamerm.hrms.entities.concretes.Candidate;
7 |
8 | public interface CandidateService {
9 | List getAll();
10 | Result add(Candidate candidate);
11 | }
12 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/CandidateVerificationCodeService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 | import com.tamerm.hrms.entities.concretes.Candidate;
5 |
6 | public interface CandidateVerificationCodeService extends VerificationCodeService{
7 | Result add(Candidate candidate);
8 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/EmployerService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import com.tamerm.hrms.core.utilities.results.Result;
6 | import com.tamerm.hrms.entities.concretes.Employer;
7 |
8 | public interface EmployerService {
9 | List getAll();
10 | Result add(Employer employer);
11 | }
12 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/EmployerVerificationCodeService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 | import com.tamerm.hrms.entities.concretes.Employer;
5 |
6 | public interface EmployerVerificationCodeService extends VerificationCodeService {
7 | Result add(Employer employer);
8 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/JobAdvertisementService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | public interface JobAdvertisementService {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/JobService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import com.tamerm.hrms.core.utilities.results.Result;
6 | import com.tamerm.hrms.entities.concretes.Job;
7 |
8 |
9 | public interface JobService {
10 | List getAll();
11 | Result add(Job job);
12 | }
13 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/SystemEmployeeConfirmEmployerService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 | import com.tamerm.hrms.entities.concretes.SystemEmployeeConfirmEmployer;
5 |
6 | public interface SystemEmployeeConfirmEmployerService {
7 | Result confirmEmployer(SystemEmployeeConfirmEmployer systemEmployeeConfirm);
8 | //Result add(SystemEmployeeConfirmEmployer systemEmployeeConfirmEmployer);
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/SystemEmployeeConfirmService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | public interface SystemEmployeeConfirmService {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/SystemEmployeeService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import com.tamerm.hrms.core.utilities.results.Result;
6 | import com.tamerm.hrms.entities.concretes.SystemEmployee;
7 |
8 | public interface SystemEmployeeService {
9 | List getAll();
10 | Result add(SystemEmployee systemEmployee);
11 | }
12 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/UserService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 | import com.tamerm.hrms.dataAccess.abstracts.UserDao;
5 | import com.tamerm.hrms.entities.concretes.User;
6 |
7 | public interface UserService {
8 | Result emailControl(User user);
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/VerificationCodeService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 |
5 | public interface VerificationCodeService {
6 | String createCode();
7 | Result verifyEmail(String code , int userId);
8 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/abstracts/VerificationService.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.abstracts;
2 |
3 | import com.tamerm.hrms.core.utilities.results.Result;
4 |
5 | public interface VerificationService {
6 | Result send(String email,String code);
7 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/CandidateManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 | import java.util.regex.Matcher;
6 | import java.util.regex.Pattern;
7 |
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import com.tamerm.hrms.business.abstracts.CandidateService;
12 | import com.tamerm.hrms.business.abstracts.CandidateVerificationCodeService;
13 | import com.tamerm.hrms.core.utilities.adapters.MernisServiceAdapter;
14 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
15 | import com.tamerm.hrms.core.utilities.results.Result;
16 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
17 | import com.tamerm.hrms.dataAccess.abstracts.CandidateDao;
18 | import com.tamerm.hrms.dataAccess.abstracts.UserDao;
19 | import com.tamerm.hrms.entities.concretes.Candidate;
20 |
21 | @Service
22 | public class CandidateManager extends UserManager implements CandidateService{
23 |
24 | private CandidateDao candidateDao;
25 | private MernisServiceAdapter mernisServiceAdapter;
26 | private CandidateVerificationCodeService candidateVerificationCodeService;
27 |
28 | @Autowired
29 | public CandidateManager(CandidateDao candidateDao, MernisServiceAdapter mernisServiceAdapter, CandidateVerificationCodeService candidateVerificationCodeService, UserDao userDao) {
30 | super(userDao);
31 | this.candidateDao = candidateDao;
32 | this.mernisServiceAdapter = mernisServiceAdapter;
33 | this.candidateVerificationCodeService = candidateVerificationCodeService;
34 | }
35 |
36 | @Override
37 | public List getAll() {
38 | return this.candidateDao.findAll();
39 | }
40 |
41 | @Override
42 | public Result add(Candidate candidate) {
43 |
44 | List results = new ArrayList();
45 | boolean isFail = false;
46 |
47 | Result nullControl = nullControlForAdd(candidate);
48 | Result emailControl = emailControl(candidate);
49 | Result identitynumberControl = identitynumberControl(candidate);
50 | Result mernisVerify = verifyWithMernis(candidate);
51 | // Result passwordAgainControl= passwordAgainControl(candidate);
52 | Result emailRegexControl = emailRegexControl(candidate);
53 |
54 | results.add(nullControl);
55 | results.add(emailRegexControl);
56 | // results.add(passwordAgainControl);
57 | results.add(emailControl);
58 | results.add(identitynumberControl);
59 | results.add(mernisVerify);
60 |
61 | for (var result : results) {
62 | if(!result.isSuccess())
63 | {
64 | isFail = true;
65 | return result;
66 | }
67 | }
68 |
69 | if(isFail == false)
70 | {
71 | this.candidateDao.save(candidate);
72 |
73 | Result isCodeSaved = candidateVerificationCodeService.add(candidate);
74 | if(!isCodeSaved.isSuccess()) {
75 |
76 | return new ErrorResult("Candidate added. Verification mail can't send.");
77 | }else {
78 | return new SuccessResult("Candidate added. Verification mail sent.");
79 | }
80 |
81 | }else {
82 | return new ErrorResult("Candidate can't added");
83 | }
84 |
85 | }
86 |
87 | public Result nullControlForAdd(Candidate candidate) {
88 | if ( candidate.getIdentityNumber() == ""
89 | || candidate.getFirstName() == ""
90 | || candidate.getLastName() == ""
91 | || candidate.getEmail() == ""
92 | || candidate.getPassword() == ""
93 | || candidate.getBirthYear() == 0 )
94 | {
95 | return new ErrorResult("Fill the all required fields.");
96 | }
97 | return new SuccessResult();
98 | }
99 |
100 | public Result verifyWithMernis(Candidate candidate) {
101 | if(!mernisServiceAdapter.verify(candidate)) {
102 | return new ErrorResult("Identity verification is not succeed.");
103 | }
104 | return new SuccessResult();
105 | }
106 |
107 | public Result emailRegexControl(Candidate candidate) {
108 | String regex = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
109 | Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
110 | Matcher matcher = pattern.matcher(candidate.getEmail());
111 | if(!(matcher.find())) {
112 | return new ErrorResult("Please enter a valid e-mail address.");
113 | }
114 | else {
115 | return new SuccessResult();
116 | }
117 | }
118 |
119 | public Result identitynumberControl(Candidate candidate) {
120 | List users = this.candidateDao.findByIdentityNumber(candidate.getIdentityNumber());
121 | if(!(users.isEmpty()))
122 | {
123 | return new ErrorResult("This identity number is already registered.");
124 | }
125 | return new SuccessResult();
126 | }
127 |
128 | // public Result passwordAgainControl(Candidate candidate) {
129 | // if(!(candidate.getPassword().intern() == passwordAgain.intern())) {
130 | // return new ErrorResult("passwords do not match");
131 | // }
132 | // else {
133 | //
134 | // return new SuccessResult();
135 | // }
136 | // }
137 |
138 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/CandidateVerificationCodeManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.time.LocalDate;
4 | import java.util.List;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.CandidateVerificationCodeService;
10 | import com.tamerm.hrms.business.abstracts.VerificationService;
11 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
12 | import com.tamerm.hrms.core.utilities.results.Result;
13 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
14 | import com.tamerm.hrms.dataAccess.abstracts.CandidateVerificationCodeDao;
15 | import com.tamerm.hrms.entities.concretes.Candidate;
16 | import com.tamerm.hrms.entities.concretes.CandidateVerificationCode;
17 |
18 | @Service
19 | public class CandidateVerificationCodeManager implements CandidateVerificationCodeService{
20 |
21 |
22 | CandidateVerificationCodeDao candidateVerificationCodeDao;
23 | VerificationService verificationService;
24 |
25 | @Autowired
26 | public CandidateVerificationCodeManager(CandidateVerificationCodeDao candidateVerificationCodeDao,VerificationService verificationService) {
27 | this.candidateVerificationCodeDao = candidateVerificationCodeDao;
28 | this.verificationService = verificationService;
29 | }
30 |
31 | @Override
32 | public String createCode() {
33 | return "X52FB2KL";
34 | }
35 |
36 | @Override
37 | public Result add(Candidate candidate)
38 | {
39 | String code = createCode();
40 | CandidateVerificationCode candidateVerificationCode = new CandidateVerificationCode();
41 |
42 | candidateVerificationCode.setCode(code);
43 | candidateVerificationCode.setCandidateId(candidate.getId());
44 | candidateVerificationCodeDao.save(candidateVerificationCode);
45 |
46 | return verificationService.send(candidate.getEmail(), code);
47 | }
48 |
49 | public Result verifyEmail(String code, int candidateId) {
50 | List codes = candidateVerificationCodeDao.findByCode(code);
51 | if(!codes.isEmpty())
52 | {
53 | for (CandidateVerificationCode candidateVerificationCode : codes) {
54 | if(candidateVerificationCode.getCandidateId()==candidateId) {
55 | if(candidateVerificationCode.isVerified()==true) return new ErrorResult("This account has already been verified.");
56 | candidateVerificationCode.setVerified(true);
57 | candidateVerificationCode.setVerificationDate(LocalDate.now());
58 | return new SuccessResult("Account is verified.");
59 | }
60 | }
61 |
62 | }
63 | return new ErrorResult("This verification code is invalid.");
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/EmailVerificationManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Service;
5 |
6 | import com.tamerm.hrms.business.abstracts.VerificationService;
7 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
8 | import com.tamerm.hrms.core.utilities.results.Result;
9 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
10 | import com.tamerm.hrms.core.utilities.senders.email.EmailSender;
11 | import com.tamerm.hrms.entities.concretes.User;
12 |
13 | @Service
14 | public class EmailVerificationManager implements VerificationService{
15 |
16 | EmailSender emailSender = new EmailSender();
17 |
18 | @Autowired
19 | public EmailVerificationManager() {
20 |
21 | }
22 |
23 | public Result send(String email,String code)
24 | {
25 | boolean sendEmail = emailSender.sendVerificationCode(email, code);
26 | if(sendEmail == false)
27 | {
28 | return new ErrorResult();
29 |
30 | }else {
31 | return new SuccessResult();
32 | }
33 | }
34 |
35 | // public Result verify(String code, int userId) {
36 | // return this.verificationCodeService.verifyEmail(code, userId);
37 | //
38 | // }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/EmployerManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.EmployerService;
10 | import com.tamerm.hrms.business.abstracts.EmployerVerificationCodeService;
11 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
12 | import com.tamerm.hrms.core.utilities.results.Result;
13 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
14 | import com.tamerm.hrms.dataAccess.abstracts.EmployerDao;
15 | import com.tamerm.hrms.dataAccess.abstracts.UserDao;
16 | import com.tamerm.hrms.entities.concretes.Employer;
17 |
18 | @Service
19 | public class EmployerManager extends UserManager implements EmployerService {
20 |
21 | EmployerDao employerDao;
22 | EmployerVerificationCodeService employerVerificationCodeService;
23 |
24 | @Autowired
25 | public EmployerManager(EmployerDao employerDao, EmployerVerificationCodeService employerVerificationCodeService, UserDao userDao) {
26 | super(userDao);
27 | this.employerDao = employerDao;
28 | this.employerVerificationCodeService = employerVerificationCodeService;
29 | }
30 |
31 | @Override
32 | public List getAll() {
33 | return this.employerDao.findAll();
34 | }
35 |
36 | @Override
37 | public Result add(Employer employer) {
38 |
39 | List results = new ArrayList();
40 | boolean isFail = false;
41 |
42 | Result nullControl = nullControlForAdd(employer);
43 | Result emailControl = emailControl(employer);
44 | // Result passwordAgainControl= passwordAgainControl(employer);
45 | Result employerEmailControl = employerEmailControl(employer);
46 |
47 | results.add(nullControl);
48 | results.add(emailControl);
49 | // results.add(passwordAgainControl);
50 | results.add(employerEmailControl);
51 |
52 | for (var result : results) {
53 | if(!result.isSuccess())
54 | {
55 | isFail = true;
56 | return result;
57 | }
58 | }
59 |
60 | if(isFail == false)
61 | {
62 | this.employerDao.save(employer);
63 | Result isCodeSaved = employerVerificationCodeService.add(employer);
64 | if(!isCodeSaved.isSuccess()) {
65 |
66 | return new ErrorResult("Employer added. Verification mail can't send.");
67 | }else {
68 | return new SuccessResult("Employer added. Verification mail sent.");
69 | }
70 |
71 | }else {
72 | return new ErrorResult();
73 | }
74 |
75 | }
76 |
77 | private Result nullControlForAdd(Employer employer) {
78 | if ( employer.getCompanyName() == ""
79 | || employer.getWebAdress() == ""
80 | || employer.getPhoneNumber() == ""
81 | || employer.getEmail() == ""
82 | || employer.getPassword() == "" )
83 | {
84 | return new ErrorResult("Fill the all required fields.");
85 | }
86 | return new SuccessResult();
87 | }
88 |
89 |
90 | // public Result passwordAgainControl(Employer employer) {
91 | // if(!(employer.getPassword().intern() == passwordAgain.intern())) {
92 | // return new ErrorResult("passwords do not match");
93 | // }
94 | // else {
95 | // return new SuccessResult();
96 | // }
97 | // }
98 |
99 | public Result employerEmailControl(Employer employer) {
100 | String[] emailSplit = employer.getEmail().split("@");
101 | if (!employer.getWebAdress().contains(emailSplit[1])) {
102 | return new ErrorResult("The e-mail address must be an extension of the web address. For example: name@YourDomainName.com");
103 | }
104 | else {
105 | return new SuccessResult();
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/EmployerVerificationCodeManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.time.LocalDate;
4 | import java.util.List;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.EmployerVerificationCodeService;
10 | import com.tamerm.hrms.business.abstracts.VerificationService;
11 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
12 | import com.tamerm.hrms.core.utilities.results.Result;
13 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
14 | import com.tamerm.hrms.dataAccess.abstracts.EmployerVerificationCodeDao;
15 | import com.tamerm.hrms.entities.concretes.Employer;
16 | import com.tamerm.hrms.entities.concretes.EmployerVerificationCode;
17 |
18 | @Service
19 | public class EmployerVerificationCodeManager implements EmployerVerificationCodeService{
20 |
21 | EmployerVerificationCodeDao employerVerificationCodeDao;
22 | VerificationService verificationService;
23 |
24 | @Autowired
25 | public EmployerVerificationCodeManager(EmployerVerificationCodeDao employerVerificationCodeDao,VerificationService verificationService) {
26 | this.employerVerificationCodeDao = employerVerificationCodeDao;
27 | this.verificationService = verificationService;
28 | }
29 |
30 | @Override
31 | public String createCode() {
32 | return "XN4EA84";
33 | }
34 |
35 | @Override
36 | public Result add(Employer employer) {
37 |
38 | String code = createCode();
39 | EmployerVerificationCode employerVerificationCode = new EmployerVerificationCode();
40 | employerVerificationCode.setCode(code);
41 | employerVerificationCode.setEmployerId(employer.getId());
42 | employerVerificationCodeDao.save(employerVerificationCode);
43 | return verificationService.send(employer.getEmail(), code);
44 | }
45 |
46 | public Result verifyEmail(String code, int employerId) {
47 | List codes = employerVerificationCodeDao.findByCode(code);
48 | if(!codes.isEmpty())
49 | {
50 | for (EmployerVerificationCode employerVerificationCode : codes) {
51 | if(employerVerificationCode.getEmployerId()==employerId) {
52 | if(employerVerificationCode.isVerified()==true) return new ErrorResult("This account has already been verified.");
53 | employerVerificationCode.setVerified(true);
54 | employerVerificationCode.setVerificationDate(LocalDate.now());
55 | return new SuccessResult("E-mail is verified.");
56 | }
57 | }
58 | }
59 | return new ErrorResult("This verification code is invalid.");
60 | }
61 |
62 |
63 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/JobAdvertisementManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import com.tamerm.hrms.business.abstracts.JobAdvertisementService;
4 |
5 | public class JobAdvertisementManager implements JobAdvertisementService {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/JobManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.JobService;
10 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
11 | import com.tamerm.hrms.core.utilities.results.Result;
12 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
13 | import com.tamerm.hrms.dataAccess.abstracts.JobDao;
14 | import com.tamerm.hrms.entities.concretes.Candidate;
15 | import com.tamerm.hrms.entities.concretes.Job;
16 |
17 | @Service
18 | public class JobManager implements JobService{
19 |
20 | JobDao jobDao;
21 |
22 | @Autowired
23 | public JobManager(JobDao jobDao) {
24 | this.jobDao = jobDao;
25 | }
26 |
27 | @Override
28 | public List getAll() {
29 | return this.jobDao.findAll();
30 | }
31 |
32 | @Override
33 | public Result add(Job job) {
34 |
35 | List results = new ArrayList();
36 | boolean isFail = false;
37 |
38 | Result nullControl = nullControlForAdd(job);
39 | Result jobControl = jobControl(job);
40 |
41 | results.add(nullControl);
42 | results.add(jobControl);
43 |
44 | for (var result : results) {
45 | if(!result.isSuccess())
46 | {
47 | isFail = true;
48 | return result;
49 | }
50 | }
51 |
52 | if(isFail == false)
53 | {
54 | this.jobDao.save(job);
55 | return new SuccessResult("Job added.");
56 | }else {
57 | return new ErrorResult();
58 | }
59 |
60 | }
61 |
62 | public Result nullControlForAdd(Job job) {
63 | if (job.getTitle() == "")
64 | {
65 | return new ErrorResult("Fill the all required fields.");
66 | }
67 | return new SuccessResult();
68 | }
69 |
70 | public Result jobControl(Job job) {
71 | List titles = this.jobDao.findByTitle(job.getTitle());
72 | if(!(titles.isEmpty()))
73 | {
74 | return new ErrorResult("This title has already exists.");
75 | }
76 | return new SuccessResult();
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/SystemEmployeeConfirmEmployerManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.sql.Date;
4 | import java.time.LocalDate;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.SystemEmployeeConfirmEmployerService;
10 | import com.tamerm.hrms.core.utilities.results.Result;
11 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
12 | import com.tamerm.hrms.dataAccess.abstracts.SystemEmployeeConfirmEmployerDao;
13 | import com.tamerm.hrms.entities.concretes.SystemEmployeeConfirmEmployer;
14 |
15 | @Service
16 | public class SystemEmployeeConfirmEmployerManager implements SystemEmployeeConfirmEmployerService {
17 |
18 | SystemEmployeeConfirmEmployerDao systemEmployeeConfirmEmployerDao;
19 |
20 | @Autowired
21 | public SystemEmployeeConfirmEmployerManager(SystemEmployeeConfirmEmployerDao systemEmployeeConfirmEmployerDao) {
22 | this.systemEmployeeConfirmEmployerDao = systemEmployeeConfirmEmployerDao;
23 | }
24 |
25 | // @Override
26 | // public Result add(SystemEmployeeConfirmEmployer systemEmployeeConfirmEmployer) {
27 | // this.systemEmployeeConfirmEmployerDao.save(systemEmployeeConfirmEmployer);
28 | // return new SuccessResult("System employee confirm employer added");
29 | // }
30 |
31 | @Override
32 | public Result confirmEmployer(SystemEmployeeConfirmEmployer systemEmployeeConfirmEmployer) {
33 | systemEmployeeConfirmEmployer.setConfirmDate(Date.valueOf(LocalDate.now()));
34 | systemEmployeeConfirmEmployer.setConfirmed(true);
35 | systemEmployeeConfirmEmployerDao.save(systemEmployeeConfirmEmployer);
36 |
37 | return new SuccessResult("Employer is confirmed.");
38 | }
39 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/SystemEmployeeConfirmManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | import com.tamerm.hrms.business.abstracts.SystemEmployeeConfirmService;
6 |
7 | @Service
8 | public class SystemEmployeeConfirmManager implements SystemEmployeeConfirmService{
9 |
10 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/SystemEmployeeManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.tamerm.hrms.business.abstracts.SystemEmployeeService;
10 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
11 | import com.tamerm.hrms.core.utilities.results.Result;
12 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
13 | import com.tamerm.hrms.dataAccess.abstracts.SystemEmployeeDao;
14 | import com.tamerm.hrms.entities.concretes.SystemEmployee;
15 |
16 | @Service
17 | public class SystemEmployeeManager implements SystemEmployeeService {
18 |
19 | SystemEmployeeDao systemEmployeeDao;
20 |
21 | @Autowired
22 | public SystemEmployeeManager(SystemEmployeeDao systemEmployeeDao) {
23 | this.systemEmployeeDao=systemEmployeeDao;
24 | }
25 |
26 | @Override
27 | public List getAll() {
28 | return this.systemEmployeeDao.findAll();
29 | }
30 |
31 | @Override
32 | public Result add(SystemEmployee systemEmployee) {
33 | List results = new ArrayList();
34 | boolean isFail = false;
35 | Result nullControl = nullControlForAdd(systemEmployee);
36 | // Result passwordAgainControl= passwordAgainControl(systemEmployee);
37 |
38 | results.add(nullControl);
39 | // results.add(passwordAgainControl);
40 |
41 | for (var result : results) {
42 | if(!result.isSuccess())
43 | {
44 | isFail = true;
45 | return result;
46 | }
47 | }
48 |
49 | if(isFail == false)
50 | {
51 | this.systemEmployeeDao.save(systemEmployee);
52 | return new SuccessResult("System Employee added.");
53 | }
54 |
55 | return new ErrorResult();
56 | }
57 |
58 | public Result nullControlForAdd(SystemEmployee systemEmployee) {
59 | if ( systemEmployee.getFirstName() == ""
60 | || systemEmployee.getLastName() == ""
61 | || systemEmployee.getEmail() == ""
62 | || systemEmployee.getPassword() == "" )
63 | {
64 | return new ErrorResult("Fill the all required fields.");
65 | }
66 | return new SuccessResult();
67 | }
68 |
69 | // public Result passwordAgainControl(SystemEmployee systemEmployee, String passwordAgain) {
70 | // if(!(systemEmployee.getPassword().intern() == passwordAgain.intern())) {
71 | // return new ErrorResult("passwords do not match");
72 | // }
73 | // else {
74 | // return new SuccessResult();
75 | // }
76 | // }
77 |
78 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/business/concretes/UserManager.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.business.concretes;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Service;
6 |
7 | import com.tamerm.hrms.business.abstracts.UserService;
8 | import com.tamerm.hrms.core.utilities.results.ErrorResult;
9 | import com.tamerm.hrms.core.utilities.results.Result;
10 | import com.tamerm.hrms.core.utilities.results.SuccessResult;
11 | import com.tamerm.hrms.dataAccess.abstracts.UserDao;
12 | import com.tamerm.hrms.entities.concretes.User;
13 |
14 | @Service
15 | public class UserManager implements UserService{
16 |
17 | UserDao userDao;
18 |
19 | public UserManager(UserDao userDao) {
20 | this.userDao=userDao;
21 | }
22 |
23 | @Override
24 | public Result emailControl(User user) {
25 | List users = this.userDao.findByEmail(user.getEmail());
26 | if(!(users.isEmpty()))
27 | {
28 | return new ErrorResult("This e-mail is already registered.");
29 | }
30 | return new SuccessResult();
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/adapters/MernisServiceAdapter.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.adapters;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | import com.tamerm.hrms.MernisTest.MernisVerification;
6 | import com.tamerm.hrms.entities.concretes.User;
7 |
8 | @Service
9 | public class MernisServiceAdapter {
10 | public boolean verify(User user)
11 | {
12 | MernisVerification adapter = new MernisVerification();
13 | return adapter.verify(user);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/DataResult.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class DataResult extends Result {
4 |
5 | private T data;
6 |
7 | public DataResult(T data, boolean success, String message) {
8 | super(success, message);
9 | this.data = data;
10 | }
11 |
12 | public DataResult(T data, boolean success) {
13 | super(success);
14 | this.data = data;
15 | }
16 |
17 | public T getData() {
18 | return this.data;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/ErrorDataResult.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class ErrorDataResult extends DataResult {
4 |
5 | public ErrorDataResult(T data, String message) {
6 | super(data, false, message);
7 | }
8 |
9 | public ErrorDataResult(T data) {
10 | super(data,false);
11 | }
12 |
13 | public ErrorDataResult(String message) {
14 | super(null, false, message);
15 | }
16 |
17 | public ErrorDataResult() {
18 | super(null, false);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/ErrorResult.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class ErrorResult extends Result {
4 |
5 | public ErrorResult() {
6 | super(false);
7 | }
8 |
9 | public ErrorResult(String message) {
10 | super(false,message);
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/Result.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class Result {
4 | private boolean success;
5 | private String message;
6 |
7 | public Result(boolean success) {
8 | this.success = success;
9 | }
10 |
11 | public Result(boolean success, String message) {
12 | this(success);
13 | this.message = message;
14 | }
15 |
16 | public boolean isSuccess() {
17 | return this.success;
18 | }
19 |
20 | public String getMessage() {
21 | return this.message;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/SuccessDataResult.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class SuccessDataResult extends DataResult {
4 |
5 | public SuccessDataResult(T data, String message) {
6 | super(data, true, message);
7 | }
8 |
9 | public SuccessDataResult(T data) {
10 | super(data,true);
11 | }
12 |
13 | public SuccessDataResult(String message) {
14 | super(null, true, message);
15 | }
16 |
17 | public SuccessDataResult() {
18 | super(null, true);
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/results/SuccessResult.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.results;
2 |
3 | public class SuccessResult extends Result {
4 |
5 | public SuccessResult() {
6 | super(true);
7 | }
8 |
9 | public SuccessResult(String message) {
10 | super(true,message);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/core/utilities/senders/email/EmailSender.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.core.utilities.senders.email;
2 |
3 | public class EmailSender {
4 | public void send(String email, String message)
5 | {
6 |
7 | }
8 | public boolean sendVerificationCode(String email, String message)
9 | {
10 | return true;
11 | }
12 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/CandidateDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | import com.tamerm.hrms.entities.concretes.Candidate;
8 |
9 | public interface CandidateDao extends JpaRepository {
10 | List findByIdentityNumber(String identityNumber);
11 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/CandidateVerificationCodeDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | import com.tamerm.hrms.entities.concretes.CandidateVerificationCode;
8 |
9 | public interface CandidateVerificationCodeDao extends JpaRepository {
10 | List findByCode(String code);
11 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/CityDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.City;
6 |
7 | public interface CityDao extends JpaRepository {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/EmployerDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.Employer;
6 |
7 | public interface EmployerDao extends JpaRepository {
8 |
9 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/EmployerVerificationCodeDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | import com.tamerm.hrms.entities.concretes.EmployerVerificationCode;
8 |
9 | public interface EmployerVerificationCodeDao extends JpaRepository {
10 | List findByCode(String code);
11 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/JobAdvertisementDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.JobAdvertisement;
6 |
7 | public interface JobAdvertisementDao extends JpaRepository{
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/JobDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | import com.tamerm.hrms.entities.concretes.Job;
8 |
9 | public interface JobDao extends JpaRepository{
10 | List findByTitle(String jobTitle);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/SystemEmployeeConfirmDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.SystemEmployeeConfirm;
6 |
7 | public interface SystemEmployeeConfirmDao extends JpaRepository {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/SystemEmployeeConfirmEmployerDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.SystemEmployeeConfirmEmployer;
6 |
7 | public interface SystemEmployeeConfirmEmployerDao extends JpaRepository {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/SystemEmployeeDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 |
5 | import com.tamerm.hrms.entities.concretes.SystemEmployee;
6 |
7 | public interface SystemEmployeeDao extends JpaRepository {
8 |
9 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | import com.tamerm.hrms.entities.concretes.User;
8 |
9 | public interface UserDao extends JpaRepository {
10 | List findByEmail(String email);
11 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/dataAccess/abstracts/VerificationCodeDao.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.dataAccess.abstracts;
2 |
3 | public interface VerificationCodeDao {
4 |
5 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/Candidate.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 |
6 | import javax.persistence.PrimaryKeyJoinColumn;
7 | import javax.persistence.Table;
8 |
9 | import lombok.AllArgsConstructor;
10 | import lombok.Data;
11 | import lombok.EqualsAndHashCode;
12 | import lombok.NoArgsConstructor;
13 |
14 | @Data
15 | @EqualsAndHashCode(callSuper=false)
16 | @Entity
17 | @AllArgsConstructor
18 | @NoArgsConstructor
19 | @PrimaryKeyJoinColumn(name = "id")
20 | @Table(name = "candidates")
21 | public class Candidate extends User{
22 |
23 | @Column(name = "first_name")
24 | private String firstName;
25 |
26 | @Column(name = "last_name")
27 | private String lastName;
28 |
29 | @Column(name = "identity_number")
30 | private String identityNumber;
31 |
32 | @Column(name = "birth_year")
33 | private int birthYear;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/CandidateVerificationCode.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.JoinColumn;
6 | import javax.persistence.PrimaryKeyJoinColumn;
7 | import javax.persistence.Table;
8 |
9 | import lombok.AllArgsConstructor;
10 | import lombok.Data;
11 | import lombok.EqualsAndHashCode;
12 | import lombok.NoArgsConstructor;
13 |
14 | @Data
15 | @EqualsAndHashCode(callSuper=false)
16 | @Entity
17 | @AllArgsConstructor
18 | @NoArgsConstructor
19 | @PrimaryKeyJoinColumn(name = "id")
20 | @Table(name = "verification_code_candidates")
21 | public class CandidateVerificationCode extends VerificationCode{
22 |
23 | @JoinColumn(name="candidate_id", referencedColumnName = "id", nullable=false)
24 | @Column(name = "candidate_id")
25 | private int candidateId;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/City.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.OneToMany;
11 | import javax.persistence.Table;
12 |
13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
14 |
15 | import lombok.AllArgsConstructor;
16 | import lombok.Data;
17 | import lombok.NoArgsConstructor;
18 |
19 | @Data
20 | @AllArgsConstructor
21 | @NoArgsConstructor
22 | @Table(name = "cities")
23 | @Entity
24 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","products"})
25 | public class City {
26 |
27 | @Id
28 | @GeneratedValue(strategy = GenerationType.IDENTITY)
29 | @Column(name = "id")
30 | private int id;
31 |
32 | @Column(name = "city_name")
33 | private String cityName;
34 |
35 | @OneToMany(mappedBy = "city")
36 | private List jobAdvertisements;
37 |
38 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/Employer.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.OneToMany;
8 | import javax.persistence.PrimaryKeyJoinColumn;
9 | import javax.persistence.Table;
10 |
11 | import lombok.AllArgsConstructor;
12 | import lombok.Data;
13 | import lombok.EqualsAndHashCode;
14 | import lombok.NoArgsConstructor;
15 |
16 | @Data
17 | @EqualsAndHashCode(callSuper=false)
18 | @Entity
19 | @AllArgsConstructor
20 | @NoArgsConstructor
21 | @PrimaryKeyJoinColumn(name = "id")
22 | @Table(name = "employers")
23 | public class Employer extends User{
24 |
25 | @Column(name = "company_name")
26 | private String companyName;
27 |
28 | @Column(name = "web_address")
29 | private String webAdress;
30 |
31 | @Column(name = "phone_number")
32 | private String phoneNumber;
33 |
34 | @OneToMany(mappedBy = "employer")
35 | private List jobAdvertisements;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/EmployerVerificationCode.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.JoinColumn;
6 | import javax.persistence.PrimaryKeyJoinColumn;
7 | import javax.persistence.Table;
8 |
9 | import lombok.AllArgsConstructor;
10 | import lombok.Data;
11 | import lombok.EqualsAndHashCode;
12 | import lombok.NoArgsConstructor;
13 |
14 | @Data
15 | @EqualsAndHashCode(callSuper=false)
16 | @Entity
17 | @AllArgsConstructor
18 | @NoArgsConstructor
19 | @PrimaryKeyJoinColumn(name = "id")
20 | @Table(name = "verification_code_employers")
21 | public class EmployerVerificationCode extends VerificationCode {
22 |
23 | @JoinColumn(name="employer_id", referencedColumnName = "id", nullable=false)
24 | @Column(name = "employer_id")
25 | private int employerId;
26 |
27 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/Job.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.OneToMany;
11 | import javax.persistence.Table;
12 |
13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
14 |
15 | import lombok.AllArgsConstructor;
16 | import lombok.Data;
17 | import lombok.NoArgsConstructor;
18 |
19 | @Data
20 | @AllArgsConstructor
21 | @NoArgsConstructor
22 | @Entity
23 | @Table(name = "jobs")
24 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","products"})
25 | public class Job {
26 |
27 | @Id
28 | @GeneratedValue(strategy = GenerationType.IDENTITY)
29 | @Column(name = "id")
30 | private int id;
31 |
32 | @Column(name = "title")
33 | private String title;
34 |
35 | @OneToMany(mappedBy = "job")
36 | private List jobAdvertisements;
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/JobAdvertisement.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import java.sql.Date;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.JoinColumn;
11 | import javax.persistence.ManyToOne;
12 | import javax.persistence.Table;
13 |
14 | import lombok.AllArgsConstructor;
15 | import lombok.Data;
16 | import lombok.NoArgsConstructor;
17 |
18 | @Data
19 | @AllArgsConstructor
20 | @NoArgsConstructor
21 | @Entity
22 | @Table(name = "job_advertisements")
23 | public class JobAdvertisement {
24 |
25 | @Id
26 | @GeneratedValue(strategy = GenerationType.IDENTITY)
27 | @Column(name = "id")
28 | private int id;
29 |
30 | @Column(name = "description")
31 | private String description;
32 |
33 | @Column(name = "min_salary")
34 | private int minSalary;
35 |
36 | @Column(name = "max_salary")
37 | private int maxSalary;
38 |
39 | @Column(name = "number_of_open_position")
40 | private int numberOfOpenPosition;
41 |
42 | @Column(name = "closing_date")
43 | private Date closingDate;
44 |
45 | @Column(name = "is_active")
46 | private boolean isActive;
47 |
48 | @ManyToOne
49 | @JoinColumn(name="job_id")
50 | private Job job;
51 |
52 | @ManyToOne()
53 | @JoinColumn(name="employer_id")
54 | private Employer employer;
55 |
56 | @ManyToOne
57 | @JoinColumn(name="city_id")
58 | private City city;
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/SystemEmployee.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.PrimaryKeyJoinColumn;
6 | import javax.persistence.Table;
7 |
8 | import lombok.AllArgsConstructor;
9 | import lombok.Data;
10 | import lombok.EqualsAndHashCode;
11 | import lombok.NoArgsConstructor;
12 |
13 | @Data
14 | @EqualsAndHashCode(callSuper=false)
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | @Entity
18 | @PrimaryKeyJoinColumn(name = "id")
19 | @Table(name = "systememployees")
20 | public class SystemEmployee extends User {
21 |
22 | @Column(name = "first_name")
23 | private String firstName;
24 |
25 | @Column(name = "last_name")
26 | private String lastName;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/SystemEmployeeConfirm.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 |
4 | import java.sql.Date;
5 |
6 | import javax.persistence.Column;
7 | import javax.persistence.Entity;
8 | import javax.persistence.GeneratedValue;
9 | import javax.persistence.GenerationType;
10 | import javax.persistence.Id;
11 | import javax.persistence.Inheritance;
12 | import javax.persistence.InheritanceType;
13 | import javax.persistence.JoinColumn;
14 | import javax.persistence.Table;
15 |
16 | import lombok.AllArgsConstructor;
17 | import lombok.Data;
18 | import lombok.NoArgsConstructor;
19 |
20 | @Data
21 | @Entity
22 | @AllArgsConstructor
23 | @NoArgsConstructor
24 | @Inheritance(strategy = InheritanceType.JOINED)
25 | @Table(name = "systememployee_confirms")
26 | public class SystemEmployeeConfirm {
27 |
28 | @Id
29 | @GeneratedValue(strategy = GenerationType.IDENTITY)
30 | @Column(name = "id")
31 | private int id;
32 |
33 | @JoinColumn(name="systememployee_id", referencedColumnName = "id", nullable=false)
34 | @Column(name = "systememployee_id")
35 | private int employeeId;
36 |
37 | @Column(name = "is_confirmed")
38 | private boolean isConfirmed;
39 |
40 | @Column(name = "confirm_date")
41 | private Date confirmDate;
42 |
43 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/SystemEmployeeConfirmEmployer.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.JoinColumn;
6 | import javax.persistence.PrimaryKeyJoinColumn;
7 | import javax.persistence.Table;
8 |
9 | import lombok.AllArgsConstructor;
10 | import lombok.Data;
11 | import lombok.EqualsAndHashCode;
12 | import lombok.NoArgsConstructor;
13 |
14 | @Data
15 | @EqualsAndHashCode(callSuper=false)
16 | @Entity
17 | @AllArgsConstructor
18 | @NoArgsConstructor
19 | @PrimaryKeyJoinColumn(name = "id")
20 | @Table(name = "systememployee_confirm_employers")
21 | public class SystemEmployeeConfirmEmployer extends SystemEmployeeConfirm {
22 |
23 | @JoinColumn(name="employer_id", referencedColumnName = "id", nullable=false)
24 | @Column(name = "employer_id")
25 | private int employerId;
26 |
27 | }
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/User.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.Inheritance;
9 | import javax.persistence.InheritanceType;
10 | import javax.persistence.Table;
11 |
12 | import lombok.AllArgsConstructor;
13 | import lombok.Data;
14 | import lombok.NoArgsConstructor;
15 |
16 | @Data
17 | @Entity
18 | @AllArgsConstructor
19 | @NoArgsConstructor
20 | @Inheritance(strategy = InheritanceType.JOINED)
21 | @Table(name = "users")
22 | public class User {
23 |
24 | @Id
25 | @GeneratedValue(strategy = GenerationType.IDENTITY)
26 | @Column(name = "id")
27 | private int id;
28 |
29 | @Column(name = "email")
30 | private String email;
31 |
32 | @Column(name = "password")
33 | private String password;
34 |
35 | // @Column(name="password_again")
36 | // private String passwordAgain;
37 |
38 | // public User(String email, String password) {
39 | // this.email = email;
40 | // this.password = password;
41 | // }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/hrms/src/main/java/com/tamerm/hrms/entities/concretes/VerificationCode.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms.entities.concretes;
2 |
3 | import java.time.LocalDate;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.Inheritance;
11 | import javax.persistence.InheritanceType;
12 | import javax.persistence.Table;
13 |
14 | import lombok.AllArgsConstructor;
15 | import lombok.Data;
16 | import lombok.NoArgsConstructor;
17 |
18 | @Data
19 | @Entity
20 | @AllArgsConstructor
21 | @NoArgsConstructor
22 | @Inheritance(strategy = InheritanceType.JOINED)
23 | @Table(name = "verification_codes")
24 | public class VerificationCode {
25 |
26 | @Id
27 | @GeneratedValue(strategy = GenerationType.IDENTITY)
28 | @Column(name = "id")
29 | private int id;
30 |
31 | @Column(name = "code")
32 | private String code;
33 |
34 | @Column(name = "is_verified")
35 | private boolean isVerified;
36 |
37 | @Column(name = "verification_date")
38 | private LocalDate verificationDate = LocalDate.now();
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/hrms/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
2 | spring.jpa.hibernate.ddl-auto=validate
3 | spring.jpa.hibernate.show-sql=true
4 | spring.datasource.url=jdbc:postgresql://localhost:5432/hrms
5 | spring.datasource.username=postgres
6 | spring.datasource.password=12345
7 | spring.jpa.properties.javax.persistence.validation.mode = none
--------------------------------------------------------------------------------
/hrms/src/test/java/com/tamerm/hrms/HrmsApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.tamerm.hrms;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class HrmsApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/inheritance/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/inheritance/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/inheritance/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | inheritance
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/inheritance/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/inheritance/src/inheritance/CorporateCustomer.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class CorporateCustomer extends Customer{
4 | String companyName;
5 | String taxNumber;
6 | }
7 |
--------------------------------------------------------------------------------
/inheritance/src/inheritance/Customer.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class Customer {
4 | int id;
5 | String customerNumber;
6 | }
7 | // base/super
--------------------------------------------------------------------------------
/inheritance/src/inheritance/CustomerManager.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class CustomerManager {
4 |
5 | public void add(Customer customer) { // with polymorphism
6 | System.out.println(customer.customerNumber + " kaydedildi.");
7 | }
8 |
9 | public void addMultiple(Customer[] customers) { // with polymorphism
10 | for (Customer customer : customers) {
11 | System.out.println(customer.customerNumber + " kaydedildi");
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/inheritance/src/inheritance/IndividualCustomer.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class IndividualCustomer extends Customer{
4 | String firstName;
5 | String lastName;
6 | String nationalIdentity;
7 | }
8 |
--------------------------------------------------------------------------------
/inheritance/src/inheritance/Main.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 |
7 | IndividualCustomer tamer = new IndividualCustomer();
8 | tamer.customerNumber = "123456";
9 |
10 | CorporateCustomer hepsiBurada = new CorporateCustomer();
11 | hepsiBurada.customerNumber = "654321";
12 |
13 | CustomerManager customerManager = new CustomerManager();
14 |
15 | customerManager.add(tamer);
16 | customerManager.add(hepsiBurada);
17 |
18 | // or
19 |
20 | Customer[] customers = { tamer, hepsiBurada };
21 | customerManager.addMultiple(customers);
22 |
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/inheritance2/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/inheritance2/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/inheritance2/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | inheritance2
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/inheritance2/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/Course.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Course {
4 |
5 | private int id;
6 | private String name;
7 |
8 | public Course(int id, String name) {
9 | super();
10 | this.id = id;
11 | this.name = name;
12 | }
13 |
14 | public int getId() {
15 | return id;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public void setName(String name) {
23 | this.name = name;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/CourseManager.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class CourseManager {
4 |
5 | public void addCourse(Instructor instructor, Course course) {
6 | System.out.println(instructor.getFullname() + " added new course: " + course.getName());
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/Instructor.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Instructor extends User {
4 |
5 | private String about;
6 |
7 | public Instructor(int id, String fullname, String avatar, String email, String password, String about) {
8 | super(id, fullname, avatar, email, password);
9 | this.about = about;
10 | }
11 |
12 | public String getAbout() {
13 | return about;
14 | }
15 |
16 | public void setAbout(String about) {
17 | this.about = about;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/InstructorManager.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class InstructorManager extends UserManager{
4 |
5 | public void giveHomework(Instructor instructor) {
6 | System.out.println(instructor.getFullname() + " added a homework.");
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/Main.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 |
7 | Student tamer = new Student(1,"Tamer Murtazaoglu","avatar.png","contact@tamerm.com","1234","Sakarya University");
8 | Instructor engin = new Instructor(1, "Engin Demirog", "avatar_engin.png", "demo@demo.com", "4321", "Instructor of instructor");
9 |
10 | UserManager userManager = new UserManager();
11 | userManager.register(tamer);
12 | userManager.register(engin);
13 |
14 | System.out.println("-----------------");
15 |
16 | User[] users = {tamer,engin};
17 | userManager.registerMultiply(users);
18 |
19 | userManager.login(tamer);
20 | userManager.logout(tamer);
21 |
22 |
23 | System.out.println("-----------------");
24 |
25 | Course java = new Course(1,"Java/React Camp");
26 |
27 | CourseManager courseManager = new CourseManager();
28 | courseManager.addCourse(engin, java);
29 |
30 | StudentManager studentManager = new StudentManager();
31 | studentManager.buyCourse(tamer, java);
32 |
33 | System.out.println("-----------------");
34 |
35 | InstructorManager instructorManager = new InstructorManager();
36 | instructorManager.giveHomework(engin);
37 |
38 |
39 |
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/Student.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Student extends User{
4 |
5 | private String university;
6 |
7 | public Student(int id, String fullname, String avatar, String email, String password, String university) {
8 | super(id, fullname, avatar, email, password);
9 | this.university = university;
10 | }
11 |
12 | public String getUniversity() {
13 | return university;
14 | }
15 |
16 | public void setUniversity(String university) {
17 | this.university = university;
18 | }
19 |
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/StudentManager.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class StudentManager extends UserManager{
4 |
5 | public void getInfo(Student student) {
6 | System.out.println("Full name: " + student.getFullname());
7 | System.out.println("E-mail: " + student.getEmail());
8 | System.out.println("University: " + student.getUniversity());
9 | }
10 |
11 | public void buyCourse(Student student, Course course) {
12 | System.out.println(student.getFullname() + " buyed a course: " + course.getName());
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/User.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class User {
4 |
5 | private int id;
6 | private String fullname;
7 | private String avatar;
8 | private String email;
9 | private String password;
10 |
11 | public User(int id, String fullname, String avatar, String email, String password) {
12 | super();
13 | this.id = id;
14 | this.fullname = fullname;
15 | this.avatar = avatar;
16 | this.email = email;
17 | this.password = password;
18 | }
19 |
20 | public User() {
21 |
22 | }
23 |
24 | public String getFullname() {
25 | return fullname;
26 | }
27 |
28 | public void setFullname(String fullname) {
29 | this.fullname = fullname;
30 | }
31 |
32 | public String getAvatar() {
33 | return avatar;
34 | }
35 |
36 | public void setAvatar(String avatar) {
37 | this.avatar = avatar;
38 | }
39 |
40 | public String getEmail() {
41 | return email;
42 | }
43 |
44 | public void setEmail(String email) {
45 | this.email = email;
46 | }
47 |
48 | public String getPassword() {
49 | return password;
50 | }
51 |
52 | public void setPassword(String password) {
53 | this.password = password;
54 | }
55 |
56 | public int getId() {
57 | return id;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/inheritance2/src/extraWork/UserManager.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class UserManager {
4 |
5 | public void register(User user) {
6 | System.out.println(user.getFullname() + " registered.");
7 | }
8 |
9 | public void registerMultiply(User[] users) {
10 | for (User user : users) {
11 | System.out.println(user.getFullname() + " registered.");
12 | }
13 | }
14 |
15 | public void login(User user) {
16 | System.out.println(user.getFullname() + " signed in.");
17 | }
18 |
19 | public void logout(User user) {
20 | System.out.println(user.getFullname() + " signed out.");
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/CustomerManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/inheritance2/src/inheritance2/CustomerManager.java
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/DatabaseLogger.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/inheritance2/src/inheritance2/DatabaseLogger.java
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/EmailLogger.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/inheritance2/src/inheritance2/EmailLogger.java
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/FileLogger.java:
--------------------------------------------------------------------------------
1 | package inheritance2;
2 |
3 | public class FileLogger extends Logger{
4 |
5 | @Override
6 | public void log() {
7 | System.out.println("Dosyaya kaydedildi.");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/LogManager.java:
--------------------------------------------------------------------------------
1 | package inheritance2;
2 |
3 | public class LogManager {
4 |
5 |
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/Logger.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/inheritance2/src/inheritance2/Logger.java
--------------------------------------------------------------------------------
/inheritance2/src/inheritance2/Main.java:
--------------------------------------------------------------------------------
1 | package inheritance2;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 |
7 | CustomerManager customerManager = new CustomerManager();
8 | customerManager.add(new EmailLogger());
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/innerclassAndStatic/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/innerclassAndStatic/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/innerclassAndStatic/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | innerclassAndStatic
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/innerclassAndStatic/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/innerclassAndStatic/src/innerclassAndStatic/DatabaseHelper.java:
--------------------------------------------------------------------------------
1 | package innerclassAndStatic;
2 |
3 | public class DatabaseHelper {
4 |
5 | public static class Crud {
6 | public static void Delete() {}
7 | public static void Update() {}
8 | }
9 |
10 | public static class Connection {
11 | public static void createConnection() {}
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/innerclassAndStatic/src/innerclassAndStatic/Main.java:
--------------------------------------------------------------------------------
1 | package innerclassAndStatic;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | ProductManager manager = new ProductManager();
7 | Product product = new Product();
8 | product.id = 1;
9 | product.name = "Laptop";
10 | product.price = 7500;
11 | manager.add(product);
12 |
13 | DatabaseHelper.Connection.createConnection();
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/innerclassAndStatic/src/innerclassAndStatic/Product.java:
--------------------------------------------------------------------------------
1 | package innerclassAndStatic;
2 |
3 | public class Product {
4 | int id;
5 | String name;
6 | double price;
7 | }
8 |
--------------------------------------------------------------------------------
/innerclassAndStatic/src/innerclassAndStatic/ProductManager.java:
--------------------------------------------------------------------------------
1 | package innerclassAndStatic;
2 |
3 | public class ProductManager {
4 |
5 | void add(Product product) {
6 | if (ProductValidator.isValid(product)) {
7 | System.out.println("Product added.");
8 | } else {
9 | System.out.println("Product can't added but this is not valid.");
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/innerclassAndStatic/src/innerclassAndStatic/ProductValidator.java:
--------------------------------------------------------------------------------
1 | package innerclassAndStatic;
2 |
3 | public class ProductValidator {
4 |
5 | static boolean isValid(Product product) {
6 | if (product.price >= 0 && !product.name.isEmpty()) {
7 | return true;
8 | } else {
9 | return false;
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/interfaces/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/interfaces/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/interfaces/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | interfaces
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/interfaces/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/Customer.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class Customer {
4 | private int id;
5 | private String firstName;
6 | private String lastName;
7 |
8 | public Customer() {
9 |
10 | }
11 |
12 | public Customer(int id, String firstName, String lastName) {
13 | super();
14 | this.id = id;
15 | this.firstName = firstName;
16 | this.lastName = lastName;
17 | }
18 |
19 | public int getId() {
20 | return id;
21 | }
22 |
23 | public void setId(int id) {
24 | this.id = id;
25 | }
26 |
27 | public String getFirstName() {
28 | return firstName;
29 | }
30 |
31 | public void setFirstName(String firstName) {
32 | this.firstName = firstName;
33 | }
34 |
35 | public String getLastName() {
36 | return lastName;
37 | }
38 |
39 | public void setLastName(String lastName) {
40 | this.lastName = lastName;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/CustomerManager.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class CustomerManager {
4 | private Logger[] loggers;
5 |
6 | public CustomerManager(Logger[] loggers) {
7 | this.loggers = loggers;
8 | }
9 |
10 | public void add(Customer customer) {
11 | System.out.println("Customer added: " + customer.getFirstName());
12 | Utils.runLoggers(loggers, customer.getFirstName());
13 | }
14 |
15 | public void delete(Customer customer) {
16 | System.out.println("Customer deleted: " + customer.getFirstName());
17 | Utils.runLoggers(loggers, customer.getFirstName());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/DatabaseLogger.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class DatabaseLogger implements Logger {
4 |
5 | @Override
6 | public void log(String message) {
7 | System.out.println("Database logged: " + message);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/FileLogger.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class FileLogger implements Logger {
4 |
5 | @Override
6 | public void log(String message) {
7 | System.out.println("Logged to file: " + message);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/Logger.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public interface Logger {
4 | void log(String message);
5 | }
6 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/Main.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | Logger[] loggers = {new SmsLogger(), new DatabaseLogger(), new FileLogger()};
7 |
8 | Customer customer = new Customer(1, "Tamer", "Murtazaoglu");
9 |
10 | CustomerManager customerManager = new CustomerManager(loggers);
11 | customerManager.add(customer);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/SmsLogger.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class SmsLogger implements Logger{
4 |
5 | @Override
6 | public void log(String message) {
7 | System.out.println("SMS sent: " + message);
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces/Utils.java:
--------------------------------------------------------------------------------
1 | package interfaces;
2 |
3 | public class Utils {
4 | public static void runLoggers(Logger[] loggers, String message) {
5 | for (Logger logger : loggers) {
6 | logger.log(message);
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces2/CustomerDal.java:
--------------------------------------------------------------------------------
1 | package interfaces2;
2 |
3 | public interface CustomerDal {
4 | void add();
5 | }
--------------------------------------------------------------------------------
/interfaces/src/interfaces2/CustomerManager.java:
--------------------------------------------------------------------------------
1 | package interfaces2;
2 |
3 | public class CustomerManager {
4 |
5 | CustomerDal[] customerDals;
6 | public CustomerManager(CustomerDal[] customerDals) {
7 | this.customerDals = customerDals;
8 | }
9 | void add() {
10 | for (CustomerDal customerDal : customerDals) {
11 | customerDal.add();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces2/Main.java:
--------------------------------------------------------------------------------
1 | package interfaces2;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 |
7 | CustomerDal oracleCustomerDal = new OracleCustomerDal();
8 | CustomerDal mySqlCustomerDal = new MySqlCustomerDal();
9 | CustomerDal[] customerDals = {oracleCustomerDal, mySqlCustomerDal};
10 |
11 | CustomerManager customerManager = new CustomerManager(customerDals);
12 | customerManager.add();
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces2/MySqlCustomerDal.java:
--------------------------------------------------------------------------------
1 | package interfaces2;
2 |
3 | public class MySqlCustomerDal implements CustomerDal{
4 |
5 | @Override
6 | public void add() {
7 | System.out.println("Customer added to MySql Db");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/interfaces/src/interfaces2/OracleCustomerDal.java:
--------------------------------------------------------------------------------
1 | package interfaces2;
2 |
3 | public class OracleCustomerDal implements CustomerDal{
4 |
5 | @Override
6 | public void add() {
7 | System.out.println("Customer added to Oracle Db");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Eatable.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public interface Eatable {
4 | void eat();
5 | }
6 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Main.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | // TODO Auto-generated method stub
7 |
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/OutsideWorker.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public class OutsideWorker implements Workable{
4 |
5 | @Override
6 | public void work() {
7 | // TODO Auto-generated method stub
8 |
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Payable.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public interface Payable {
4 | void pay();
5 | }
6 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Robot.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public class Robot implements Workable {
4 |
5 | @Override
6 | public void work() {
7 | // TODO Auto-generated method stub
8 |
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Workable.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public interface Workable {
4 | void work();
5 | }
6 |
--------------------------------------------------------------------------------
/interfaces/src/multi_implementation/Worker.java:
--------------------------------------------------------------------------------
1 | package multi_implementation;
2 |
3 | public class Worker implements Eatable, Workable, Payable {
4 |
5 | @Override
6 | public void eat() {
7 | // TODO Auto-generated method stub
8 |
9 | }
10 |
11 | @Override
12 | public void pay() {
13 | // TODO Auto-generated method stub
14 |
15 | }
16 |
17 | @Override
18 | public void work() {
19 | // TODO Auto-generated method stub
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/intro/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/intro/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | intro
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/intro/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/intro/bin/intro/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/intro/bin/intro/Main.class
--------------------------------------------------------------------------------
/intro/bin/someSamples/IsPrimeNumberFunction.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/intro/bin/someSamples/IsPrimeNumberFunction.class
--------------------------------------------------------------------------------
/intro/src/intro/Main.java:
--------------------------------------------------------------------------------
1 | package intro;
2 |
3 | public class Main {
4 |
5 | public static void main(String[] args) {
6 | System.out.println("Hello world");
7 |
8 | String[] credits = {
9 | "A", "B", "C", "D"
10 | };
11 |
12 | for(String credit : credits)
13 | {
14 | System.out.println(credit);
15 | }
16 |
17 | for(int i = 0; i < credits.length; i++)
18 | {
19 | System.out.println(credits[i]);
20 | }
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/intro/src/someSamples/IsPrimeNumberFunction.java:
--------------------------------------------------------------------------------
1 | package someSamples;
2 |
3 |
4 | public class IsPrimeNumberFunction {
5 |
6 | public static void main(String[] args) {
7 | int number = 3;
8 | if(isPrimeNumber2(number)) {
9 | System.out.println("Number is prime.");
10 | }
11 | else {
12 | System.out.println("Number is not prime.");
13 | }
14 | }
15 |
16 | public static boolean isPrimeNumber(int number) {
17 | for(int i=number; i>0; i--)
18 | {
19 | if( (i != number && i != 1) && (number % i == 0) ) return false;
20 | }
21 | return true;
22 | }
23 |
24 | public static boolean isPrimeNumber2(int number) { // different algorithm
25 | for(int i=2; i
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | loginAndAuthSystemWithRegex
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/Main.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/Main.java
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/abstracts/EmailVerificationService.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.abstracts;
2 |
3 | import loginAndAuthSystemWithRegex.entities.concretes.User;
4 |
5 | public interface EmailVerificationService {
6 | void sendVerificationMail(User user);
7 | boolean verify(User user);
8 | }
9 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/abstracts/UserService.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.abstracts;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import loginAndAuthSystemWithRegex.entities.concretes.User;
7 |
8 | public interface UserService {
9 |
10 |
11 | void register(User user);
12 | void login(String username, String password);
13 | void logout(User user);
14 | void registerWithService(User user);
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/abstracts/ValidateService.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.abstracts;
2 |
3 | public interface ValidateService {
4 | boolean validateEmail(String value);
5 | }
6 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/concretes/EmailVerificationManager.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.concretes;
2 |
3 | import loginAndAuthSystemWithRegex.business.abstracts.EmailVerificationService;
4 | import loginAndAuthSystemWithRegex.entities.concretes.User;
5 |
6 | public class EmailVerificationManager implements EmailVerificationService{
7 |
8 | @Override
9 | public boolean verify(User user) {
10 | return true;
11 | }
12 |
13 | @Override
14 | public void sendVerificationMail(User user) {
15 | System.out.println("Verification mail sent to: " + user.getEmail());
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/concretes/RegexValidateManager.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.concretes;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | import loginAndAuthSystemWithRegex.business.abstracts.ValidateService;
7 |
8 | public class RegexValidateManager implements ValidateService{
9 |
10 | String regex;
11 | String text;
12 |
13 | Pattern pattern;
14 | Matcher matcher;
15 |
16 | public RegexValidateManager() {
17 |
18 | }
19 |
20 | @Override
21 | public boolean validateEmail(String email) {
22 | this.text = email;
23 | String regex = "^(.+)@(.+)$";
24 | pattern = Pattern.compile(regex);
25 | matcher = pattern.matcher(text);
26 | return matcher.matches();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/business/concretes/UserManager.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.business.concretes;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import loginAndAuthSystemWithRegex.business.abstracts.UserService;
7 | import loginAndAuthSystemWithRegex.business.abstracts.ValidateService;
8 | import loginAndAuthSystemWithRegex.core.abstracts.RegisterService;
9 | import loginAndAuthSystemWithRegex.core.concretes.GoogleRegisterServiceAdapter;
10 | import loginAndAuthSystemWithRegex.dataAccess.abstracts.UserDao;
11 | import loginAndAuthSystemWithRegex.entities.concretes.User;
12 |
13 | public class UserManager implements UserService {
14 |
15 | ValidateService valiadteService;
16 | UserDao userDao;
17 | EmailVerificationManager emailVerificationManager;
18 | RegisterService registerService;
19 |
20 | List users = new ArrayList(); // users are temporarily stored
21 | User userByRegisterService;
22 |
23 | public UserManager(UserDao userDao, ValidateService validateService, EmailVerificationManager emailVerificationManager, RegisterService registerService) {
24 | super();
25 | this.userDao = userDao;
26 | this.valiadteService = validateService;
27 | this.emailVerificationManager = emailVerificationManager;
28 | this.registerService = registerService;
29 | }
30 |
31 | @Override
32 | public void register(User user) {
33 |
34 | if( !findEmail(user.getEmail())) {
35 | if(valiadteService.validateEmail(user.getEmail()))
36 | {
37 | if( user.getPassword().length() >= 6 && user.getFirstName().length() >= 2 && user.getLastName().length() >= 2 )
38 | {
39 | emailVerificationManager.sendVerificationMail(user);
40 | if(emailVerificationManager.verify(user))
41 | {
42 | userDao.register(user);
43 | users.add(user);
44 | return;
45 | }
46 | }
47 | else
48 | {
49 | System.out.println("Registration failed but name/firstname is must be min. 3 characters and password min. 5 characters.");
50 | }
51 | }
52 | else
53 | {
54 | System.out.println("Registration failed but mail adress is not valid.");
55 | }
56 | }
57 | else {
58 | System.out.println("Registration failed but e-mail address is already registered.");
59 | }
60 | }
61 |
62 | public boolean findEmail(String email) {
63 | for (User user : users) {
64 | if(user.getEmail() == email) return true;
65 | }
66 | return false;
67 |
68 | }
69 |
70 | @Override
71 | public void login(String email, String password) {
72 | for (User user : users) {
73 | if(user.getEmail() == email && user.getPassword() == password)
74 | {
75 | userDao.login(user);
76 | return;
77 | }
78 | }
79 | System.out.println("Login unsuccessful, email or password is not true.");
80 | }
81 |
82 | @Override
83 | public void logout(User user) {
84 | for (User userx : users) {
85 | if(user == userx) {
86 | userDao.logout(user);
87 | users.remove(user);
88 | return;
89 | }
90 | }
91 | System.out.println("Logout error: This user did not logged in.");
92 | }
93 |
94 | @Override
95 | public void registerWithService(User user) {
96 | registerService.register(user);
97 | users.add(user);
98 | }
99 |
100 |
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/core/abstracts/RegisterService.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.core.abstracts;
2 |
3 | import loginAndAuthSystemWithRegex.entities.concretes.User;
4 |
5 | public interface RegisterService {
6 |
7 | void register(User user);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/core/concretes/GoogleRegisterServiceAdapter.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.core.concretes;
2 |
3 | import loginAndAuthSystemWithRegex.core.abstracts.RegisterService;
4 | import loginAndAuthSystemWithRegex.entities.concretes.User;
5 | import loginAndAuthSystemWithRegex.googleRegisterServiceReference.GoogleRegisterServiceManager;
6 |
7 | public class GoogleRegisterServiceAdapter implements RegisterService {
8 |
9 | @Override
10 | public void register(User user) {
11 |
12 | GoogleRegisterServiceManager googleRegisterServiceManager = new GoogleRegisterServiceManager();
13 | boolean registration = googleRegisterServiceManager.registerUserFromGoogle(user.getEmail(), user.getPassword());
14 | if(registration) {
15 | System.out.println("Registration with Google successful!");
16 | }else {
17 | System.out.println("Registration with Google failed.");
18 | }
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/dataAccess/abstracts/UserDao.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.dataAccess.abstracts;
2 |
3 | import loginAndAuthSystemWithRegex.entities.concretes.User;
4 |
5 | public interface UserDao {
6 | void register(User user);
7 | void login(User user);
8 | void logout(User user);
9 | }
10 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/dataAccess/concretes/HibernateUserDao.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.dataAccess.concretes;
2 |
3 | import loginAndAuthSystemWithRegex.dataAccess.abstracts.UserDao;
4 | import loginAndAuthSystemWithRegex.entities.concretes.User;
5 |
6 | public class HibernateUserDao implements UserDao {
7 |
8 | @Override
9 | public void register(User user) {
10 | System.out.println("Registration successfully for this e-mail: " + user.getEmail());
11 | }
12 |
13 | @Override
14 | public void login(User user) {
15 | System.out.println(user.getFirstName() + " logged in.");
16 |
17 | }
18 |
19 | @Override
20 | public void logout(User user) {
21 | System.out.println(user.getFirstName() + " logged out.");
22 |
23 | }
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/entities/abstracts/Entity.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.entities.abstracts;
2 |
3 | public interface Entity {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/entities/concretes/User.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.entities.concretes;
2 |
3 | public class User{
4 | int id;
5 | String firstName;
6 | String lastName;
7 | String email;
8 | String password;
9 |
10 | public User() {
11 |
12 | }
13 |
14 | public User(int id, String firstName, String lastName, String email, String password) {
15 | super();
16 | this.id = id;
17 | this.firstName = firstName;
18 | this.lastName = lastName;
19 | this.email = email;
20 | this.password = password;
21 | }
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 |
28 | public void setId(int id) {
29 | this.id = id;
30 | }
31 |
32 |
33 | public String getFirstName() {
34 | return firstName;
35 | }
36 |
37 |
38 | public void setFirstName(String firstName) {
39 | this.firstName = firstName;
40 | }
41 |
42 |
43 | public String getLastName() {
44 | return lastName;
45 | }
46 |
47 |
48 | public void setLastName(String lastName) {
49 | this.lastName = lastName;
50 | }
51 |
52 |
53 | public String getEmail() {
54 | return email;
55 | }
56 |
57 |
58 | public void setEmail(String email) {
59 | this.email = email;
60 | }
61 |
62 |
63 | public String getPassword() {
64 | return password;
65 | }
66 |
67 |
68 | public void setPassword(String password) {
69 | this.password = password;
70 | }
71 |
72 |
73 |
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/loginAndAuthSystemWithRegex/src/loginAndAuthSystemWithRegex/googleRegisterServiceReference/GoogleRegisterServiceManager.java:
--------------------------------------------------------------------------------
1 | package loginAndAuthSystemWithRegex.googleRegisterServiceReference;
2 |
3 | public class GoogleRegisterServiceManager {
4 |
5 | public boolean registerUserFromGoogle(String gmail, String password) {
6 | if(!gmail.isEmpty() && !password.isEmpty())
7 | {
8 | return true;
9 | }
10 | return false;
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/nLayeredDemo/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/nLayeredDemo/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/nLayeredDemo/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | nLayeredDemo
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/nLayeredDemo/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/Main.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo;
2 |
3 | import nLayeredDemo.business.abstracts.ProductService;
4 | import nLayeredDemo.business.concretes.ProductManager;
5 | import nLayeredDemo.core.JLoggerServiceAdapter;
6 | import nLayeredDemo.dataAccess.concretes.AbcProductDao;
7 | import nLayeredDemo.entities.concretes.Product;
8 |
9 | public class Main {
10 |
11 | public static void main(String[] args) {
12 | Product product = new Product(1,2,"Apple",12,50);
13 | // ToDo: Improve with Spring IoC
14 | ProductService productService = new ProductManager(new AbcProductDao(),
15 | new JLoggerServiceAdapter());
16 | productService.add(product);
17 |
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/business/abstracts/ProductService.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import nLayeredDemo.entities.concretes.Product;
6 |
7 | public interface ProductService {
8 | void add(Product product);
9 | List getAll();
10 | }
11 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/business/concretes/ProductManager.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.business.concretes;
2 |
3 | import java.util.List;
4 |
5 | import nLayeredDemo.business.abstracts.ProductService;
6 | import nLayeredDemo.core.LoggerService;
7 | import nLayeredDemo.dataAccess.abstracts.ProductDao;
8 | import nLayeredDemo.entities.concretes.Product;
9 | import nLayeredDemo.jLogger.JLoggerManager;
10 |
11 | public class ProductManager implements ProductService{
12 |
13 | private ProductDao productDao;
14 | private LoggerService loggerService;
15 |
16 | public ProductManager(ProductDao productDao, LoggerService loggerService) {
17 | this.productDao = productDao;
18 | this.loggerService = loggerService;
19 | }
20 |
21 | @Override
22 | public void add(Product product) {
23 | if (product.getCategoryId() == 1) {
24 | System.out.println("Adding products to this category is not allowed.");
25 | return;
26 | }
27 |
28 | this.productDao.add(product);
29 | this.loggerService.logToSystem("Logged!");
30 |
31 | }
32 |
33 | @Override
34 | public List getAll() {
35 | // TODO Auto-generated method stub
36 | return null;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/core/JLoggerServiceAdapter.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.core;
2 |
3 | import nLayeredDemo.jLogger.JLoggerManager;
4 |
5 | public class JLoggerServiceAdapter implements LoggerService {
6 |
7 | @Override
8 | public void logToSystem(String message) {
9 |
10 | JLoggerManager manager = new JLoggerManager();
11 | manager.log(message);
12 |
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/core/LoggerService.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.core;
2 |
3 | public interface LoggerService {
4 | void logToSystem(String message);
5 | }
6 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/dataAccess/abstracts/ProductDao.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import nLayeredDemo.entities.concretes.Product;
6 |
7 | public interface ProductDao {
8 | void add(Product product);
9 | void update(Product product);
10 | void delete(Product product);
11 | Product get(int id);
12 | List getAll();
13 | }
14 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/dataAccess/concretes/AbcProductDao.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.dataAccess.concretes;
2 |
3 | import java.util.List;
4 |
5 | import nLayeredDemo.dataAccess.abstracts.ProductDao;
6 | import nLayeredDemo.entities.concretes.Product;
7 |
8 | public class AbcProductDao implements ProductDao {
9 |
10 | @Override
11 | public void add(Product product) {
12 | System.out.println("Added with Abc: " + product.getName());
13 |
14 | }
15 |
16 | @Override
17 | public void update(Product product) {
18 | // TODO Auto-generated method stub
19 |
20 | }
21 |
22 | @Override
23 | public void delete(Product product) {
24 | // TODO Auto-generated method stub
25 |
26 | }
27 |
28 | @Override
29 | public Product get(int id) {
30 | // TODO Auto-generated method stub
31 | return null;
32 | }
33 |
34 | @Override
35 | public List getAll() {
36 | // TODO Auto-generated method stub
37 | return null;
38 | }
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/dataAccess/concretes/HibernateProductDao.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.dataAccess.concretes;
2 |
3 | import java.util.List;
4 |
5 | import nLayeredDemo.dataAccess.abstracts.ProductDao;
6 | import nLayeredDemo.entities.concretes.Product;
7 |
8 | public class HibernateProductDao implements ProductDao{
9 |
10 | @Override
11 | public void add(Product product) {
12 | System.out.println("Added with Hybernate: " + product.getName());
13 |
14 | }
15 |
16 | @Override
17 | public void update(Product product) {
18 | // TODO Auto-generated method stub
19 |
20 | }
21 |
22 | @Override
23 | public void delete(Product product) {
24 | // TODO Auto-generated method stub
25 |
26 | }
27 |
28 | @Override
29 | public Product get(int id) {
30 | // TODO Auto-generated method stub
31 | return null;
32 | }
33 |
34 | @Override
35 | public List getAll() {
36 | // TODO Auto-generated method stub
37 | return null;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/entities/abstracts/Entity.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.entities.abstracts;
2 |
3 | public interface Entity {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/entities/concretes/Product.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.entities.concretes;
2 |
3 | import nLayeredDemo.entities.abstracts.Entity;
4 |
5 | public class Product implements Entity {
6 | private int id;
7 | private int categoryId;
8 | private String name;
9 | private double unitPrice;
10 | private int unitsInStock;
11 |
12 | public Product() {}
13 |
14 | public Product(int id, int categoryId, String name, double unitPrice, int unitsInStock) {
15 | super();
16 | this.id = id;
17 | this.categoryId = categoryId;
18 | this.name = name;
19 | this.unitPrice = unitPrice;
20 | this.unitsInStock = unitsInStock;
21 | }
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 | public void setId(int id) {
28 | this.id = id;
29 | }
30 |
31 | public int getCategoryId() {
32 | return categoryId;
33 | }
34 |
35 | public void setCategoryId(int categoryId) {
36 | this.categoryId = categoryId;
37 | }
38 |
39 | public String getName() {
40 | return name;
41 | }
42 |
43 | public void setName(String name) {
44 | this.name = name;
45 | }
46 |
47 | public double getUnitPrice() {
48 | return unitPrice;
49 | }
50 |
51 | public void setUnitPrice(double unitPrice) {
52 | this.unitPrice = unitPrice;
53 | }
54 |
55 | public int getUnitsInStock() {
56 | return unitsInStock;
57 | }
58 |
59 | public void setUnitsInStock(int unitsInStock) {
60 | this.unitsInStock = unitsInStock;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/nLayeredDemo/src/nLayeredDemo/jLogger/JLoggerManager.java:
--------------------------------------------------------------------------------
1 | package nLayeredDemo.jLogger;
2 |
3 | public class JLoggerManager {
4 | public void log(String message)
5 | {
6 | System.out.println("Logged with J Logger, with this message: " + message);
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/northwind/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/northwind/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.6";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/northwind/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/northwind/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/northwind/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/northwind/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.4.5
9 |
10 |
11 | kodlamaio
12 | northwind
13 | 0.0.1-SNAPSHOT
14 | northwind
15 | Demo project for Spring Boot
16 |
17 | 11
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-data-jpa
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-starter-web
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-devtools
32 | runtime
33 | true
34 |
35 |
36 | org.postgresql
37 | postgresql
38 | runtime
39 |
40 |
41 | org.projectlombok
42 | lombok
43 | true
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-test
48 | test
49 |
50 |
51 | io.springfox
52 | springfox-swagger2
53 | 2.9.2
54 |
55 |
56 | io.springfox
57 | springfox-swagger-ui
58 | 2.9.2
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.boot
66 | spring-boot-maven-plugin
67 |
68 |
69 |
70 | org.projectlombok
71 | lombok
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/NorthwindApplication.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.Bean;
6 |
7 | import springfox.documentation.builders.RequestHandlerSelectors;
8 | import springfox.documentation.spi.DocumentationType;
9 | import springfox.documentation.spring.web.plugins.Docket;
10 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
11 |
12 | @SpringBootApplication
13 | @EnableSwagger2
14 | public class NorthwindApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(NorthwindApplication.class, args);
18 | }
19 |
20 | @Bean
21 | public Docket api() {
22 | return new Docket(DocumentationType.SWAGGER_2)
23 | .select()
24 | .apis(RequestHandlerSelectors.basePackage("kodlamaio.northwind"))
25 | .build();
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/api/controllers/ProductsController.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.api.controllers;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PostMapping;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RequestParam;
11 | import org.springframework.web.bind.annotation.RestController;
12 |
13 | import kodlamaio.northwind.business.abstracts.ProductService;
14 | import kodlamaio.northwind.core.utilities.results.DataResult;
15 | import kodlamaio.northwind.core.utilities.results.Result;
16 | import kodlamaio.northwind.entities.concretes.Product;
17 |
18 | @RestController
19 | @RequestMapping("api/products")
20 | public class ProductsController {
21 |
22 | private ProductService productService;
23 |
24 | @Autowired
25 | public ProductsController(ProductService productService) {
26 | super();
27 | this.productService = productService;
28 | }
29 |
30 | @GetMapping("/getall")
31 | public DataResult> getAll() {
32 | return this.productService.getAll();
33 | }
34 |
35 | @PostMapping("/add")
36 | public Result add(@RequestBody Product product) {
37 | return this.productService.add(product);
38 |
39 | }
40 |
41 | @GetMapping("/getByProductName")
42 | public DataResult getByProductName(@RequestParam String productName) {
43 | return this.productService.getByProductName(productName);
44 | }
45 |
46 | @GetMapping("/getByProductNameAndCategoryId")
47 | public DataResult getByProductNameAndCategoryId(@RequestParam("productName") String productName, @RequestParam("categoryId") int categoryId) {
48 | return this.productService.getByProductNameAndCategoryId(productName, categoryId);
49 | }
50 |
51 | @GetMapping("/getByProductNameContains")
52 | DataResult> getByProductNameContains(@RequestParam String productName) {
53 | return this.productService.getByProductNameContains(productName);
54 | }
55 |
56 | @GetMapping("/getAllByPage")
57 | DataResult> getAll(int pageNo, int pageSize) {
58 | return this.productService.getAll(pageNo-1, pageSize);
59 | }
60 |
61 | @GetMapping("/getAllDesc")
62 | public DataResult> getAllSorted() {
63 | return this.productService.getAllSorted();
64 | }
65 |
66 |
67 |
68 |
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/business/abstracts/ProductService.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.business.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import kodlamaio.northwind.core.utilities.results.DataResult;
6 | import kodlamaio.northwind.core.utilities.results.Result;
7 | import kodlamaio.northwind.entities.concretes.Product;
8 |
9 | public interface ProductService {
10 |
11 | DataResult> getAll();
12 |
13 | DataResult> getAllSorted();
14 |
15 | DataResult> getAll(int pageNo, int pageSize);
16 |
17 | Result add(Product product);
18 |
19 | DataResult getByProductName(String productName);
20 |
21 | DataResult getByProductNameAndCategoryId(String productName, int categoryId);
22 |
23 | DataResult> getByProductNameOrCategoryId(String productName, int categoryId);
24 |
25 | DataResult> getByCategoryIn(List categories);
26 |
27 | DataResult> getByProductNameContains(String productName);
28 |
29 | DataResult> getByProductNameStartsWith(String productName);
30 |
31 | DataResult> getByNameAndCategory(String productName, int categoryId);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/business/concretes/ProductManager.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.business.concretes;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.data.domain.PageRequest;
7 | import org.springframework.data.domain.Pageable;
8 | import org.springframework.data.domain.Sort;
9 | import org.springframework.stereotype.Service;
10 |
11 | import kodlamaio.northwind.business.abstracts.ProductService;
12 | import kodlamaio.northwind.core.utilities.results.DataResult;
13 | import kodlamaio.northwind.core.utilities.results.Result;
14 | import kodlamaio.northwind.core.utilities.results.SuccessDataResult;
15 | import kodlamaio.northwind.core.utilities.results.SuccessResult;
16 | import kodlamaio.northwind.dataAccess.abstracts.ProductDao;
17 | import kodlamaio.northwind.entities.concretes.Product;
18 |
19 | @Service
20 | public class ProductManager implements ProductService{
21 |
22 | private ProductDao productDao;
23 |
24 | @Autowired
25 | public ProductManager(ProductDao productDao) {
26 | super();
27 | this.productDao = productDao;
28 | }
29 |
30 | @Override
31 | public DataResult> getAll() {
32 | return new SuccessDataResult>
33 | (this.productDao.findAll(),"Data listed.");
34 | }
35 |
36 | @Override
37 | public Result add(Product product) {
38 | this.productDao.save(product);
39 | return new SuccessResult("Product added.");
40 | }
41 |
42 | @Override
43 | public DataResult getByProductName(String productName) {
44 | return new SuccessDataResult
45 | (this.productDao.getByProductName(productName),"Data listed.");
46 | }
47 |
48 | @Override
49 | public DataResult getByProductNameAndCategoryId(String productName, int categoryId) {
50 | // business codes
51 |
52 | return new SuccessDataResult
53 | (this.productDao.getByProductNameAndCategory_CategoryId(productName,categoryId),"Data listed.");
54 | }
55 |
56 | @Override
57 | public DataResult> getByProductNameOrCategoryId(String productName, int categoryId) {
58 | return new SuccessDataResult>
59 | (this.productDao.getByProductNameOrCategory_CategoryId(productName,categoryId),"Data listed.");
60 | }
61 |
62 | @Override
63 | public DataResult> getByCategoryIn(List categories) {
64 | return new SuccessDataResult>
65 | (this.productDao.getByCategoryIn(categories),"Data listed.");
66 | }
67 |
68 | @Override
69 | public DataResult> getByProductNameContains(String productName) {
70 | return new SuccessDataResult>
71 | (this.productDao.getByProductNameContains(productName),"Data listed.");
72 | }
73 |
74 | @Override
75 | public DataResult> getByProductNameStartsWith(String productName) {
76 | return new SuccessDataResult>
77 | (this.productDao.getByProductNameStartsWith(productName),"Data listed.");
78 | }
79 |
80 | @Override
81 | public DataResult> getByNameAndCategory(String productName, int categoryId) {
82 | return new SuccessDataResult>
83 | (this.productDao.getByNameAndCategory(productName, categoryId),"Data listed.");
84 | }
85 |
86 | @Override
87 | public DataResult> getAll(int pageNo, int pageSize) {
88 | Pageable pageable = PageRequest.of(pageNo, pageSize);
89 | return new SuccessDataResult>
90 | (this.productDao.findAll(pageable).getContent());
91 | }
92 |
93 | @Override
94 | public DataResult> getAllSorted() {
95 | Sort sort = Sort.by(Sort.Direction.DESC, "productName");
96 | return new SuccessDataResult>
97 | (this.productDao.findAll(sort));
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/DataResult.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class DataResult extends Result {
4 |
5 | private T data;
6 |
7 | public DataResult(T data, boolean success, String message) {
8 | super(success, message);
9 | this.data = data;
10 | }
11 |
12 | public DataResult(T data, boolean success) {
13 | super(success);
14 | this.data = data;
15 | }
16 |
17 | public T getData() {
18 | return this.data;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/ErrorDataResult.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class ErrorDataResult extends DataResult {
4 |
5 | public ErrorDataResult(T data, String message) {
6 | super(data, false, message);
7 | }
8 |
9 | public ErrorDataResult(T data) {
10 | super(data,false);
11 | }
12 |
13 | public ErrorDataResult(String message) {
14 | super(null, false, message);
15 | }
16 |
17 | public ErrorDataResult() {
18 | super(null, false);
19 | }
20 |
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/ErrorResult.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class ErrorResult extends Result {
4 |
5 | public ErrorResult() {
6 | super(false);
7 | }
8 |
9 | public ErrorResult(String message) {
10 | super(false,message);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/Result.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class Result {
4 | private boolean success;
5 | private String message;
6 |
7 | public Result(boolean success) {
8 | this.success = success;
9 | }
10 |
11 | public Result(boolean success, String message) {
12 | this(success);
13 | this.message = message;
14 | }
15 |
16 | public boolean isSuccess() {
17 | return this.success;
18 | }
19 |
20 | public String getMessage() {
21 | return this.message;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/SuccessDataResult.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class SuccessDataResult extends DataResult {
4 |
5 | public SuccessDataResult(T data, String message) {
6 | super(data, true, message);
7 | }
8 |
9 | public SuccessDataResult(T data) {
10 | super(data,true);
11 | }
12 |
13 | public SuccessDataResult(String message) {
14 | super(null, true, message);
15 | }
16 |
17 | public SuccessDataResult() {
18 | super(null, true);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/core/utilities/results/SuccessResult.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.core.utilities.results;
2 |
3 | public class SuccessResult extends Result {
4 |
5 | public SuccessResult() {
6 | super(true);
7 | }
8 |
9 | public SuccessResult(String message) {
10 | super(true,message);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/dataAccess/abstracts/ProductDao.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.dataAccess.abstracts;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 | import org.springframework.data.jpa.repository.Query;
7 |
8 | import kodlamaio.northwind.entities.concretes.Product;
9 |
10 | public interface ProductDao extends JpaRepository {
11 |
12 | Product getByProductName(String productName);
13 |
14 | Product getByProductNameAndCategory_CategoryId(String productName, int categoryId);
15 |
16 | List getByProductNameOrCategory_CategoryId(String productName, int categoryId);
17 |
18 | List getByCategoryIn(List categories);
19 |
20 | List getByProductNameContains(String productName);
21 |
22 | List getByProductNameStartsWith(String productName);
23 |
24 | @Query("From Product where productName=:productName and category.categoryId=:categoryId")
25 | List getByNameAndCategory(String productName, int categoryId);
26 | }
27 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/entities/concretes/Category.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.entities.concretes;
2 |
3 | import java.util.List;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import javax.persistence.Table;
10 |
11 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
12 |
13 | import lombok.AllArgsConstructor;
14 | import lombok.Data;
15 | import lombok.NoArgsConstructor;
16 |
17 | @Data
18 | @AllArgsConstructor
19 | @NoArgsConstructor
20 | @Table(name = "categories")
21 | @Entity
22 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","products"})
23 | public class Category {
24 |
25 | @Id
26 | @Column(name = "category_id")
27 | private int categoryId;
28 |
29 | @Column(name = "category_name")
30 | private String categoryName;
31 |
32 | @OneToMany(mappedBy = "category")
33 | private List products;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/northwind/src/main/java/kodlamaio/northwind/entities/concretes/Product.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind.entities.concretes;
2 |
3 | import javax.persistence.Column;
4 | import javax.persistence.Entity;
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.JoinColumn;
9 | import javax.persistence.ManyToOne;
10 | import javax.persistence.Table;
11 |
12 | import lombok.AllArgsConstructor;
13 | import lombok.Data;
14 | import lombok.NoArgsConstructor;
15 |
16 | @Data
17 | @Entity
18 | @Table(name="products")
19 | @AllArgsConstructor
20 | @NoArgsConstructor
21 | public class Product {
22 |
23 | @Id
24 | @GeneratedValue(strategy = GenerationType.IDENTITY)
25 | @Column(name="product_id")
26 | private int id;
27 |
28 | // @Column(name="category_id")
29 | // private int categoryId;
30 |
31 | @Column(name="product_name")
32 | private String productName;
33 |
34 | @Column(name="unit_price")
35 | private double unitPrice;
36 |
37 | @Column(name="units_in_stock")
38 | private short unitsInStock;
39 |
40 | @Column(name="quantity_per_unit")
41 | private String quantityPerUnit;
42 |
43 | @ManyToOne()
44 | @JoinColumn(name = "category_id")
45 | private Category category;
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/northwind/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
2 | spring.jpa.hibernate.ddl-auto=update
3 | spring.jpa.hibernate.show-sql=true
4 | spring.datasource.url=jdbc:postgresql://localhost:5432/Northwind
5 | spring.datasource.username=postgres
6 | spring.datasource.password=12345
7 | spring.jpa.properties.javax.persistence.validation.mode = none
--------------------------------------------------------------------------------
/northwind/src/test/java/kodlamaio/northwind/NorthwindApplicationTests.java:
--------------------------------------------------------------------------------
1 | package kodlamaio.northwind;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class NorthwindApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/oopIntro/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/oopIntro/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | oopIntro
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/oopIntro/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/oopIntro/bin/extraWork/Category.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/extraWork/Category.class
--------------------------------------------------------------------------------
/oopIntro/bin/extraWork/Course.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/extraWork/Course.class
--------------------------------------------------------------------------------
/oopIntro/bin/extraWork/CourseManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/extraWork/CourseManager.class
--------------------------------------------------------------------------------
/oopIntro/bin/extraWork/Instructor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/extraWork/Instructor.class
--------------------------------------------------------------------------------
/oopIntro/bin/extraWork/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/extraWork/Main.class
--------------------------------------------------------------------------------
/oopIntro/bin/oopIntro/Category.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/oopIntro/Category.class
--------------------------------------------------------------------------------
/oopIntro/bin/oopIntro/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/oopIntro/Main.class
--------------------------------------------------------------------------------
/oopIntro/bin/oopIntro/Product.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/oopIntro/Product.class
--------------------------------------------------------------------------------
/oopIntro/bin/oopIntro/ProductManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/bin/oopIntro/ProductManager.class
--------------------------------------------------------------------------------
/oopIntro/src/extraWork/Category.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Category {
4 |
5 | int id;
6 | String name;
7 |
8 | public Category() {}
9 |
10 | public Category(int id, String name) {
11 | this.id = id;
12 | this.name = name;
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/oopIntro/src/extraWork/Course.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Course {
4 |
5 | int id;
6 | String name;
7 | String detail;
8 | String instructor;
9 | double price;
10 |
11 | public Course() {}
12 |
13 | public Course(int id, String name, String detail, String instructor, double price) {
14 | this.id = id;
15 | this.name = name;
16 | this.detail = detail;
17 | this.instructor = instructor;
18 | this.price = price;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/oopIntro/src/extraWork/CourseManager.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class CourseManager {
4 | public CourseManager() {
5 |
6 | }
7 |
8 | void listCourseDetails(Course course) {
9 | System.out.println("Course name: " + course.name);
10 | System.out.println("Course details: " + course.detail);
11 | System.out.println("Instructor: " + course.instructor);
12 | System.out.println("Price: " + course.price + " TRY");
13 | }
14 |
15 | void getPriceWithName(Course course) {
16 | System.out.println("Course name: " + course.name + " | Price: " + course.price + " TRY");
17 | }
18 |
19 | void registerCourse(Course course) {
20 | System.out.println("Registration succeed: " + course.name);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/oopIntro/src/extraWork/Instructor.java:
--------------------------------------------------------------------------------
1 | package extraWork;
2 |
3 | public class Instructor {
4 | int id;
5 | String name;
6 |
7 | public Instructor() {}
8 |
9 | public Instructor(int id, String name) {
10 | this.id = id;
11 | this.name = name;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/oopIntro/src/extraWork/Main.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/src/extraWork/Main.java
--------------------------------------------------------------------------------
/oopIntro/src/oopIntro/Category.java:
--------------------------------------------------------------------------------
1 | package oopIntro;
2 |
3 | public class Category {
4 | int id;
5 | String name;
6 |
7 | public Category(int id, String name) {
8 | super();
9 | this.id = id;
10 | this.name = name;
11 | }
12 |
13 | public Category() {
14 |
15 | }
16 |
17 | public int getId() {
18 | return id;
19 | }
20 |
21 | public void setId(int id) {
22 | this.id = id;
23 | }
24 |
25 | public String getName() {
26 | return name + "!";
27 | }
28 |
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/oopIntro/src/oopIntro/Main.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tamermurtazaoglu/Java/ca890826127fd8afdf76cb8129dd92abe819abd7/oopIntro/src/oopIntro/Main.java
--------------------------------------------------------------------------------
/oopIntro/src/oopIntro/Product.java:
--------------------------------------------------------------------------------
1 | package oopIntro;
2 |
3 | public class Product {
4 |
5 | private int id;
6 | private String name;
7 | private double unitPrice;
8 | private String detail;
9 | private double discount;
10 |
11 | public Product() {
12 |
13 | }
14 |
15 | public Product(int id, String name, double unitPrice, String detail, double discount) {
16 | super();
17 | this.id = id;
18 | this.name = name;
19 | this.unitPrice = unitPrice;
20 | this.detail = detail;
21 | this.discount = discount;
22 | }
23 |
24 | public int getId() {
25 | return id;
26 | }
27 |
28 | public void setId(int id) {
29 | this.id = id;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 |
40 | public double getUnitPrice() {
41 | return unitPrice;
42 | }
43 |
44 | public void setUnitPrice(double unitPrice) {
45 | this.unitPrice = unitPrice;
46 | }
47 |
48 | public String getDetail() {
49 | return detail;
50 | }
51 |
52 | public void setDetail(String detail) {
53 | this.detail = detail;
54 | }
55 |
56 | public double getDiscount() {
57 | return discount;
58 | }
59 |
60 | public void setDiscount(double discount) {
61 | this.discount = discount;
62 | }
63 |
64 | public double getUnitPriceAfterDiscount() {
65 | return this.unitPrice - (this.unitPrice * this.discount % 100);
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/oopIntro/src/oopIntro/ProductManager.java:
--------------------------------------------------------------------------------
1 | package oopIntro;
2 |
3 | public class ProductManager {
4 |
5 | public ProductManager() {
6 |
7 | }
8 |
9 | public void addToCart(Product product) {
10 | System.out.println(product.getName() + " sepete eklendi.");
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------