Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor3 #1121

Merged
merged 42 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
53f2600
Add Spring boot support
Mar 29, 2021
ecf327c
Merging Code in Springboot
Jul 14, 2021
6c02bb7
Correction of some tests
Jul 14, 2021
27ac2f3
Delete /SecurityUtilsTest.java
Janite Jul 14, 2021
b9eeca4
add enableEtl flag in application.yml
Janite Jul 14, 2021
1aca9c5
fix: renamed the module with correct name in build file
mayankgituni Jul 14, 2021
b0a340b
null pointer issue fix
justinapromore Jul 14, 2021
d1e915c
Minor chnages in integration test
Jul 15, 2021
32c3bbf
Fix pd
Jul 16, 2021
033725c
Minor fix
Jul 16, 2021
ab372b7
Added Keycloak support
Jul 20, 2021
d493697
Added login controller
Jul 20, 2021
8a12001
AP-2529 Refactor CSV Exporter to reduce memory footprint (#1107)
franklma Jul 20, 2021
3cef495
Minor bug fix
Jul 20, 2021
c79edc7
Merge branch 'refactor3' of github.com:apromore/ApromoreCore into ref…
Jul 20, 2021
8173ca0
Minor path change in js
Jul 20, 2021
c81d877
minor chnages to log dir in application
Jul 20, 2021
16410c0
fix: the css and impala error
mayanktomar20 Jul 21, 2021
2e8a2f7
fix: session issues
mayanktomar20 Jul 21, 2021
6d9f6eb
Minor fix in css and security
Jul 22, 2021
d158cca
Merge branch 'refactor3' of github.com:apromore/ApromoreCore into ref…
Jul 22, 2021
cdda924
Appl yaml
Jul 22, 2021
3ba1b6c
Changes in spring security
Jul 22, 2021
162980c
fix: links in UserAdminController and username error message for crea…
Janite Jul 23, 2021
d994fdd
Merge pull request #1113 from apromore/bugfix/AP-4245/Fix-create-user…
nolantellis Jul 23, 2021
7ab6bb5
AP-4284 Save BPMN Model on Process Discoverer is returning error (#1111)
franklma Jul 23, 2021
c7e58ca
Bugfix/AP-4292/select all select none labels switched (#1114)
Janite Jul 23, 2021
81b1cf2
Change properties
Jul 23, 2021
6ccf8a8
Merge branch 'refactor3' of github.com:apromore/ApromoreCore into ref…
Jul 23, 2021
6f4d3f9
Added docker-compose
Jul 23, 2021
bb29354
AP-3702 ordering of bpmn file
justinapromore Jul 23, 2021
c0dd222
fix etl menu item order and add a seperator before etl in menu
Janite Jul 26, 2021
7b4459a
Merge pull request #1117 from apromore/AP-4320/fix-etl-menu-item-order
nolantellis Jul 26, 2021
3199180
Added global handling
Jul 26, 2021
2a7c2bf
Merge branch 'refactor3' of github.com:apromore/ApromoreCore into ref…
Jul 26, 2021
9583d49
AP-4247 Hide buttons in PD according to user's access type to Log
Jul 26, 2021
cbd46f6
Merge dash changes from dev branch
Jul 26, 2021
7a9ddd8
Merge branch 'AP-4247-springboot' into refactor3
Jul 27, 2021
a8b423a
Comment secure flag for http
Jul 27, 2021
b4565a8
Merge branch 'refactor3' of github.com:apromore/ApromoreCore into ref…
Jul 27, 2021
caed31a
Fix minnnor bugs
Jul 27, 2021
dfe1bed
Merge development branch
Jul 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merging Code in Springboot
  • Loading branch information
Nolan Tellis committed Jul 15, 2021
commit ecf327ceb8431c51de725ece84d269b59fcb4ce0
10 changes: 5 additions & 5 deletions Apromore-Boot/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ site:

spring:
datasource:
password: MAcri
password: Apromore#!dev
# url: jdbc:h2:mem:Manager-Repository;DATABASE_TO_UPPER=FALSE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
url : jdbc:mysql://localhost:3307/apromore?createDatabaseIfNotExist=true&autoReconnect=true&allowMultiQueries=true&rewriteBatchedStatements=true&characterEncoding=utf-8&serverTimezone=GMT%2B10
username: root
url : jdbc:mysql://localhost:3306/apromore?createDatabaseIfNotExist=true&autoReconnect=true&allowMultiQueries=true&rewriteBatchedStatements=true&characterEncoding=utf-8&serverTimezone=GMT%2B10
username: apromore
jpa:
hibernate:
ddl-auto: none
Expand All @@ -148,8 +148,8 @@ spring:
liquibase:
change-log: classpath:db/migration/changeLog.yaml
contexts: MYSQL
password: MAcri
user: root
password: Apromore#!dev
user: liquibase_user


storage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;

import javax.transaction.Transactional;

import org.apromore.calendar.exception.CalendarAlreadyExistsException;
import org.apromore.calendar.exception.CalendarNotExistsException;
import org.apromore.calendar.model.CalendarModel;
Expand All @@ -48,188 +46,197 @@
import org.apromore.dao.model.Holiday;
import org.apromore.dao.model.WorkDay;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import lombok.Data;

@Data
@Service
@Transactional
public class CustomCalendarService implements CalendarService {

@Autowired
public CustomCalendarRepository calendarRepo;
@Autowired
public CustomCalendarRepository calendarRepo;

@Autowired
public CustomCalendarInfoRepository calendarInfoRepo;
@Autowired
public CustomCalendarInfoRepository calendarInfoRepo;

@Autowired
public HolidayRepository holidayRepository;
@Autowired
public HolidayRepository holidayRepository;

@Autowired
private CustomMapper modelMapper;
@Autowired
@Qualifier("customMapper")
private CustomMapper modelMapper;

@Override
public CalendarModel createGenericCalendar(String description, boolean weekendsOff, String zoneId)
throws CalendarAlreadyExistsException {
@Override
public CalendarModel createGenericCalendar(String description, boolean weekendsOff, String zoneId)
throws CalendarAlreadyExistsException {

OffsetTime startTime = OffsetTime.of(LocalTime.MIN, ZoneId.of(zoneId).getRules().getOffset(Instant.now()));
OffsetTime startTime =
OffsetTime.of(LocalTime.MIN, ZoneId.of(zoneId).getRules().getOffset(Instant.now()));

OffsetTime endTime = OffsetTime.of(LocalTime.MAX, ZoneId.of(zoneId).getRules().getOffset(Instant.now()));
OffsetTime endTime =
OffsetTime.of(LocalTime.MAX, ZoneId.of(zoneId).getRules().getOffset(Instant.now()));

CustomCalendar customCalendar = createCalendar(description, weekendsOff, startTime, endTime);
CalendarModel calendarModel = modelMapper.getMapper().map(customCalendar, CalendarModel.class);
return calendarModel;
}
CustomCalendar customCalendar = createCalendar(description, weekendsOff, startTime, endTime);
CalendarModel calendarModel = modelMapper.getMapper().map(customCalendar, CalendarModel.class);
return calendarModel;
}

@Override
public CalendarModel createBusinessCalendar(String description, boolean weekendsOff, String zoneId)
throws CalendarAlreadyExistsException {
@Override
public CalendarModel createBusinessCalendar(String description, boolean weekendsOff,
String zoneId) throws CalendarAlreadyExistsException {

OffsetTime startTime = OffsetTime.of(LocalTime.of(9, 0), ZoneId.of(zoneId).getRules().getOffset(Instant.now()));
OffsetTime endTime = OffsetTime.of(LocalTime.of(17, 0), ZoneId.of(zoneId).getRules().getOffset(Instant.now()));
OffsetTime startTime =
OffsetTime.of(LocalTime.of(9, 0), ZoneId.of(zoneId).getRules().getOffset(Instant.now()));
OffsetTime endTime =
OffsetTime.of(LocalTime.of(17, 0), ZoneId.of(zoneId).getRules().getOffset(Instant.now()));

CustomCalendar customCalendar = createCalendar(description, weekendsOff, startTime, endTime);
CalendarModel calendarModel = modelMapper.getMapper().map(customCalendar, CalendarModel.class);
CustomCalendar customCalendar = createCalendar(description, weekendsOff, startTime, endTime);
CalendarModel calendarModel = modelMapper.getMapper().map(customCalendar, CalendarModel.class);

return calendarModel;
return calendarModel;

}
}

@Override
public CalendarModel getCalendar(Long id) {
@Override
public CalendarModel getCalendar(Long id) {

return modelMapper.getMapper().map(calendarRepo.findById(id).orElse(null), CalendarModel.class);
return modelMapper.getMapper().map(calendarRepo.findById(id).orElse(null), CalendarModel.class);

}

@Override
public List<CalendarModel> getCalendars() {
}

List<CustomCalendarInfo> calendarInfos = calendarInfoRepo.findAll();
List<CalendarModel> calendarModels = new ArrayList<CalendarModel>();
@Override
public List<CalendarModel> getCalendars() {

for (CustomCalendarInfo info : calendarInfos) {
calendarModels.add(modelMapper.getMapper().map(info, CalendarModel.class));
}

return calendarModels;
List<CustomCalendarInfo> calendarInfos = calendarInfoRepo.findAll();
List<CalendarModel> calendarModels = new ArrayList<CalendarModel>();

for (CustomCalendarInfo info : calendarInfos) {
calendarModels.add(modelMapper.getMapper().map(info, CalendarModel.class));
}

private CustomCalendar createCalendar(String description, boolean weekendsOff, OffsetTime start, OffsetTime end)
throws CalendarAlreadyExistsException {
return calendarModels;

}

validateCalendarExists(calendarRepo.findByName(description));
private CustomCalendar createCalendar(String description, boolean weekendsOff, OffsetTime start,
OffsetTime end) throws CalendarAlreadyExistsException {

final CustomCalendar calendar = new CustomCalendar(description);
for (WorkDay workDay : getWorkDays(start, end, weekendsOff)) {
calendar.addWorkDay(workDay);
}
CustomCalendar newcalendar = calendarRepo.saveAndFlush(calendar);
return newcalendar;
validateCalendarExists(calendarRepo.findByName(description));

final CustomCalendar calendar = new CustomCalendar(description);
for (WorkDay workDay : getWorkDays(start, end, weekendsOff)) {
calendar.addWorkDay(workDay);
}
CustomCalendar newcalendar = calendarRepo.saveAndFlush(calendar);
return newcalendar;

private List<WorkDay> getWorkDays(OffsetTime start, OffsetTime end, boolean weekendOff) {
}

Predicate<DayOfWeek> isWeekendOff = CalendarUtil.getWeekendOffPRedicate(weekendOff);
List<WorkDay> workDaysList = new ArrayList<WorkDay>();
private List<WorkDay> getWorkDays(OffsetTime start, OffsetTime end, boolean weekendOff) {

for (DayOfWeek dayOfWeek : DayOfWeek.values()) {
workDaysList.add(new WorkDay(dayOfWeek, start, end, !isWeekendOff.test(dayOfWeek)));
}
return workDaysList;
Predicate<DayOfWeek> isWeekendOff = CalendarUtil.getWeekendOffPRedicate(weekendOff);
List<WorkDay> workDaysList = new ArrayList<WorkDay>();

for (DayOfWeek dayOfWeek : DayOfWeek.values()) {
workDaysList.add(new WorkDay(dayOfWeek, start, end, !isWeekendOff.test(dayOfWeek)));
}
return workDaysList;

private void validateCalendarExists(CustomCalendar calendar) throws CalendarAlreadyExistsException {
}

if (calendar != null) {
throw new CalendarAlreadyExistsException("Calendar already exists");
}
private void validateCalendarExists(CustomCalendar calendar)
throws CalendarAlreadyExistsException {

if (calendar != null) {
throw new CalendarAlreadyExistsException("Calendar already exists");
}

public void updateHoliday(Long id, List<HolidayModel> holidayModels) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);
}

List<Holiday> holidays = new ArrayList<Holiday>();
for (HolidayModel h : holidayModels) {
holidays.add(new Holiday(h.getId(), h.getName(), h.getDescription(), h.getHolidayDate(),
HOLIDAYTYPE.valueOf(h.getHolidayType())));
}

calendar.getHolidays().clear();
for (Holiday holiday : holidays) {
calendar.addHoliday(holiday);
}
calendarRepo.saveAndFlush(calendar);
public void updateHoliday(Long id, List<HolidayModel> holidayModels)
throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);

List<Holiday> holidays = new ArrayList<Holiday>();
for (HolidayModel h : holidayModels) {
holidays.add(new Holiday(h.getId(), h.getName(), h.getDescription(), h.getHolidayDate(),
HOLIDAYTYPE.valueOf(h.getHolidayType())));
}

private CustomCalendar getExistingCalendar(Long id) throws CalendarNotExistsException {
CustomCalendar calendar = calendarRepo.findById(id).orElse(null);

if (calendar == null) {
throw new CalendarNotExistsException("calendar does not exist");
}
return calendar;
calendar.getHolidays().clear();
for (Holiday holiday : holidays) {
calendar.addHoliday(holiday);
}
calendarRepo.saveAndFlush(calendar);

public void removeHoliday(Long id, List<Long> holidayIds) {
}

List<Holiday> holidays = new ArrayList<Holiday>();
// Bad way to delete, but we need to upgrade jpa of springs to make use of
// better ways of delete
for (Long idLong : holidayIds) {
holidayRepository.deleteById(idLong);

}
private CustomCalendar getExistingCalendar(Long id) throws CalendarNotExistsException {
CustomCalendar calendar = calendarRepo.findById(id).orElse(null);

if (calendar == null) {
throw new CalendarNotExistsException("calendar does not exist");
}
return calendar;
}

public void removeHoliday(Long id, List<Long> holidayIds) {

@Override
public void deleteCalendar(Long calendarId) {
calendarRepo.deleteById(calendarId);
List<Holiday> holidays = new ArrayList<Holiday>();
// Bad way to delete, but we need to upgrade jpa of springs to make use of
// better ways of delete
for (Long idLong : holidayIds) {
holidayRepository.deleteById(idLong);

}

@Override
public void updateCalendarName(Long id, String calendarName) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);
}

calendar.setName(calendarName);
@Override
public void deleteCalendar(Long calendarId) {
calendarRepo.deleteById(calendarId);

calendarRepo.save(calendar);
}

}
@Override
public void updateCalendarName(Long id, String calendarName) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);

calendar.setName(calendarName);

@Override
public void updateWorkDays(Long id, List<WorkDayModel> workDayModels) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);
calendarRepo.save(calendar);

List<WorkDay> workDays = new ArrayList<WorkDay>();
for (WorkDayModel w : workDayModels) {
}

workDays.add(new WorkDay(w.getId(), w.getDayOfWeek(), w.getStartTime(), w.getEndTime(), w.isWorkingDay()));
}
@Override
public void updateWorkDays(Long id, List<WorkDayModel> workDayModels)
throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);

calendar.getWorkDays().clear();
for (WorkDay workDay : workDays) {
calendar.addWorkDay(workDay);
}
calendarRepo.saveAndFlush(calendar);
List<WorkDay> workDays = new ArrayList<WorkDay>();
for (WorkDayModel w : workDayModels) {

workDays.add(new WorkDay(w.getId(), w.getDayOfWeek(), w.getStartTime(), w.getEndTime(),
w.isWorkingDay()));
}

@Override
public void updateZoneInfo(Long id, String zoneId) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);
calendar.setZoneId(zoneId);
calendarRepo.save(calendar);
calendar.getWorkDays().clear();
for (WorkDay workDay : workDays) {
calendar.addWorkDay(workDay);
}
calendarRepo.saveAndFlush(calendar);

}

@Override
public void updateZoneInfo(Long id, String zoneId) throws CalendarNotExistsException {
CustomCalendar calendar = getExistingCalendar(id);
calendar.setZoneId(zoneId);
calendarRepo.save(calendar);
}

}
//public WorkDay(Long id,DayOfWeek dayOfWeek, OffsetTime startTime, OffsetTime endTime,
// boolean isWorkingDay) {
// public WorkDay(Long id,DayOfWeek dayOfWeek, OffsetTime startTime, OffsetTime endTime,
// boolean isWorkingDay) {
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class ConfigBean {
private boolean sanitizationEnabled = false;
private Site site = new Site();

private int maxEventCount = 1000000;

@Data
public class Site {
private String editor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@
<!-- <listener-class>org.apromore.zk.ApromoreDesktopCleanup</listener-class> -->
<!-- </listener> -->

<listener>
<listener-class>org.apromore.portal.ApromoreZKListener</listener-class>
</listener>

<listener>
<listener-class>org.apromore.portal.LoggingZKListener</listener-class>
Expand Down
Loading