public AuthorityImageResource(Authority authority) throws StoreException {
super(IMAGE_WIDTH, IMAGE_HEIGHT, "png");
final Store openXRIStore = ((OpenXRIAdminApplication) Application.get()).getOpenXRIStore();
if (authority.getXrd().getCanonicalID() != null)
this.authorityText = authority.getXrd().getCanonicalID().getValue();
else
this.authorityText = authority.getId().toString();
SubSegment[] subSegments = ((StoreBetterLookup) openXRIStore).getAuthoritySubSegments(authority);
SubSegment[] childSubSegments = ((StoreBetterLookup) openXRIStore).getAuthorityChildSubSegments(authority);
this.parentAuthorities = new HashMap<String, List<String>> ();
for (SubSegment subSegment : subSegments) {
Authority parentAuthority = openXRIStore.getSubSegmentParentAuthority(subSegment);
String authorityText;
if (parentAuthority == null || parentAuthority.getXrd() == null)
authorityText = "-";
else if (parentAuthority.getXrd().getCanonicalID() != null)
authorityText = parentAuthority.getXrd().getCanonicalID().getValue();
else
authorityText = parentAuthority.getId().toString();
List<String> subSegmentNames = this.parentAuthorities.get(authorityText);
if (subSegmentNames == null) {
subSegmentNames = new ArrayList<String> ();
this.parentAuthorities.put(authorityText, subSegmentNames);
}
subSegmentNames.add(subSegment.getName());
}
this.childAuthorities = new HashMap<String, List<String>> ();
for (SubSegment childSubSegment : childSubSegments) {
Authority childAuthority = openXRIStore.getSubSegmentAuthority(childSubSegment);
String authorityText;
if (childAuthority == null || childAuthority.getXrd() == null)
authorityText = "-";
else if (childAuthority.getXrd().getCanonicalID() != null)