java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java | 11 + java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.hbm.xml | 30 +++ java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.java | 99 ++++++++++ java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 27 ++ java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ContentSourceFilterSerializer.java | 63 ++++++ java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java | 1 java/spacewalk-java.spec | 16 + rel-eng/packages/spacewalk-java | 2 8 files changed, 247 insertions(+), 2 deletions(-)
New commits: commit 4b11bb0e2e480936ecc8a0386c5148d8ea941d4f Author: Aron Parsons aronparsons@gmail.com Date: Tue Aug 28 00:45:39 2012 -0400
Automatic commit of package [spacewalk-java] release [1.8.136-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index 74eea99..319696b 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -23,7 +23,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.8.134 +Version: 1.8.136 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -614,6 +614,20 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Tue Aug 28 2012 Aron Parsons aronparsons@gmail.com 1.8.136-1 +- add listRepoFilters API call +- add lookupContentSourceFiltersById method to ChannelFactory +- add serializer for ContentSourceFilter +- add ContentSourceFilter class +- 733420 - Checking user permissions for CryptoKeysHandler + +* Tue Aug 28 2012 Aron Parsons aronparsons@gmail.com +- add listRepoFilters API call +- add lookupContentSourceFiltersById method to ChannelFactory +- add serializer for ContentSourceFilter +- add ContentSourceFilter class +- 733420 - Checking user permissions for CryptoKeysHandler + * Fri Aug 24 2012 Stephen Herr sherr@redhat.com 1.8.134-1 - 818700 - allow user to set the gateway for static bonds
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index b805bf3..68e2557 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.8.134-1 java/ +1.8.136-1 java/
commit 78e04edac79095c52849f300f0a3f170da0a0db7 Author: Aron Parsons aronparsons@gmail.com Date: Tue Aug 28 00:39:11 2012 -0400
add listRepoFilters API call
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java index b108f00..3e76fe1 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java @@ -26,6 +26,7 @@ import com.redhat.rhn.domain.channel.Channel; import com.redhat.rhn.domain.channel.ChannelArch; import com.redhat.rhn.domain.channel.ChannelFactory; import com.redhat.rhn.domain.channel.ContentSource; +import com.redhat.rhn.domain.channel.ContentSourceFilter; import com.redhat.rhn.domain.channel.InvalidChannelRoleException; import com.redhat.rhn.domain.channel.NewChannelHelper; import com.redhat.rhn.domain.errata.Errata; @@ -2719,6 +2720,32 @@ public class ChannelSoftwareHandler extends BaseHandler { return cronExpr; }
+ /** + * Lists the filters for a repo + * @param sessionKey Session containing user information. + * @param label of the repo to use + * @return list of filters + * + * @xmlrpc.doc Lists the filters for a repo + * @xmlrpc.param #session_key() + * @xmlrpc.param #param_desc("string", "label", "repository label") + * @xmlrpc.returntype + * #array() + * $ContentSourceFilterSerializer + * #array_end() + * + **/ + public List<ContentSourceFilter> listRepoFilters(String sessionKey, String label) { + User user = getLoggedInUser(sessionKey); + + ContentSource cs = lookupContentSourceByLabel(label, user.getOrg()); + + List<ContentSourceFilter> result = + ChannelFactory.lookupContentSourceFiltersById(cs.getId()); + + return result; + } + private ContentSource lookupContentSourceById(Long repoId, Org org) { ContentSource cs = ChannelFactory.lookupContentSource(repoId, org); if (cs == null) {
commit 53263b05c791e4450ec7e34b8f6e3d45852d1640 Author: Aron Parsons aronparsons@gmail.com Date: Tue Aug 28 00:38:47 2012 -0400
add lookupContentSourceFiltersById method to ChannelFactory
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 9e8d93b..5982bca 100644 --- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java +++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java @@ -188,6 +188,17 @@ public class ChannelFactory extends HibernateFactory { }
+ /** + * Lookup a content source's filters by id + * @param id source id + * @return the ContentSourceFilters + */ + public static List<ContentSourceFilter> lookupContentSourceFiltersById(Long id) { + Map params = new HashMap(); + params.put("source_id", id); + return singleton.listObjectsByNamedQuery( + "ContentSourceFilter.findBySourceId", params); + }
/** * Retrieve a list of channel ids associated with the labels provided
commit ad74aa7f79a9730ae7b67cce88cf152fffc839e6 Author: Aron Parsons aronparsons@gmail.com Date: Tue Aug 28 00:37:58 2012 -0400
add serializer for ContentSourceFilter
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ContentSourceFilterSerializer.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ContentSourceFilterSerializer.java new file mode 100644 index 0000000..a4aba0c --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ContentSourceFilterSerializer.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2009--2012 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.xmlrpc.serializer; + +import java.io.IOException; +import java.io.Writer; + +import redstone.xmlrpc.XmlRpcCustomSerializer; +import redstone.xmlrpc.XmlRpcException; +import redstone.xmlrpc.XmlRpcSerializer; + +import com.redhat.rhn.domain.channel.ContentSourceFilter; +import com.redhat.rhn.frontend.xmlrpc.serializer.util.SerializerHelper; + +/** + * + * ContentSourceFilterSerializer + * @version $Rev$ + * + * @xmlrpc.doc + * #struct("filter") + * #prop("int", "sortOrder") + * #prop("string", "filter") + * #prop("string", "flag") + * #struct_end() + * + */ +public class ContentSourceFilterSerializer implements XmlRpcCustomSerializer { + + /** + * {@inheritDoc} + */ + public Class getSupportedClass() { + return ContentSourceFilter.class; + } + + /** + * {@inheritDoc} + */ + public void serialize(Object value, Writer output, XmlRpcSerializer builtInSerializer) + throws XmlRpcException, IOException { + SerializerHelper helper = new SerializerHelper(builtInSerializer); + ContentSourceFilter filter = (ContentSourceFilter) value; + + helper.add("sortOrder", filter.getSortOrder()); + helper.add("filter", filter.getFilter()); + helper.add("flag", filter.getFlag()); + + helper.writeTo(output); + } +} diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java index eb8b5c9..9d3716b 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/SerializerRegistry.java @@ -116,6 +116,7 @@ public class SerializerRegistry { SERIALIZER_CLASSES.add(NetworkDtoSerializer.class); SERIALIZER_CLASSES.add(DistChannelMapSerializer.class); SERIALIZER_CLASSES.add(ContentSourceSerializer.class); + SERIALIZER_CLASSES.add(ContentSourceFilterSerializer.class); SERIALIZER_CLASSES.add(XccdfTestResultDtoSerializer.class); SERIALIZER_CLASSES.add(XccdfTestResultSerializer.class); SERIALIZER_CLASSES.add(XccdfRuleResultDtoSerializer.class);
commit fb0914444b6a20074fc861840952091e36b10c06 Author: Aron Parsons aronparsons@gmail.com Date: Tue Aug 28 00:36:07 2012 -0400
add ContentSourceFilter class
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.hbm.xml b/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.hbm.xml new file mode 100644 index 0000000..43e4a4e --- /dev/null +++ b/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.hbm.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping +PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" +"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> +<hibernate-mapping> + <class name="com.redhat.rhn.domain.channel.ContentSourceFilter" + table="rhnContentSourceFilter" > + + <id name="id" type="long" column="id"> + <meta attribute="scope-set">protected</meta> + <generator class="sequence"> + <param name="sequence">rhn_csf_id_seq</param> + </generator> + </id> + + <property name="sourceId" type="long" column="source_id"/> + <property name="filter" type="string" column="filter"/> + <property name="flag" type="string" column="flag"/> + <property name="sortOrder" type="int" column="sort_order"/> + <property name="created" type="timestamp" column="created" insert="false" update="false" /> + <property name="modified" type="timestamp" column="modified" insert="false" update="false" /> + </class> + + <query name="ContentSourceFilter.findBySourceId"> + <![CDATA[SELECT f.sortOrder, f.flag, f.filter + FROM com.redhat.rhn.domain.channel.ContentSourceFilter AS f + WHERE f.sourceId = :source_id + ORDER BY f.sortOrder]]> + </query> +</hibernate-mapping> diff --git a/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.java b/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.java new file mode 100644 index 0000000..ff16e41 --- /dev/null +++ b/java/code/src/com/redhat/rhn/domain/channel/ContentSourceFilter.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2009--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.domain.channel; + +import com.redhat.rhn.domain.BaseDomainHelper; + +/** + * ContentSourceFilter + * @version $Rev$ + */ +public class ContentSourceFilter extends BaseDomainHelper { + private Long id; + private Long sourceId; + private String flag; + private String filter; + private int sortOrder; + + /** + * @return Returns the id. + */ + public Long getId() { + return id; + } + + /** + * @param idIn The id to set. + */ + public void setId(Long idIn) { + this.id = idIn; + } + + /** + * @return Returns the sourceId. + */ + public Long getSourceId() { + return sourceId; + } + + /** + * @param sourceIdIn The sourceId to set. + */ + public void setSourceId(Long sourceIdIn) { + this.sourceId = sourceIdIn; + } + + /** + * @return Returns the flag. + */ + public String getFlag() { + return flag; + } + + /** + * @param flagIn The flag to set. + */ + public void setFlag(String flagIn) { + this.flag = flagIn; + } + + /** + * @return Returns the filter. + */ + public String getFilter() { + return filter; + } + + /** + * @param filterIn The filter to set. + */ + public void setFilter(String filterIn) { + this.filter = filterIn; + } + + /** + * @return Returns the sortOrder. + */ + public int getSortOrder() { + return sortOrder; + } + + /** + * @param sortOrderIn The sortOrder to set. + */ + public void setSortOrder(int sortOrderIn) { + this.sortOrder = sortOrderIn; + } +}
spacewalk-commits@lists.fedorahosted.org