Skip to content

Commit a977b4d

Browse files
Merge pull request #68
Enhance JavaDoc comments across multiple interfaces for improved clarity and documentation
2 parents ae1e0d8 + c43756e commit a977b4d

13 files changed

Lines changed: 207 additions & 13 deletions

File tree

examples/demo-zk-books/src/main/java/mybookstore/repositories/BookRepository.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77

88
import java.util.Optional;
99

10+
/**
11+
* Repository for {@link Book} entities exposed as a REST resource.
12+
*/
1013
@RepositoryRestResource(path = "books")
11-
1214
public interface BookRepository extends JpaRepository<Book, Long> {
1315

16+
/**
17+
* Finds a book by id using a cache-backed lookup.
18+
*
19+
* @param id the book identifier
20+
* @return an optional containing the matching book when found
21+
*/
1422
@Override
1523
@Cacheable(cacheNames = "books", key = "'book_'+#id")
1624
Optional<Book> findById(Long id);

extensions/dashboard/sources/src/main/java/tools/dynamia/modules/dashboard/UserInfoProvider.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,54 @@
1919

2020
import java.util.List;
2121

22+
/**
23+
* Provides user identity and authorization data for dashboard runtime decisions.
24+
* Implementations are used by widgets and dashboard services to evaluate visibility,
25+
* permissions, and user-specific behavior.
26+
*/
2227
public interface UserInfoProvider {
2328

29+
/**
30+
* Returns the current authenticated username.
31+
*
32+
* @return the username associated with the current user context
33+
*/
2434
String getUsername();
2535

36+
/**
37+
* Indicates whether the current user has administrative privileges.
38+
*
39+
* @return {@code true} when the user is an administrator
40+
*/
2641
boolean isAdmin();
2742

43+
/**
44+
* Checks if the current user has the specified role.
45+
*
46+
* @param roleName the role name to verify
47+
* @return {@code true} when the user is assigned to the role
48+
*/
2849
boolean hasRole(String roleName);
2950

51+
/**
52+
* Checks if the current user has the specified grant/permission.
53+
*
54+
* @param grant the grant identifier to verify
55+
* @return {@code true} when the user has the grant
56+
*/
3057
boolean hasGrant(String grant);
3158

59+
/**
60+
* Returns the location identifier associated with the current user.
61+
*
62+
* @return the user location id, or {@code null} when not applicable
63+
*/
3264
Long getUserLocation();
3365

66+
/**
67+
* Returns all role names assigned to the current user.
68+
*
69+
* @return a list of user role names
70+
*/
3471
List<String> getUserRoles();
3572
}

extensions/entity-files/sources/core/src/main/java/tools/dynamia/modules/entityfile/EntityFileAccountProvider.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,27 @@
2121
import tools.dynamia.modules.entityfile.domain.EntityFile;
2222

2323
/**
24-
*
25-
* @author Mario Serrano Leones
24+
* Resolves tenant/account context for entity-file operations.
25+
* Implementations provide the current account id and can validate whether
26+
* a specific {@link EntityFile} belongs to a valid account scope.
2627
*/
2728
public interface EntityFileAccountProvider {
2829

2930
/**
30-
* Return current account Id for tenant
31+
* Returns the current tenant account identifier.
3132
*
32-
* @return account id
33+
* @return the current account id
3334
*/
3435
Long getAccountId();
3536

3637

3738
/**
38-
* Check is the account id is valid, by default just validate if account id not null
39+
* Validates whether the given entity file has a usable account id.
40+
* The default implementation checks that the entity file is not null,
41+
* account id is not null, and account id is greater than zero.
3942
*
40-
* @param entityFile
41-
* @return valid
43+
* @param entityFile the entity file to validate
44+
* @return {@code true} when the file has a valid account id
4245
*/
4346
default boolean isValidEntityFile(EntityFile entityFile) {
4447
return entityFile != null && entityFile.getAccountId() != null && entityFile.getAccountId() > 0;

extensions/entity-files/sources/core/src/main/java/tools/dynamia/modules/entityfile/EntityFileStorage.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,55 @@
1919

2020
import tools.dynamia.modules.entityfile.domain.EntityFile;
2121

22+
/**
23+
* Defines the contract for storing and retrieving files associated with domain entities.
24+
* Implementations may use local storage, cloud providers, or any custom backend.
25+
*/
2226
public interface EntityFileStorage {
2327

28+
/**
29+
* Returns the unique technical identifier of this storage implementation.
30+
*
31+
* @return the storage identifier, used internally to select the implementation
32+
*/
2433
String getId();
2534

35+
/**
36+
* Returns the human-readable name of this storage implementation.
37+
*
38+
* @return display name for logs, configuration, or UI labels
39+
*/
2640
String getName();
2741

42+
/**
43+
* Uploads and persists the provided file information for the given entity file record.
44+
*
45+
* @param entityFile the entity file metadata to be updated with storage information
46+
* @param fileInfo metadata and stream details of the file to upload
47+
*/
2848
void upload(EntityFile entityFile, UploadedFileInfo fileInfo);
2949

50+
/**
51+
* Downloads the previously stored file associated with the given entity file record.
52+
*
53+
* @param entityFile the entity file metadata used to locate the stored file
54+
* @return the stored file content and metadata
55+
*/
3056
StoredEntityFile download(EntityFile entityFile);
3157

58+
/**
59+
* Deletes the stored file associated with the given entity file record.
60+
*
61+
* @param entityFile the entity file metadata used to locate and remove the stored file
62+
*/
3263
void delete(EntityFile entityFile);
3364

65+
/**
66+
* Reloads storage-specific runtime parameters.
67+
* <p>
68+
* Implementations can override this method when they need to refresh dynamic
69+
* settings (for example, credentials, endpoints, or bucket names) without restart.
70+
*/
3471
default void reloadParams(){
3572

3673
}

extensions/file-importer/sources/core/src/main/java/tools/dynamia/modules/importer/ImportBeanParser.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,20 @@
1919

2020
import org.apache.poi.ss.usermodel.Row;
2121

22+
/**
23+
* Functional contract for converting a spreadsheet {@link Row} into a domain object.
24+
*
25+
* @param <T> the target object type produced from each row
26+
*/
2227
@FunctionalInterface
2328
public interface ImportBeanParser<T> {
2429

30+
/**
31+
* Parses a spreadsheet row into a typed object.
32+
*
33+
* @param row the row to parse
34+
* @return the parsed object instance
35+
*/
2536
T parse(Row row);
2637

2738
}

extensions/file-importer/sources/core/src/main/java/tools/dynamia/modules/importer/ImportReader.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@
1919

2020
import org.apache.poi.ss.usermodel.Row;
2121

22+
/**
23+
* Functional callback invoked for each imported spreadsheet {@link Row}.
24+
* Implementations typically perform side effects such as validation,
25+
* persistence, or aggregation.
26+
*/
2227
@FunctionalInterface
2328
public interface ImportReader {
2429

30+
/**
31+
* Processes a spreadsheet row.
32+
*
33+
* @param row the row to process
34+
*/
2535
void read(Row row);
2636

2737
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
package tools.dynamia.modules.reports.core;
22

3+
/**
4+
* Converts {@link ReportData} into a specific output representation.
5+
*
6+
* @param <T> the exported output type (for example, a map, DTO, or serialized structure)
7+
*/
38
public interface ReportDataExporter<T> {
9+
10+
/**
11+
* Exports the provided report data into the target representation.
12+
*
13+
* @param reportData the report data to transform
14+
* @return the exported representation of the report data
15+
*/
416
T export(ReportData reportData);
517
}

extensions/security/sources/core/src/main/java/tools/dynamia/modules/security/IgnoringSecurityMatcher.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515
package tools.dynamia.modules.security;
1616

1717
/**
18-
*
19-
* @author Mario Serrano Leones
18+
* Provides request matcher patterns that should bypass security filters.
19+
* Implementations are typically used to register public paths such as static
20+
* assets, health endpoints, or public APIs.
2021
*/
2122
public interface IgnoringSecurityMatcher {
2223

24+
/**
25+
* Returns the matcher expressions that must be ignored by security.
26+
*
27+
* @return an array of path matcher patterns
28+
*/
2329
String[] matchers();
2430

2531
}

extensions/security/sources/core/src/main/java/tools/dynamia/modules/security/LoginControllerInterceptor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@
1616
import jakarta.servlet.http.HttpServletRequest;
1717
import java.util.Map;
1818

19+
/**
20+
* Intercepts login controller rendering to customize model data or flow.
21+
* Implementations can inject additional attributes, flags, or contextual
22+
* values before the login view is rendered.
23+
*/
1924
public interface LoginControllerInterceptor {
2025

26+
/**
27+
* Called when the login controller is preparing the login page.
28+
*
29+
* @param request the current HTTP request
30+
* @param viewName the view name that will be rendered
31+
* @param params mutable model parameters for the login view
32+
*/
2133
void login(HttpServletRequest request, String viewName, Map<String, Object> params);
2234

2335

platform/core/commons/src/main/java/tools/dynamia/commons/Lambdas.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,37 @@
1414
public class Lambdas {
1515

1616

17+
/**
18+
* Consumer variant that allows checked exceptions.
19+
*
20+
* @param <T> the consumed value type
21+
*/
1722
@FunctionalInterface
1823
public interface ThrowingConsumer<T> {
24+
25+
/**
26+
* Performs this operation on the given argument.
27+
*
28+
* @param t the input argument
29+
* @throws Exception if processing fails
30+
*/
1931
void accept(T t) throws Exception;
2032
}
2133

34+
/**
35+
* Supplier variant that allows checked exceptions.
36+
*
37+
* @param <T> the supplied value type
38+
*/
2239
@FunctionalInterface
2340
public interface ThrowingSupplier<T> {
41+
42+
/**
43+
* Gets a result value.
44+
*
45+
* @return the supplied value
46+
* @throws Exception if value retrieval fails
47+
*/
2448
T get() throws Exception;
2549
}
2650

0 commit comments

Comments
 (0)