FINERACT-2169: Refactor calendar controller and service;

This commit is contained in:
viktorpavlenko
2025-04-10 10:59:59 +02:00
committed by Adam Saghy
parent 64b453e9ab
commit 3260f76ca7
6 changed files with 107 additions and 118 deletions
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.calendar.data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalTime;
@@ -42,6 +43,9 @@ import org.apache.fineract.portfolio.common.domain.NthDayType;
@Accessors(chain = true)
public final class CalendarData implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Long calendarInstanceId;
private Long entityId;
@@ -0,0 +1,42 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.calendar.data.request;
import java.io.Serial;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class CalendarRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String repeatsOnDay;
private String dateFormat;
private String repeating;
private String interval;
private String typeId;
private String locale;
private String title;
private String startDate;
private String frequency;
}
@@ -20,7 +20,9 @@ package org.apache.fineract.portfolio.calendar.domain;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
@Getter
public enum CalendarEntityType {
INVALID(0, "calendarEntityType.invalid"), //
@@ -40,16 +42,10 @@ public enum CalendarEntityType {
this.code = code;
}
public Integer getValue() {
return this.value;
}
public String getCode() {
return this.code;
}
private static final Map<Integer, CalendarEntityType> intToEnumMap = new HashMap<>();
@Getter
private static int minValue;
@Getter
private static int maxValue;
static {
@@ -70,21 +66,12 @@ public enum CalendarEntityType {
}
public static CalendarEntityType fromInt(final int i) {
final CalendarEntityType entityType = intToEnumMap.get(Integer.valueOf(i));
return entityType;
}
public static int getMinValue() {
return minValue;
}
public static int getMaxValue() {
return maxValue;
return intToEnumMap.get(i);
}
@Override
public String toString() {
return name().toString();
return name();
}
public static boolean isGroup(final Integer value) {