|
28 | 28 |
|
29 | 29 | import java.util.ArrayList; |
30 | 30 |
|
31 | | - |
| 31 | +/** |
| 32 | + * Represents a generic object within the application that can have tags associated with it. |
| 33 | + * This class acts as a data transfer object (DTO) to bundle an object's identity |
| 34 | + * with a list of tags that have been assigned to it. It is used to manage the |
| 35 | + * relationship between any taggable item and its tags. |
| 36 | + */ |
32 | 37 | public class TagObject { |
| 38 | + /** |
| 39 | + * A list of tags that are currently assigned to this object. |
| 40 | + * Note: This is a raw {@link ArrayList} for compatibility with older Java versions. |
| 41 | + * It is intended to store a collection of {@link String} objects, where each string |
| 42 | + * is the name of a {@link Tag}. |
| 43 | + */ |
33 | 44 | private ArrayList assignedTags; |
| 45 | + /** |
| 46 | + * The unique identifier for the object being tagged. This ID allows the application |
| 47 | + * to retrieve the specific instance of the object from the database or another data source. |
| 48 | + * For example, this could be a patient's demographic number or a unique ID for a document. |
| 49 | + */ |
34 | 50 | private String objectId; |
| 51 | + /** |
| 52 | + * The fully qualified class name of the object being tagged (e.g., "ca.openosp.demographic.Demographic"). |
| 53 | + * This provides crucial context, allowing the application to know what type of object |
| 54 | + * the {@link #objectId} refers to. |
| 55 | + */ |
35 | 56 | private String objectClass; |
36 | 57 |
|
| 58 | + /** |
| 59 | + * Assigns a new tag to this object by adding the tag's name to the list of assigned tags. |
| 60 | + * This is a convenience method that simplifies the process of adding a single tag. |
| 61 | + * |
| 62 | + * @param tagName The name of the tag to be assigned. This should correspond to the |
| 63 | + * {@link Tag#tagName} of an existing tag. |
| 64 | + */ |
37 | 65 | public void assignTag(String tagName) { |
38 | 66 | getAssignedTags().add(tagName); |
39 | 67 | } |
40 | 68 |
|
| 69 | + /** |
| 70 | + * Retrieves the list of tags that have been assigned to this object. |
| 71 | + * The list contains the names of the tags as {@link String}s. |
| 72 | + * |
| 73 | + * @return An {@link ArrayList} of {@link String}s, where each string is the name of an assigned tag. |
| 74 | + * Returns the underlying list directly. |
| 75 | + */ |
41 | 76 | public ArrayList getAssignedTags() { |
42 | 77 | return assignedTags; |
43 | 78 | } |
44 | 79 |
|
| 80 | + /** |
| 81 | + * Sets the list of assigned tags for this object. This method will replace any |
| 82 | + * existing list of tags with the one provided. |
| 83 | + * |
| 84 | + * @param assignedTags An {@link ArrayList} containing the names (as {@link String}s) |
| 85 | + * of all tags to be assigned to this object. |
| 86 | + */ |
45 | 87 | public void setAssignedTags(ArrayList assignedTags) { |
46 | 88 | this.assignedTags = assignedTags; |
47 | 89 | } |
48 | 90 |
|
| 91 | + /** |
| 92 | + * Retrieves the unique identifier of the object that this TagObject represents. |
| 93 | + * |
| 94 | + * @return A {@link String} containing the unique ID of the tagged object. |
| 95 | + */ |
49 | 96 | public String getObjectId() { |
50 | 97 | return objectId; |
51 | 98 | } |
52 | 99 |
|
| 100 | + /** |
| 101 | + * Sets the unique identifier of the object that this TagObject represents. |
| 102 | + * |
| 103 | + * @param objectId A {@link String} containing the unique ID to be assigned to this object. |
| 104 | + */ |
53 | 105 | public void setObjectId(String objectId) { |
54 | 106 | this.objectId = objectId; |
55 | 107 | } |
56 | 108 |
|
| 109 | + /** |
| 110 | + * Retrieves the fully qualified class name of the object that this TagObject represents. |
| 111 | + * This helps in identifying what kind of entity is being tagged. |
| 112 | + * |
| 113 | + * @return A {@link String} containing the class name of the tagged object. |
| 114 | + */ |
57 | 115 | public String getObjectClass() { |
58 | 116 | return objectClass; |
59 | 117 | } |
60 | 118 |
|
| 119 | + /** |
| 120 | + * Sets the fully qualified class name of the object that this TagObject represents. |
| 121 | + * |
| 122 | + * @param objectClass A {@link String} containing the fully qualified class name of the object. |
| 123 | + */ |
61 | 124 | public void setObjectClass(String objectClass) { |
62 | 125 | this.objectClass = objectClass; |
63 | 126 | } |
|
0 commit comments