Skip to content

Commit

Permalink
1275 Calendar events without attached documents
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Aug 7, 2024
1 parent 46a1665 commit 350f38a
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,23 @@ public class GUICalendarEvent implements Serializable {

private String location = "";

private Date startDate = new Date();
private Date start = new Date();

private Date expirationDate = null;
private Date end = null;

private List<GUIUser> participants = new ArrayList<>();
private List<GUIUser> attendees = new ArrayList<>();

private List<GUIGroup> participantsGroups = new ArrayList<>();

public List<GUIGroup> getParticipantsGroups() {
return participantsGroups;
}

public void setParticipantsGroups(List<GUIGroup> participantsGroups) {
this.participantsGroups = participantsGroups;
}
private List<GUIGroup> attendeesGroups = new ArrayList<>();

private List<GUIDocument> documents = new ArrayList<>();

private List<GUIReminder> reminders = new ArrayList<>();

private int frequency = 0;

private long creatorId;
private long organizerId;

private String creator;
private String organizer;

private int status = 0;

Expand Down Expand Up @@ -111,20 +103,20 @@ public void setDescription(String description) {
this.description = description;
}

public Date getStartDate() {
return startDate;
public Date getStart() {
return start;
}

public void setStartDate(Date startDate) {
this.startDate = startDate;
public void setStart(Date startDate) {
this.start = startDate;
}

public Date getExpirationDate() {
return expirationDate;
public Date getEnd() {
return end;
}

public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
public void setEnd(Date expirationDate) {
this.end = expirationDate;
}

public List<GUIDocument> getDocuments() {
Expand All @@ -143,50 +135,50 @@ public void setFrequency(int frequency) {
this.frequency = frequency;
}

public GUIUser getParticipant(long id) {
for (GUIUser guiUser : participants) {
public GUIUser getAttendee(long id) {
for (GUIUser guiUser : attendees) {
if (guiUser.getId() == id)
return guiUser;
}
return null;
}

public GUIGroup getParticipantGroup(long id) {
for (GUIGroup guiGroup : participantsGroups) {
public GUIGroup getAttendeeGroup(long id) {
for (GUIGroup guiGroup : attendeesGroups) {
if (guiGroup.getId() == id)
return guiGroup;
}
return null;
}

public void addParticipant(GUIUser newPart) {
if (getParticipant(newPart.getId()) != null)
public void addAttendee(GUIUser newPart) {
if (getAttendee(newPart.getId()) != null)
return;
participants.add(newPart);
attendees.add(newPart);
}

public void addParticipant(GUIGroup newPart) {
if (getParticipantGroup(newPart.getId()) != null)
public void addAttendee(GUIGroup newPart) {
if (getAttendeeGroup(newPart.getId()) != null)
return;
participantsGroups.add(newPart);
attendeesGroups.add(newPart);
}

public void removeParticipant(long id) {
public void removeAttendee(long id) {
List<GUIUser> newParts = new ArrayList<>();
for (GUIUser guiUser : participants) {
for (GUIUser guiUser : attendees) {
if (id != guiUser.getId())
newParts.add(guiUser);
}
participants = newParts;
attendees = newParts;
}

public void removeParticipantGroup(long id) {
public void removeAttendeeGroup(long id) {
List<GUIGroup> newParts = new ArrayList<>();
for (GUIGroup guiGroup : participantsGroups) {
for (GUIGroup guiGroup : attendeesGroups) {
if (id != guiGroup.getId())
newParts.add(guiGroup);
}
participantsGroups = newParts;
attendeesGroups = newParts;

}

Expand Down Expand Up @@ -217,28 +209,28 @@ public void addReminder(GUIReminder reminder) {
reminders.add(reminder);
}

public long getCreatorId() {
return creatorId;
public long getOrganizerId() {
return organizerId;
}

public void setCreatorId(long creatorId) {
this.creatorId = creatorId;
public void setOrganizerId(long creatorId) {
this.organizerId = creatorId;
}

public String getCreator() {
return creator;
public String getOrganizer() {
return organizer;
}

public void setCreator(String creator) {
this.creator = creator;
public void setOrganizer(String creator) {
this.organizer = creator;
}

public List<GUIUser> getParticipants() {
return participants;
public List<GUIUser> getAttendees() {
return attendees;
}

public void setParticipants(List<GUIUser> participants) {
this.participants = participants;
public void setAttendees(List<GUIUser> attendees) {
this.attendees = attendees;
}

public int getStatus() {
Expand Down Expand Up @@ -312,4 +304,12 @@ public String getLocation() {
public void setLocation(String location) {
this.location = location;
}

public List<GUIGroup> getAttendeesGroups() {
return attendeesGroups;
}

public void setAttendeesGroups(List<GUIGroup> attendeesGroups) {
this.attendeesGroups = attendeesGroups;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ public GUICalendarEventSearchCriteria(Date startDate, Date endDate, Date expireF
this.frequency = frequency;
}

public Date getStartDate() {
public Date getStart() {
return startDate;
}

public void setStartDate(Date startDate) {
this.startDate = startDate;
}

public Date getEndDate() {
public Date getEnd() {
return endDate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public static TextItem newFolderSelectorForAttribute(String name, String title,
public static SelectItem newUserSelectorForAttribute(String name, String title, String groupIdOrName,
List<FormItemIcon> additionalIcons) {
return new UserSelector("_" + name.replace(" ", Constants.BLANK_PLACEHOLDER), title, groupIdOrName, false, true,
additionalIcons);
true, additionalIcons);
}

public static StaticTextItem newDocumentSelectorForAttribute(String name, String title,
Expand Down Expand Up @@ -883,7 +883,12 @@ public static SelectItem newGroupSelector(String name, String title) {

public static SelectItem newUserSelector(String name, String title, String groupIdOrName, boolean required,
boolean skipDisabled) {
return new UserSelector(name, title, groupIdOrName, !required, skipDisabled, null);
return newUserSelector(name, title, groupIdOrName, !required, skipDisabled, true);
}

public static SelectItem newUserSelector(String name, String title, String groupIdOrName, boolean required,
boolean skipDisabled, boolean withClear) {
return new UserSelector(name, title, groupIdOrName, !required, skipDisabled, withClear, null);
}

public static SelectItem newTenantSelector() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ public class UserSelector extends SelectItem {
private static final String USERNAME = "username";

public UserSelector(String name, String title, String groupIdOrName, boolean allowNull, boolean skipDisabled) {
this(name, title, groupIdOrName, allowNull, skipDisabled, null);
this(name, title, groupIdOrName, allowNull, skipDisabled, true, null);
}

public UserSelector(String name, String title, String groupIdOrName, boolean allowNull, boolean skipDisabled, boolean withClear) {
this(name, title, groupIdOrName, allowNull, skipDisabled, withClear, null);
}

public UserSelector(String name, String title, String groupIdOrName, boolean allowNull, boolean skipDisabled,
List<FormItemIcon> additionalIcons) {
boolean withClear, List<FormItemIcon> additionalIcons) {
setName(name);
setTitle(I18N.message(title));
setWrapTitle(false);

ListGridField id = new ListGridField("id", I18N.message("id"));
id.setHidden(true);
ListGridField username = new ListGridField(USERNAME, I18N.message(USERNAME));
Expand Down Expand Up @@ -64,7 +68,8 @@ public UserSelector(String name, String title, String groupIdOrName, boolean all
search.setHeight(12);

List<FormItemIcon> icons = new ArrayList<>();
icons.add(clear);
if (withClear)
icons.add(clear);
if (groupIdOrName == null || "".equals(groupIdOrName))
icons.add(search);
if (additionalIcons != null && !additionalIcons.isEmpty())
Expand Down
Loading

0 comments on commit 350f38a

Please sign in to comment.