-
Type:
Suggestion
-
Resolution: Won't Fix
-
None
-
Component/s: Project Administration - Components
-
Environment:Minyaa 3.2 (about to be released fro JIRA 4.4)
In order to complete the migration of Minyaa against JIRA 4.4, I had to perform a patch in jira-project-config-plugin in order to let it using the component extended by Minyaa plugins.
Minyaa comes with different extension of JIRA Components. 2 of them are required to be able to access to project configuration :
- NotificationTypeManager in order to provide custom Notification Type (See here)
- SchemePermissions in order to provide custom Permission (See here)
Applied Patch are in :
- com.atlassian.jira.projectconfig.contextproviders.ProjectNotificationContextProvider in order to retrieve the NotificationTypeManager on call and not on Class load.
private NotificationTypeManager notificationTypeManager;
...
public NotificationTypeManager getNotificationTypeManager() {
notificationTypeManager = ComponentAccessor.getComponentOfType(NotificationTypeManager.class);
return notificationTypeManager;
}
...
private List<Notification> getNotifications(GenericValue scheme)
{
Collection<EventType> eventTypes = getEventTypes();
List<Notification> notificationList = new ArrayList<Notification>(eventTypes.size());
for (EventType eventType : eventTypes)
{
final List<GenericValue> entities = getEntities(scheme, eventType.getId());
final List<String> entityDisplays = new ArrayList<String>(entities.size());
for (GenericValue entity : entities)
{
final String typeStr = entity.getString(ENTITY_TYPE);
final NotificationType type = getNotificationTypeManager().getNotificationType(typeStr);
final String paramater = entity.getString(ENTITY_PARAMETER);
final StringBuilder sb = new StringBuilder(type.getDisplayName());
if (StringUtils.isNotBlank(paramater))
{
sb.append(" (").append(type.getArgumentDisplay(paramater)).append(")");
}
entityDisplays.add(sb.toString());
}
Collections.sort(entityDisplays);
notificationList.add(new Notification(eventType.getId(), eventType.getName(), eventType.getDescription(), entityDisplays));
}
// EventTypes are pre-sorted by the EventTypeManager, so we don't try and resort them here as that would be just wrong.
return notificationList;
}
- com.atlassian.jira.projectconfig.contextproviders.ProjectPermissionContextProvider in order to retrieve the SchemePermissions on call and not on Class load.
private SchemePermissions schemePermissions; ... public SchemePermissions getSchemePermissions() { schemePermissions = ComponentAccessor.getComponentOfType(SchemePermissions.class); return schemePermissions; } public Map<String, Object> getContextMap(Map<String, Object> context) { ... schemePermissions = getSchemePermissions(); permissionGroups.add(new SimplePermissionGroup("project", i18nHelper.getText("admin.permission.group.project.permissions"), getPermission(i18nHelper, scheme, schemePermissions.getProjectPermissions().values()))); ... permissionGroups.add(new SimplePermissionGroup("timeTracking", i18nHelper.getText("admin.permission.group.time.tracking.permissions"), getPermission(i18nHelper, scheme, schemePermissions.getTimeTrackingPermissions().values()))); contextMap.add(CONTEXT_PERMISSION_GROUPS, permissionGroups); return contextMap.toMap(); }
Thanks by advance
Vincent