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
{ | |
commentUserGroupId: "<ID from the C_U_G table>", | |
author: "<user id>", | |
payload: "<comment content>" | |
} |
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
{ | |
id: "<guid>", | |
extGroupType: "<code-name for group type>", | |
extGroupId: "<FK into a table determined by the group type>" | |
} |
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
CommentUserGroup cug = cugDao.find(commentUserGroupId); | |
ExternalGroupHelper groupHelper = extGroupHelperProvider.getHelperForType(cug.getExtGroupType()); | |
if (groupHelper.isMember(securityContextHelper.getCurrentUser(), cug.getExtGroupId())) { | |
return groupHelper.members(cug.getExtGroupId()); | |
} else { | |
return Collections.emptyList(); | |
} |
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
public class ExternalGroupHelperProvider implements ContextAware { | |
// ... save the application context in a field named context ... | |
public ExternalGroupHelper getHelperForType(String groupType) { | |
return context.getBeanByName(groupType + "ExternalGroupHelper"); | |
} | |
} |
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
public interface ExternalGroupHelper { | |
boolean isMember(User u, String extGroupId); | |
List<Member> members(String extGroupId); | |
} |
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
public class AuditService { | |
private static final Logger LOGGER = LoggerFactory.getLogger(AuditService.class); | |
private AuditPublishingService auditPublishingService; | |
public AuditService(AuditPublishingService auditPublishingService) { | |
this.auditPublishingService = auditPublishingService; | |
} | |
public void auditDownload(Task taskObj) { | |
DocAccessAuditRequest request = publishDocAccessEvent(taskObj, DocAccessType.DOWNLOAD); | |
LOGGER.info("Audit log for Download :DocAccessAuditRequest", request); | |
} |
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
class Base { | |
public void foo(Base x) { | |
System.out.println("Base.Base"); | |
} | |
public void foo(Derived x) { | |
System.out.println("Base.Derived"); | |
} | |
public void bar(Object x) { | |
System.out.println("bar-Base:Object"); | |
} |
NewerOlder