FINERACT-2239: New command processing - resource notes

This commit is contained in:
Aleksandar Vidakovic
2026-02-11 00:15:27 +01:00
committed by Aleksandar Vidakovic
parent 28f63cc20e
commit 02fb166b5b
39 changed files with 763 additions and 882 deletions
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.infrastructure.cache.data;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -28,7 +30,10 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
@Data
@NoArgsConstructor
@AllArgsConstructor
public final class CacheData {
public final class CacheData implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private EnumOptionData cacheType;
@@ -0,0 +1,48 @@
/**
* 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.note.data;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fineract.portfolio.note.domain.NoteType;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteCreateRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Hidden
private Long resourceId;
@Hidden
private NoteType type;
@Size(max = 1000, message = "{org.apache.fineract.portfolio.note.note.size}")
@NotNull(message = "{org.apache.fineract.portfolio.note.note.not-null}")
private String note;
}
@@ -0,0 +1,40 @@
/**
* 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.note.data;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteCreateResponse implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long entityId;
private Long officeId;
private Long resourceId;
}
@@ -18,31 +18,37 @@
*/
package org.apache.fineract.portfolio.note.data;
import java.io.Serial;
import java.io.Serializable;
import java.time.OffsetDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
/**
* Immutable data object represent note or case information about a client, loan or loan transaction.
*/
@Getter
@Builder
public class NoteData {
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteData implements Serializable {
private final Long id;
private final Long clientId;
private final Long groupId;
private final Long loanId;
private final Long loanTransactionId;
private final Long depositAccountId;
private final Long savingAccountId;
private final EnumOptionData noteType;
private final String note;
private final Long createdById;
private final String createdByUsername;
private final OffsetDateTime createdOn;
private final Long updatedById;
private final String updatedByUsername;
private final OffsetDateTime updatedOn;
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Long clientId;
private Long groupId;
private Long loanId;
private Long loanTransactionId;
private Long depositAccountId;
private Long savingAccountId;
private EnumOptionData noteType;
private String note;
private Long createdById;
private String createdByUsername;
private OffsetDateTime createdOn;
private Long updatedById;
private String updatedByUsername;
private OffsetDateTime updatedOn;
}
@@ -0,0 +1,45 @@
/**
* 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.note.data;
import io.swagger.v3.oas.annotations.Hidden;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fineract.portfolio.note.domain.NoteType;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteDeleteRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Hidden
private Long id;
@Hidden
private Long resourceId;
@Hidden
private NoteType type;
}
@@ -0,0 +1,38 @@
/**
* 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.note.data;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteDeleteResponse implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long resourceId;
}
@@ -0,0 +1,50 @@
/**
* 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.note.data;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fineract.portfolio.note.domain.NoteType;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteUpdateRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Hidden
private Long id;
@Hidden
private Long resourceId;
@Hidden
private NoteType type;
@Size(max = 1000, message = "{org.apache.fineract.portfolio.note.note.size}")
@NotNull(message = "{org.apache.fineract.portfolio.note.note.not-null}")
private String note;
}
@@ -0,0 +1,41 @@
/**
* 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.note.data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NoteUpdateResponse implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long officeId;
private Long resourceId;
private Map<String, Object> changes;
}
@@ -18,19 +18,18 @@
*/
package org.apache.fineract.portfolio.note.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.note.data.NoteCreateRequest;
import org.apache.fineract.portfolio.note.data.NoteCreateResponse;
import org.apache.fineract.portfolio.note.data.NoteDeleteRequest;
import org.apache.fineract.portfolio.note.data.NoteDeleteResponse;
import org.apache.fineract.portfolio.note.data.NoteUpdateRequest;
import org.apache.fineract.portfolio.note.data.NoteUpdateResponse;
public interface NoteWritePlatformService {
CommandProcessingResult createNote(JsonCommand command);
NoteCreateResponse createNote(NoteCreateRequest request);
void createLoanTransactionNote(Long loanTransactionId, String note);
NoteUpdateResponse updateNote(NoteUpdateRequest request);
CommandProcessingResult updateNote(JsonCommand command);
CommandProcessingResult deleteNote(JsonCommand command);
void createAndPersistClientNote(Client client, JsonCommand command);
NoteDeleteResponse deleteNote(NoteDeleteRequest request);
}