build
This commit is contained in:
parent
f43ea4fa7f
commit
9787d186cc
@ -71,6 +71,13 @@ public class Design_lbraryController {
|
||||
List<Design_lbrary> get = designLibraryService.getdetails();
|
||||
return get;
|
||||
}
|
||||
|
||||
@GetMapping("/Design_lbrary/line/{id}")
|
||||
public List<Design_lbrary> getAllDlf(@PathVariable Integer id) {
|
||||
List<Design_lbrary> get = designLibraryService.getAllDlfByhedId(id);
|
||||
return get;
|
||||
}
|
||||
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Design_lbrary")
|
||||
@ -136,6 +143,19 @@ public class Design_lbraryController {
|
||||
return new ResponseEntity<Design_lbrary>(flf_line, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/Design_lbrary/line/unique")
|
||||
public ResponseEntity<?> getallByHeaderId(@RequestParam Integer headerId, @RequestParam String operationType,
|
||||
@RequestParam String fieldType) {
|
||||
Design_lbrary flf_line = designLibraryService.getallByHeaderId(headerId, operationType, fieldType);
|
||||
|
||||
if (flf_line == null) {
|
||||
|
||||
return new ResponseEntity<>("not found", HttpStatus.EXPECTATION_FAILED);
|
||||
}
|
||||
|
||||
return new ResponseEntity<Design_lbrary>(flf_line, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/Design_lbrary/list/template")
|
||||
public ResponseEntity<?> listOfTemplate(@RequestParam String operationType, @RequestParam String fieldType) {
|
||||
List<Design_lbrary> flf_line = designLibraryService.listOfTemplate(operationType, fieldType);
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package com.realnet.dlf.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.dlf.Entity.Dlf_header;
|
||||
import com.realnet.dlf.Services.Dlf_headerService;
|
||||
import com.realnet.fnd.response.EntityResponse;
|
||||
|
||||
@RequestMapping(value = "/Dlf_header")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class Dlf_headerController {
|
||||
@Autowired
|
||||
private Dlf_headerService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
@PostMapping("/Dlf_header")
|
||||
public Dlf_header Savedata(@RequestBody Dlf_header data) {
|
||||
Dlf_header save = Service.Savedata(data);
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@PutMapping("/Dlf_header/{id}")
|
||||
public Dlf_header update(@RequestBody Dlf_header data, @PathVariable Integer id) {
|
||||
Dlf_header update = Service.update(data, id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
|
||||
// get all with pagination
|
||||
@GetMapping("/Dlf_header/getall/page")
|
||||
public Page<Dlf_header> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Dlf_header> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/Dlf_header")
|
||||
public List<Dlf_header> getdetails() {
|
||||
List<Dlf_header> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Dlf_header")
|
||||
public List<Dlf_header> getallwioutsec() {
|
||||
List<Dlf_header> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
|
||||
@GetMapping("/Dlf_header/{id}")
|
||||
public Dlf_header getdetailsbyId(@PathVariable Integer id) {
|
||||
Dlf_header get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
|
||||
@DeleteMapping("/Dlf_header/{id}")
|
||||
public ResponseEntity<?> delete_by_id(@PathVariable Integer id) {
|
||||
Service.delete_by_id(id);
|
||||
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -48,6 +48,6 @@ public class Design_lbrary extends Extension {
|
||||
|
||||
private String typerender;
|
||||
|
||||
private String techstack;
|
||||
private Integer hedaer_id;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.realnet.dlf.Entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
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 Dlf_header 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;
|
||||
|
||||
private String type;
|
||||
|
||||
private String techstack;
|
||||
|
||||
}
|
||||
@ -20,13 +20,20 @@ public interface Design_lbraryRepository extends JpaRepository<Design_lbrary, In
|
||||
@Query(value = "select * from design_lbrary where created_by=?1", nativeQuery = true)
|
||||
Page<Design_lbrary> findAll(Pageable page, Long creayedBy);
|
||||
|
||||
@Query(value = "SELECT * from design_lbrary WHERE active=:active && templatetype=:operation_type && uitype=:fieldtype limit 1", nativeQuery = true)
|
||||
Design_lbrary getallByHeaderIdAndFieldType(@Param("active") boolean active,
|
||||
@Param("operation_type") String operation_type, @Param("fieldtype") String fieldtype);
|
||||
@Query(value = "select * from design_lbrary where created_by=?1 && hedaer_id=?2 ", nativeQuery = true)
|
||||
List<Design_lbrary> getAllByhedId(Long creayedBy, Integer hedaer_id);
|
||||
|
||||
@Query(value = "SELECT * from design_lbrary WHERE active=:active && templatetype=:templatetype && uitype=:fieldtype limit 1", nativeQuery = true)
|
||||
Design_lbrary getallByFieldType(@Param("active") boolean active, @Param("templatetype") String templatetype,
|
||||
@Param("fieldtype") String fieldtype);
|
||||
|
||||
@Query(value = "SELECT * from design_lbrary WHERE active=:active && hedaer_id=:hedaer_id && templatetype=:templatetype AND LOWER(uitype) = LOWER(:fieldtype) limit 1", nativeQuery = true)
|
||||
Design_lbrary getallByHeaderId(@Param("hedaer_id") Integer hedaer_id, @Param("active") boolean active,
|
||||
@Param("templatetype") String templatetype, @Param("fieldtype") String fieldtype);
|
||||
|
||||
@Query(value = "SELECT * FROM design_lbrary " + "WHERE active=:active && templatetype = :operation_type "
|
||||
+ "AND LOWER(uitype) LIKE CONCAT(LOWER(:fieldtype), '%')", nativeQuery = true)
|
||||
List<Design_lbrary> getallFlfLine(@Param("active") boolean active, @Param("operation_type") String operationType,
|
||||
List<Design_lbrary> getallDlfLine(@Param("active") boolean active, @Param("operation_type") String operationType,
|
||||
@Param("fieldtype") String fieldtype);
|
||||
|
||||
@Query(value = "select * from design_lbrary WHERE id BETWEEN :startId AND :endId", nativeQuery = true)
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.realnet.dlf.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.dlf.Entity.Dlf_header;
|
||||
|
||||
@Repository
|
||||
public interface Dlf_headerRepository extends JpaRepository<Dlf_header, Integer> {
|
||||
|
||||
@Query(value = "select * from dlf_header where created_by=?1", nativeQuery = true)
|
||||
List<Dlf_header> findAll(Long creayedBy);
|
||||
|
||||
@Query(value = "select * from dlf_header where created_by=?1", nativeQuery = true)
|
||||
Page<Dlf_header> findAll(Pageable page, Long creayedBy);
|
||||
}
|
||||
@ -57,6 +57,13 @@ public class Design_lbraryService {
|
||||
return all;
|
||||
}
|
||||
|
||||
public List<Design_lbrary> getAllDlfByhedId(Integer id) {
|
||||
// TODO Auto-generated method stub
|
||||
List<Design_lbrary> all = designLibraryRepository.getAllByhedId(getUser().getUserId(), id);
|
||||
return all;
|
||||
|
||||
}
|
||||
|
||||
public Design_lbrary getdetailsbyId(Integer id) {
|
||||
return designLibraryRepository.findById(id).get();
|
||||
}
|
||||
@ -83,7 +90,6 @@ public class Design_lbraryService {
|
||||
|
||||
old.setUitype(data.getUitype());
|
||||
old.setTyperender(data.getTyperender());
|
||||
old.setTechstack(data.getTechstack());
|
||||
|
||||
old.setHtml(data.getHtml());
|
||||
|
||||
@ -127,7 +133,7 @@ public class Design_lbraryService {
|
||||
|
||||
// GET LINE BY header id, operation type, field type
|
||||
public Design_lbrary getflflinerandom(String operationType, String fieldType) {
|
||||
List<Design_lbrary> flf = designLibraryRepository.getallFlfLine(true, operationType.toLowerCase().trim(),
|
||||
List<Design_lbrary> flf = designLibraryRepository.getallDlfLine(true, operationType.toLowerCase().trim(),
|
||||
fieldType.toLowerCase().trim());
|
||||
|
||||
if (flf == null || flf.isEmpty()) {
|
||||
@ -141,8 +147,21 @@ public class Design_lbraryService {
|
||||
|
||||
// GET LINE BY header id, operation type, field type
|
||||
public Design_lbrary getLinestraight(String operationType, String fieldType) {
|
||||
Design_lbrary flf = designLibraryRepository.getallByHeaderIdAndFieldType(true,
|
||||
operationType.toLowerCase().trim(), fieldType.toLowerCase().trim());
|
||||
Design_lbrary flf = designLibraryRepository.getallByFieldType(true, operationType.toLowerCase().trim(),
|
||||
fieldType.toLowerCase().trim());
|
||||
|
||||
if (flf == null) {
|
||||
return null; // ya throw new RuntimeException("No data found");
|
||||
}
|
||||
|
||||
// Random index pick
|
||||
return flf;
|
||||
}
|
||||
|
||||
// GET LINE BY header id, operation type, field type
|
||||
public Design_lbrary getallByHeaderId(Integer headerId, String operationType, String fieldType) {
|
||||
Design_lbrary flf = designLibraryRepository.getallByHeaderId(headerId, true, operationType.toLowerCase().trim(),
|
||||
fieldType.toLowerCase().trim());
|
||||
|
||||
if (flf == null) {
|
||||
return null; // ya throw new RuntimeException("No data found");
|
||||
@ -153,7 +172,7 @@ public class Design_lbraryService {
|
||||
}
|
||||
|
||||
public List<Design_lbrary> listOfTemplate(String operationType, String fieldType) {
|
||||
List<Design_lbrary> flf = designLibraryRepository.getallFlfLine(true, operationType.toLowerCase().trim(),
|
||||
List<Design_lbrary> flf = designLibraryRepository.getallDlfLine(true, operationType.toLowerCase().trim(),
|
||||
fieldType.toLowerCase().trim());
|
||||
|
||||
if (flf == null || flf.isEmpty()) {
|
||||
@ -261,4 +280,5 @@ public class Design_lbraryService {
|
||||
return user;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
package com.realnet.dlf.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.dlf.Entity.Dlf_header;
|
||||
import com.realnet.dlf.Repository.Dlf_headerRepository;
|
||||
import com.realnet.realm.Entity.Realm;
|
||||
import com.realnet.realm.Services.RealmService;
|
||||
import com.realnet.users.entity1.AppUser;
|
||||
import com.realnet.users.service1.AppUserServiceImpl;
|
||||
|
||||
@Service
|
||||
public class Dlf_headerService {
|
||||
@Autowired
|
||||
private Dlf_headerRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
@Autowired
|
||||
private RealmService realmService;
|
||||
|
||||
public Dlf_header Savedata(Dlf_header data) {
|
||||
|
||||
data.setUpdatedBy(getUser().getUserId());
|
||||
data.setCreatedBy(getUser().getUserId());
|
||||
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||
Dlf_header save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
// get all with pagination
|
||||
public Page<Dlf_header> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page, getUser().getUserId());
|
||||
}
|
||||
|
||||
public List<Dlf_header> getdetails() {
|
||||
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||
List<Dlf_header> all = Repository.findAll(getUser().getUserId());
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
public Dlf_header getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
public Dlf_header update(Dlf_header data, Integer id) {
|
||||
Dlf_header old = Repository.findById(id).get();
|
||||
old.setName(data.getName());
|
||||
|
||||
old.setDescription(data.getDescription());
|
||||
|
||||
old.setActive(data.isActive());
|
||||
|
||||
old.setType(data.getType());
|
||||
old.setTechstack(data.getTechstack());
|
||||
|
||||
final Dlf_header test = Repository.save(old);
|
||||
data.setUpdatedBy(getUser().getUserId());
|
||||
return test;
|
||||
}
|
||||
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}
|
||||
}
|
||||
@ -98,11 +98,25 @@ public class SiteBuilderService {
|
||||
String folderPath = projectPath + File.separator + "Files" + File.separator + siteBuilderName;
|
||||
int i = 0;
|
||||
|
||||
String startindex = "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + " <title>Welcome</title>\n" + "</head>\n"
|
||||
+ "<body>\n";
|
||||
|
||||
String endindex = "</body>\n" + "</html>";
|
||||
|
||||
for (Map.Entry<String, String> entry : pageHtmlMap.entrySet()) {
|
||||
|
||||
String pageName = entry.getKey().trim().replaceAll("\\s+", "_") + ".html"; // remove spaces from name
|
||||
String htmlContent = entry.getValue();
|
||||
|
||||
fileHelper.createFile(folderPath, pageName, htmlContent);
|
||||
if (pageName.equalsIgnoreCase("home.html")) {
|
||||
|
||||
pageName = "index.html";
|
||||
|
||||
htmlContent = startindex + " \n" + htmlContent + endindex;
|
||||
|
||||
}
|
||||
|
||||
fileHelper.createFile(folderPath, pageName.toLowerCase(), htmlContent);
|
||||
i++;
|
||||
System.out.println(i + " file created ");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user