Skip to content

Instantly share code, notes, and snippets.

View raviyasas's full-sized avatar
🤠
Available

Ravi Yasas raviyasas

🤠
Available
View GitHub Profile
Employee emp1 = new Employee(1,'Ann');
Employee emp2 = new Employee(2,'John');
Employee emp3 = new Employee(3,'Rex');
Map<Employee, String> myHashMap = new HashMap<>();
hashMap.put(emp1, 'IT');
hashMap.put(emp2, 'DEV');
hashMap.put(emp3, 'QA');
hashMap.put(null, 'QA');
public class Employee{
private int id;
private String employeeName;
public Employee(int id) {
this.id= id;
}
//getters and setters
import React, { useState, useEffect } from 'react'
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import Dialog from '@mui/material/Dialog';
import React, { useState } from 'react';
import TaskService from "../service/task.services";
import { Form, InputGroup, Button } from "react-bootstrap";
import '../styles/AddTask.css';
export const AddTask = () => {
const [taskName, setTaskName] = useState("");
const [taskDescription, setTaskDescription] = useState("");
import { db } from "../firebase-config"
import { doc, getDoc, getDocs, collection, addDoc, updateDoc, deleteDoc} from "firebase/firestore";
const tasksCollectionRef = collection(db, "tasks");
class TaskService{
getTask = (id) => {
const taskDoc = doc(db, "tasks", id);
return getDoc(taskDoc);
if(instance == null){
synchronized (ThreadSafe.class){
if(instance == null){
instance = new ThreadSafe();
}
}
}
synchronized (ThreadSafe.class){
if(instance == null){
instance = new ThreadSafe();
}
}
@Service
public class EmployeeService {
@Autowired
private AccountService accountService;
@Transactional
public void getAccountDetails() {
accountService.createAccountDocument();
}
@Service
@Transactional
public class EmployeeService {
@Autowired
public EmployeeService(EmployeeRepository employeeRepository){
this.employeeRepository=employeeRepository;
}
private EmployeeRepository employeeRepository;
@RestController
@RequestMapping("/api/employee")
public class EmployeeController {
@Autowired
public EmployeeController(EmployeeService employeeService){
this.employeeService=employeeService;
}
private EmployeeService employeeService;