java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java |
12 ++
java/code/src/com/redhat/rhn/domain/channel/ContentSource.hbm.xml |
4
java/code/src/com/redhat/rhn/frontend/action/channel/manage/RepositoriesAction.java |
58 ++++++++++
java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java |
3
4 files changed, 77 insertions(+)
New commits:
commit 63e6df0650a6368fdf030588a7f69cce0d2eedbc
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Wed Jun 2 14:47:01 2010 -0400
intial strut action for channel repository mapping
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java
b/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java
index af58d33..ce9ca82 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java
@@ -131,6 +131,18 @@ public class ChannelFactory extends HibernateFactory {
return (ContentSource) singleton.lookupObjectByNamedQuery(
"ContentSource.findById", params);
}
+
+ /**
+ * Lookup a content source by org
+ * @param org the org to lookup
+ * @return the ContentSource(s)
+ */
+ public static List<ContentSource> lookupContentSources(Org org) {
+ Map params = new HashMap();
+ params.put("org", org);
+ return singleton.listObjectsByNamedQuery(
+ "ContentSource.findByOrg", params);
+ }
/**
* lookup content source by id and org
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ContentSource.hbm.xml
b/java/code/src/com/redhat/rhn/domain/channel/ContentSource.hbm.xml
index 4640978..0225674 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ContentSource.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/channel/ContentSource.hbm.xml
@@ -43,7 +43,11 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
</query>
<query name="ContentSource.findById">
<![CDATA[from com.redhat.rhn.domain.channel.ContentSource as c where c.id =
:id]]>
+ </query>
+ <query name="ContentSource.findByOrg">
+ <![CDATA[from com.redhat.rhn.domain.channel.ContentSource as c where c.org =
:org]]>
</query>
+
</hibernate-mapping>
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/RepositoriesAction.java
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/RepositoriesAction.java
new file mode 100644
index 0000000..36a78c9
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/RepositoriesAction.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.channel.manage;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import com.redhat.rhn.domain.channel.ChannelFactory;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+
+
+public class RepositoriesAction extends RhnAction implements Listable {
+
+
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+
+ ListRhnSetHelper helper =
+ new ListRhnSetHelper(this, request,RhnSetDecl.REPOSITORY_CHANNEL_MAPS);
+ helper.execute();
+ if(helper.isDispatched()) {
+ //handle the dispatch action (like removing groups etc)
+ return mapping.findForward("success");
+ }
+
+ return mapping.findForward("default");
+ }
+
+ public List getResult(RequestContext context) {
+ User user = context.getLoggedInUser();
+ return ChannelFactory.lookupContentSources(user.getOrg());
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
b/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
index 35ce110..5dbed76 100644
--- a/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
+++ b/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
@@ -275,6 +275,9 @@ public class RhnSetDecl {
public static final RhnSetDecl REMOVE_SYSTEMS_LIST = make(
"remove_systems_list", SetCleanup.NOOP);
+
+ public static final RhnSetDecl REPOSITORY_CHANNEL_MAPS = make(
+ "repository_channel_maps", SetCleanup.NOOP);
public static final RhnSetDecl CHANNEL_SUBSCRIPTION_PERMS = make(
"channel_subscription_perms", SetCleanup.NOOP);