Search in sources :

Example 1 with AppliedPatch

use of org.alfresco.repo.admin.patch.AppliedPatch in project acs-community-packaging by Alfresco.

the class UIRepositoryProperties method getDebugData.

/**
 * @see org.alfresco.web.ui.common.component.debug.BaseDebugComponent#getDebugData()
 */
@SuppressWarnings("unchecked")
public Map getDebugData() {
    // note: sort properties
    Map properties = new TreeMap();
    FacesContext fc = FacesContext.getCurrentInstance();
    ServiceRegistry services = Repository.getServiceRegistry(fc);
    DescriptorService descriptorService = services.getDescriptorService();
    Descriptor installedRepoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
    properties.put("Installed Version", installedRepoDescriptor.getVersion());
    properties.put("Installed Schema", installedRepoDescriptor.getSchema());
    Descriptor systemDescriptor = descriptorService.getServerDescriptor();
    properties.put("Server Version", systemDescriptor.getVersion());
    properties.put("Server Schema", systemDescriptor.getSchema());
    WebApplicationContext cx = FacesContextUtils.getRequiredWebApplicationContext(fc);
    PatchService patchService = (PatchService) cx.getBean("PatchService");
    List<AppliedPatch> patches = patchService.getPatches(null, null);
    for (AppliedPatch patch : patches) {
        StringBuilder data = new StringBuilder(256);
        data.append(patch.getAppliedOnDate()).append(" - ").append(patch.getDescription()).append(" - ").append(patch.getSucceeded() == true ? Application.getMessage(fc, "repository_patch_succeeded") : Application.getMessage(fc, "repository_patch_failed"));
        properties.put(patch.getId(), data);
    }
    return properties;
}
Also used : FacesContext(javax.faces.context.FacesContext) Descriptor(org.alfresco.service.descriptor.Descriptor) ServiceRegistry(org.alfresco.service.ServiceRegistry) TreeMap(java.util.TreeMap) DescriptorService(org.alfresco.service.descriptor.DescriptorService) TreeMap(java.util.TreeMap) Map(java.util.Map) PatchService(org.alfresco.repo.admin.patch.PatchService) WebApplicationContext(org.springframework.web.context.WebApplicationContext) AppliedPatch(org.alfresco.repo.admin.patch.AppliedPatch)

Aggregations

Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 FacesContext (javax.faces.context.FacesContext)1 AppliedPatch (org.alfresco.repo.admin.patch.AppliedPatch)1 PatchService (org.alfresco.repo.admin.patch.PatchService)1 ServiceRegistry (org.alfresco.service.ServiceRegistry)1 Descriptor (org.alfresco.service.descriptor.Descriptor)1 DescriptorService (org.alfresco.service.descriptor.DescriptorService)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1