Skip to content

Commit

Permalink
display open calendar entries in case search preview. close #2083.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 6, 2023
1 parent ace15b4 commit 63a14ac
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,13 @@
import com.jdimension.jlawyer.client.settings.ClientSettings;
import com.jdimension.jlawyer.client.settings.UserSettings;
import com.jdimension.jlawyer.client.utils.ComponentUtils;
import com.jdimension.jlawyer.client.utils.StringUtils;
import com.jdimension.jlawyer.client.utils.TableUtils;
import com.jdimension.jlawyer.client.utils.ThreadUtils;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.ArchiveFileBean;
import com.jdimension.jlawyer.persistence.ArchiveFileGroupsBean;
import com.jdimension.jlawyer.persistence.ArchiveFileReviewsBean;
import com.jdimension.jlawyer.persistence.ArchiveFileTagsBean;
import com.jdimension.jlawyer.persistence.Group;
import com.jdimension.jlawyer.services.ArchiveFileServiceRemote;
Expand All @@ -687,6 +689,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -1134,18 +1137,35 @@ private String getArchiveFileAsHtml(ArchiveFileBean afb) {
html.append("<table>");
html.append("<tr><td>").append("Aktenzeichen: ").append("</td><td>").append(afb.getFileNumber()).append("</td></tr>");
html.append("<tr><td>").append("Kurzrubrum: ").append("</td><td>").append(afb.getName()).append("</td></tr>");
if (afb.getReason() != null) {
if (!StringUtils.isEmpty(afb.getReason())) {
html.append("<tr><td>").append("wegen: ").append("</td><td>").append(afb.getReason()).append("</td></tr>");
}
if (afb.getNotice() != null) {
if (!StringUtils.isEmpty(afb.getNotice())) {
html.append("<tr><td>").append("Notiz: ").append("</td><td>").append(afb.getNotice()).append("</td></tr>");
}
if (afb.getLawyer() != null) {
if (!StringUtils.isEmpty(afb.getLawyer())) {
html.append("<tr><td>").append("Anwalt: ").append("</td><td>").append(afb.getLawyer()).append("</td></tr>");
}
if (afb.getAssistant() != null) {
if (!StringUtils.isEmpty(afb.getAssistant())) {
html.append("<tr><td>").append("Sachbearbeiter: ").append("</td><td>").append(afb.getAssistant()).append("</td></tr>");
}

ClientSettings settings = ClientSettings.getInstance();
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());
Collection<ArchiveFileReviewsBean> reviews = locator.lookupCalendarServiceRemote().getReviews(afb.getId(), true);
if (!reviews.isEmpty()) {
html.append("<tr><td>").append("Unerledigte Kalendereintr&auml;ge: ").append("</td><td>").append(reviews.size()).append("</td></tr>");
SimpleDateFormat df=new SimpleDateFormat("dd.MM.yyyy");
for (ArchiveFileReviewsBean r : reviews) {
html.append("<tr><td></td><td>").append(df.format(r.getBeginDate())).append(" ").append(r.getSummary()).append(" (").append(r.getEventTypeName()).append(")").append("</td></tr>");
}
}
} catch (Exception ex) {
log.error("Error getting calendar entries", ex);
JOptionPane.showMessageDialog(this, "Fehler beim Ermitteln der Kalendereinträge: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE);
}


html.append("</table>");
html.append("</body></html>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ public interface CalendarServiceRemote {
ArchiveFileReviewsBean updateReview(String archiveFileId, ArchiveFileReviewsBean review) throws Exception;

Collection<ArchiveFileReviewsBean> getReviews(String archiveFileKey) throws Exception;
Collection<ArchiveFileReviewsBean> getReviews(String archiveFileKey, boolean done) throws Exception;

List<CalendarSetup> getAllCalendarSetups();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,17 @@ public List<ArchiveFileReviewsBean> findByArchiveFileKey(ArchiveFileBean archive
return getEntityManager().createQuery("from ArchiveFileReviewsBean where archiveFileKey = ?1").setParameter(1, archiveFileKey).getResultList();
}

@Override
public List<ArchiveFileReviewsBean> findByArchiveFileKeyAndDone(ArchiveFileBean archiveFileKey, boolean done) {

short isDone = 0;
if (done) {
isDone = 1;
}

return getEntityManager().createQuery("from ArchiveFileReviewsBean where archiveFileKey = ?1 and done = ?2 order by beginDate asc").setParameter(1, archiveFileKey).setParameter(2, isDone).getResultList();
}

@Override
public List<ArchiveFileReviewsBean> findByCalendarSetup(CalendarSetup setup) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ public interface ArchiveFileReviewsBeanFacadeLocal {

public List<ArchiveFileReviewsBean> findByArchiveFileKey(ArchiveFileBean archiveFileKey);

public List<ArchiveFileReviewsBean> findByArchiveFileKeyAndDone(ArchiveFileBean archiveFileKey, boolean done);

public List<ArchiveFileReviewsBean> findByDone(boolean done);

public List<ArchiveFileReviewsBean> findByCalendarSetup(CalendarSetup calendar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,19 @@ public Collection<ArchiveFileReviewsBean> getReviews(String archiveFileKey) thro
return getReviewsImpl(archiveFileKey, context.getCallerPrincipal().getName());

}

@Override
@RolesAllowed({"readArchiveFileRole"})
public Collection<ArchiveFileReviewsBean> getReviews(String archiveFileKey, boolean done) throws Exception {

ArchiveFileBean aFile = this.archiveFileFacade.find(archiveFileKey);
if (context.getCallerPrincipal().getName() != null) {
SecurityUtils.checkGroupsForCase(context.getCallerPrincipal().getName(), aFile, this.securityFacade, this.archiveFileService.getAllowedGroups(aFile));
}

return this.archiveFileReviewsFacade.findByArchiveFileKeyAndDone(aFile, done);

}

private Collection<ArchiveFileReviewsBean> getReviewsImpl(String archiveFileKey, String principalId) throws Exception {
ArchiveFileBean aFile = this.archiveFileFacade.find(archiveFileKey);
Expand Down

0 comments on commit 63a14ac

Please sign in to comment.