This commit is contained in:
string 2025-06-02 15:56:41 +05:30
parent ddf0a0fd2d
commit 0fe2b06529
16 changed files with 958 additions and 0 deletions

View File

@ -0,0 +1,91 @@
package com.realnet.angulardata.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.*;
import com.realnet.fnd.response.EntityResponse;
import org.springframework.http.*;
import org.springframework.beans.factory.annotation.*;
import com.realnet.angulardata.Entity.Basicp;
import com.realnet.angulardata.Services.BasicpService ;
@RequestMapping(value = "/Basicp")
@CrossOrigin("*")
@RestController
public class BasicpController {
@Autowired
private BasicpService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Basicp")
public Basicp Savedata(@RequestBody Basicp data) {
Basicp save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Basicp/{id}")
public Basicp update(@RequestBody Basicp data,@PathVariable Integer id ) {
Basicp update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Basicp/getall/page")
public Page<Basicp> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Basicp> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Basicp")
public List<Basicp> getdetails() {
List<Basicp> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Basicp")
public List<Basicp> getallwioutsec() {
List<Basicp> get = Service.getdetails();
return get;
}
@GetMapping("/Basicp/{id}")
public Basicp getdetailsbyId(@PathVariable Integer id ) {
Basicp get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Basicp/{id}")
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
}
}

View File

@ -0,0 +1,99 @@
package com.realnet.angulardata.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.*;
import com.realnet.fnd.response.EntityResponse;
import org.springframework.http.*;
import org.springframework.beans.factory.annotation.*;
import com.realnet.angulardata.Entity.Test2;
import com.realnet.angulardata.Services.Test2Service ;
@RequestMapping(value = "/Test2")
@CrossOrigin("*")
@RestController
public class Test2Controller {
@Autowired
private Test2Service Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Test2")
public Test2 Savedata(@RequestBody Test2 data) {
Test2 save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Test2/{id}")
public Test2 update(@RequestBody Test2 data,@PathVariable Integer id ) {
Test2 update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Test2/getall/page")
public Page<Test2> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Test2> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Test2")
public List<Test2> getdetails() {
List<Test2> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Test2")
public List<Test2> getallwioutsec() {
List<Test2> get = Service.getdetails();
return get;
}
@GetMapping("/Test2/{id}")
public Test2 getdetailsbyId(@PathVariable Integer id ) {
Test2 get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Test2/{id}")
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
}
}

View File

@ -0,0 +1,29 @@
package com.realnet.angulardata.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Basicp extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(length = 2000)
private String description;
}

View File

@ -0,0 +1,33 @@
package com.realnet.angulardata.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Test2 extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(length = 2000)
private String description;
private boolean active;
}

View File

@ -0,0 +1,28 @@
package com.realnet.angulardata.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.angulardata.Entity.Basicp;
@Repository
public interface BasicpRepository extends JpaRepository<Basicp, Integer> {
@Query(value = "select * from basicp where created_by=?1", nativeQuery = true)
List<Basicp> findAll(Long creayedBy);
@Query(value = "select * from basicp where created_by=?1", nativeQuery = true)
Page<Basicp> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,30 @@
package com.realnet.angulardata.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.angulardata.Entity.Test2;
@Repository
public interface Test2Repository extends JpaRepository<Test2, Integer> {
@Query(value = "select * from test2 where created_by=?1", nativeQuery = true)
List<Test2> findAll(Long creayedBy);
@Query(value = "select * from test2 where created_by=?1", nativeQuery = true)
Page<Test2> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,83 @@
package com.realnet.angulardata.Services;
import com.realnet.angulardata.Repository.BasicpRepository;
import com.realnet.angulardata.Entity.Basicp
;import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.*;
import com.realnet.users.service1.AppUserServiceImpl;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class BasicpService {
@Autowired
private BasicpRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Basicp Savedata(Basicp data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Basicp save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Basicp> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Basicp> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Basicp> all = Repository.findAll(getUser().getUserId());
return all ; }
public Basicp getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Basicp update(Basicp data,Integer id) {
Basicp old = Repository.findById(id).get();
old.setName(data.getName());
old.setDescription(data.getDescription());
final Basicp test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,93 @@
package com.realnet.angulardata.Services;
import com.realnet.angulardata.Repository.Test2Repository;
import com.realnet.angulardata.Entity.Test2
;import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.*;
import com.realnet.users.service1.AppUserServiceImpl;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class Test2Service {
@Autowired
private Test2Repository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Test2 Savedata(Test2 data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Test2 save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Test2> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Test2> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Test2> all = Repository.findAll(getUser().getUserId());
return all ; }
public Test2 getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Test2 update(Test2 data,Integer id) {
Test2 old = Repository.findById(id).get();
old.setName(data.getName());
old.setDescription(data.getDescription());
old.setActive (data.isActive());
final Test2 test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,103 @@
package com.realnet.stepperworkflow.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.realnet.fnd.response.EntityResponse;
import com.realnet.stepperworkflow.Entity.Stepper_table_config;
import com.realnet.stepperworkflow.Services.Stepper_table_configService;
@RequestMapping(value = "/Stepper_table_config")
@CrossOrigin("*")
@RestController
public class Stepper_table_configController {
@Autowired
private Stepper_table_configService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Stepper_table_config")
public Stepper_table_config Savedata(@RequestParam Integer stepperId, @RequestParam Integer tableId,
@RequestParam String tableName) {
Stepper_table_config save = Service.Savedata(stepperId, tableId, tableName);
System.out.println("data saved..." + save + "\n");
return save;
}
@PutMapping("/Stepper_table_config/{id}")
public Stepper_table_config update(@RequestBody Stepper_table_config data, @PathVariable Integer id) {
Stepper_table_config update = Service.update(data, id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Stepper_table_config/getall/page")
public Page<Stepper_table_config> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Stepper_table_config> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Stepper_table_config/tableId")
public List<Stepper_table_config> getAll(@RequestParam Integer stepper_id, @RequestParam Integer table_id) {
List<Stepper_table_config> get = Service.getAll(stepper_id, table_id);
return get;
}
@GetMapping("/Stepper_table_config/stepId/{stepper_id}")
public List<Stepper_table_config> getAll(@PathVariable Integer stepper_id) {
List<Stepper_table_config> get = Service.getAll(stepper_id);
return get;
}
@GetMapping("/Stepper_table_config")
public List<Stepper_table_config> getdetails() {
List<Stepper_table_config> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Stepper_table_config")
public List<Stepper_table_config> getallwioutsec() {
List<Stepper_table_config> get = Service.getdetails();
return get;
}
@GetMapping("/Stepper_table_config/{id}")
public Stepper_table_config getdetailsbyId(@PathVariable Integer id) {
Stepper_table_config get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Stepper_table_config/{id}")
public ResponseEntity<?> delete_by_id(@PathVariable Integer id) {
Service.delete_by_id(id);
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
}
}

View File

@ -0,0 +1,90 @@
package com.realnet.stepperworkflow.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.realnet.fnd.response.EntityResponse;
import com.realnet.stepperworkflow.Entity.Stepper_workflow;
import com.realnet.stepperworkflow.Services.Stepper_workflowService;
@RequestMapping(value = "/Stepper_workflow")
@CrossOrigin("*")
@RestController
public class Stepper_workflowController {
@Autowired
private Stepper_workflowService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Stepper_workflow")
public Stepper_workflow Savedata(@RequestBody Stepper_workflow data) {
Stepper_workflow save = Service.Savedata(data);
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Stepper_workflow/{id}")
public Stepper_workflow update(@RequestBody Stepper_workflow data, @PathVariable Integer id) {
Stepper_workflow update = Service.update(data, id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Stepper_workflow/getall/page")
public Page<Stepper_workflow> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Stepper_workflow> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Stepper_workflow")
public List<Stepper_workflow> getdetails() {
List<Stepper_workflow> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Stepper_workflow")
public List<Stepper_workflow> getallwioutsec() {
List<Stepper_workflow> get = Service.getdetails();
return get;
}
@GetMapping("/Stepper_workflow/{id}")
public Stepper_workflow getdetailsbyId(@PathVariable Integer id) {
Stepper_workflow get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Stepper_workflow/{id}")
public ResponseEntity<?> delete_by_id(@PathVariable Integer id) {
Service.delete_by_id(id);
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
}
}

View File

@ -0,0 +1,30 @@
package com.realnet.stepperworkflow.Entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.realnet.WhoColumn.Entity.Extension;
import lombok.Data;
@Entity
@Data
public class Stepper_table_config extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String table_name;
private int table_id;
private int stepper_id;
}

View File

@ -0,0 +1,33 @@
package com.realnet.stepperworkflow.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Stepper_workflow extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(length = 2000)
private String description;
private boolean active;
}

View File

@ -0,0 +1,27 @@
package com.realnet.stepperworkflow.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.stepperworkflow.Entity.Stepper_table_config;
@Repository
public interface Stepper_table_configRepository extends JpaRepository<Stepper_table_config, Integer> {
@Query(value = "select * from stepper_table_config where created_by=?1", nativeQuery = true)
List<Stepper_table_config> findAll(Long creayedBy);
@Query(value = "select * from stepper_table_config where created_by=?1", nativeQuery = true)
Page<Stepper_table_config> findAll(Pageable page, Long creayedBy);
@Query(value = "select * from stepper_table_config where stepper_id=?1 && table_id=?2", nativeQuery = true)
List<Stepper_table_config> getAllBysteAndTbId(Integer stepper_id, Integer table_id);
@Query(value = "select * from stepper_table_config where stepper_id=?1", nativeQuery = true)
List<Stepper_table_config> getAllBystepId(Integer stepper_id);
}

View File

@ -0,0 +1,21 @@
package com.realnet.stepperworkflow.Repository;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.realnet.stepperworkflow.Entity.Stepper_workflow;
@Repository
public interface Stepper_workflowRepository extends JpaRepository<Stepper_workflow, Integer> {
@Query(value = "select * from stepper_workflow where created_by=?1", nativeQuery = true)
List<Stepper_workflow> findAll(Long creayedBy);
@Query(value = "select * from stepper_workflow where created_by=?1", nativeQuery = true)
Page<Stepper_workflow> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,92 @@
package com.realnet.stepperworkflow.Services;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;
import com.realnet.stepperworkflow.Entity.Stepper_table_config;
import com.realnet.stepperworkflow.Repository.Stepper_table_configRepository;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
@Service
public class Stepper_table_configService {
@Autowired
private Stepper_table_configRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Stepper_table_config Savedata(Integer stepperId, Integer tableId, String tableName) {
Stepper_table_config data = new Stepper_table_config();
data.setStepper_id(stepperId);
data.setTable_id(tableId);
data.setTable_name(tableName);
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Stepper_table_config save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Stepper_table_config> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Stepper_table_config> getdetails() {
List<Stepper_table_config> all = Repository.findAll(getUser().getUserId());
return all;
}
// get ALl By table Id and stepper Id
public List<Stepper_table_config> getAll(Integer stepper_id, Integer table_id) {
List<Stepper_table_config> all = Repository.getAllBysteAndTbId(stepper_id, table_id);
return all;
}
// get ALl By table Id and stepper Id
public List<Stepper_table_config> getAll(Integer stepper_id) {
List<Stepper_table_config> all = Repository.getAllBystepId(stepper_id);
return all;
}
public Stepper_table_config getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Stepper_table_config update(Stepper_table_config data, Integer id) {
Stepper_table_config old = Repository.findById(id).get();
old.setTable_name(data.getTable_name());
old.setTable_id(data.getTable_id());
old.setStepper_id(data.getStepper_id());
final Stepper_table_config test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;
}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}
}

View File

@ -0,0 +1,76 @@
package com.realnet.stepperworkflow.Services;
import com.realnet.stepperworkflow.Repository.Stepper_workflowRepository;
import com.realnet.stepperworkflow.Entity.Stepper_workflow;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.*;
import com.realnet.users.service1.AppUserServiceImpl;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class Stepper_workflowService {
@Autowired
private Stepper_workflowRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Stepper_workflow Savedata(Stepper_workflow data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Stepper_workflow save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Stepper_workflow> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Stepper_workflow> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Stepper_workflow> all = Repository.findAll(getUser().getUserId());
return all;
}
public Stepper_workflow getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Stepper_workflow update(Stepper_workflow data, Integer id) {
Stepper_workflow old = Repository.findById(id).get();
old.setName(data.getName());
old.setDescription(data.getDescription());
old.setActive(data.isActive());
final Stepper_workflow test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;
}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}
}