/*
* Embedded Jopr Project
* Copyright (C) 2006-2009 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.jboss.on.embedded.bean.history.content;
import java.util.Collection;
import org.rhq.core.clientapi.server.content.ContentDiscoveryReport;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.on.embedded.manager.ResourceManager;
import org.jboss.on.embedded.manager.ResourceManagerFactory;
import org.jboss.on.embedded.manager.history.AbstractHistoryManager;
import org.jboss.on.embedded.manager.history.content.ContentHistoryManager;
@Name("contentHistoryManager")
@Scope(ScopeType.APPLICATION)
public class ContentHistoryManagerBean extends AbstractHistoryManager<ContentDiscoveryReport>
implements ContentHistoryManager
{
public ContentDiscoveryReport addContentHistory(ContentDiscoveryReport report)
{
int resourceId = report.getResourceId();
ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
Resource resource = resourceManager.getResource(resourceId);
if (resource != null)
{
ResourceType resourceType = resource.getResourceType();
this.addToMaps(report, resource, resourceType);
}
return report;
}
protected String getJobId(ContentDiscoveryReport history)
{
return "1";
}
// @todo to be implemented when we can create Requests
public Collection<ContentDiscoveryReport> getAllHistory()
{
return null;
}
public ContentDiscoveryReport getHistory(String historyId)
{
return null;
}
}