-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic structure for the new mirror type-safe API (Commands Proof …
…of Concept) - Made a unique command (Request & Response) for each http method. - Define a new way for locating the dedicated handlers. - Add basic structure for the new mirror type-safe API (Commands). - Add a new domain module for storing `Command` entity and add a repository for it. - Re-Implement the logic within the Note Write Service. - Get `403` Forbidden error when sending a request to `Commands` API.
- Loading branch information
Showing
57 changed files
with
2,132 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
description = 'The new generation of the API layer (v3): Command Core' | ||
|
||
group = 'org.apache.fineract.v3.command' | ||
|
||
archivesBaseName = 'fineract-custom-command-processing-core' | ||
|
||
apply from: 'dependencies.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
dependencies { | ||
implementation(project(':fineract-core')) | ||
implementation('org.springframework.boot:spring-boot-starter') | ||
compileOnly('org.eclipse.persistence:org.eclipse.persistence.jpa') | ||
} |
32 changes: 32 additions & 0 deletions
32
.../v3/command/core/src/main/java/org/apache/fineract/v3/command/core/CommandProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* 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.v3.command.core; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@Getter | ||
@Setter | ||
@ConfigurationProperties(prefix = "fineract.command") | ||
public class CommandProperties { | ||
|
||
private Boolean enabled = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 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. | ||
*/ | ||
description = 'The new generation of the API layer (v3): Command Data' | ||
|
||
group = 'org.apache.fineract.v3.command' | ||
|
||
archivesBaseName = 'fineract-custom-command-data' | ||
|
||
apply from: 'dependencies.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
dependencies { | ||
implementation(project(':fineract-core')) | ||
implementation('org.springframework.boot:spring-boot-starter') | ||
implementation('com.fasterxml.jackson.core:jackson-databind') | ||
} |
46 changes: 46 additions & 0 deletions
46
custom/v3/command/data/src/main/java/org/apache/fineract/v3/command/data/CommandRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* 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.v3.command.data; | ||
|
||
import java.io.Serial; | ||
import java.io.Serializable; | ||
import java.time.OffsetDateTime; | ||
import java.util.UUID; | ||
import lombok.Data; | ||
import lombok.experimental.FieldNameConstants; | ||
import lombok.experimental.SuperBuilder; | ||
import org.apache.fineract.commands.domain.CommandProcessingResultType; | ||
|
||
@Data | ||
@SuperBuilder | ||
@FieldNameConstants | ||
public class CommandRequest<T> implements Serializable { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1L; | ||
|
||
private UUID requestIdempotencyKey; | ||
private CommandProcessingResultType commandProcessingStatus; | ||
private String commandResult; | ||
private Integer resultStatusCode; | ||
private OffsetDateTime createdDate; | ||
private OffsetDateTime processedAt; | ||
private T requestBody; | ||
} |
46 changes: 46 additions & 0 deletions
46
...om/v3/command/data/src/main/java/org/apache/fineract/v3/command/data/CommandResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* 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.v3.command.data; | ||
|
||
import com.fasterxml.jackson.annotation.JsonUnwrapped; | ||
import java.io.Serial; | ||
import java.io.Serializable; | ||
import java.time.OffsetDateTime; | ||
import lombok.Data; | ||
import lombok.experimental.FieldNameConstants; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@SuperBuilder | ||
@FieldNameConstants | ||
public class CommandResponse<T> implements Serializable { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1L; | ||
|
||
private String tenantId; | ||
private Long userId; | ||
private String errorCode; | ||
private String errorMessage; | ||
private OffsetDateTime createdAt; | ||
|
||
@JsonUnwrapped | ||
private T data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 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. | ||
*/ | ||
description = 'The new generation of the API layer (v3): Command Domain' | ||
|
||
group = 'org.apache.fineract.v3.command' | ||
|
||
archivesBaseName = 'fineract-custom-command-domain' | ||
|
||
apply from: 'dependencies.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
dependencies { | ||
|
||
implementation(project(':fineract-core')) | ||
|
||
implementation('org.springframework.boot:spring-boot-starter-data-jpa') { | ||
exclude group: 'org.hibernate' | ||
} | ||
implementation('org.eclipse.persistence:org.eclipse.persistence.jpa') { | ||
exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence' | ||
} | ||
|
||
implementation( | ||
'org.springframework.boot:spring-boot-starter', | ||
'org.springframework.boot:spring-boot-starter-data-jdbc', | ||
'com.fasterxml.jackson.core:jackson-databind', | ||
) | ||
} |
73 changes: 73 additions & 0 deletions
73
custom/v3/command/domain/src/main/java/org/apache/fineract/v3/command/domain/Command.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* 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.v3.command.domain; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Convert; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Table; | ||
import java.time.OffsetDateTime; | ||
import java.util.UUID; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
import lombok.experimental.FieldNameConstants; | ||
import org.apache.fineract.commands.domain.CommandProcessingResultType; | ||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@FieldNameConstants | ||
@Accessors(chain = true) | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "m_command") | ||
public class Command extends AbstractPersistableCustom<Long> { | ||
|
||
@Column(name = "request_idempotency_key", nullable = false, unique = true) | ||
private UUID requestIdempotencyKey; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "command_processing_status") | ||
private CommandProcessingResultType commandProcessingStatus; | ||
|
||
@Column(name = "command_result") | ||
private String commandResult; | ||
|
||
@Column(name = "result_status_code") | ||
private Integer resultStatusCode; | ||
|
||
@Column(name = "created_date") | ||
private OffsetDateTime createdDate; | ||
|
||
@Column(name = "processed_at") | ||
private OffsetDateTime processedAt; | ||
|
||
@Column(name = "request_body") | ||
@Convert(converter = JsonNodeConverter.class) | ||
private JsonNode requestBody; | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...command/domain/src/main/java/org/apache/fineract/v3/command/domain/CommandRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 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.v3.command.domain; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
|
||
public interface CommandRepository extends JpaRepository<Command, Long>, JpaSpecificationExecutor<Command> {} |
Oops, something went wrong.