You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2011/04/01 18:42:42 UTC
svn commit: r1087796 [7/37] - in /incubator/rave/donations/mitre-osec: ./
conf/ db/ db/data/ db/sequences/ db/tables/ lib/ lib/apache-commons/
lib/apache-taglibs/ lib/build/ lib/build/cobertura/ lib/eclipselink/
lib/freemarker/ lib/google-collections/ ...
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/StringStringMapToXmlConverter.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/StringStringMapToXmlConverter.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/StringStringMapToXmlConverter.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/StringStringMapToXmlConverter.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.model.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.persistence.mappings.DatabaseMapping;
+import org.eclipse.persistence.mappings.converters.Converter;
+import org.eclipse.persistence.sessions.Session;
+
+import javax.xml.bind.*;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: JCIAN
+ * Date: Oct 8, 2009
+ * Time: 10:52:24 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class StringStringMapToXmlConverter implements Converter {
+ private static final Log log = LogFactory.getLog(StringStringMapToXmlConverter.class);
+ private static JAXBContext jaxbContext;
+
+ static {
+ try {
+ jaxbContext = JAXBContext.newInstance(JaxbWrappers.StringStringMapWrapper.class);
+ } catch (JAXBException e) {
+ log.error(e);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object convertObjectValueToDataValue(Object objectValue, Session session) {
+ if (objectValue == null) {
+ return null;
+ }
+
+ try {
+ Map<String, String> data = (Map<String, String>) objectValue;
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(new JaxbWrappers.StringStringMapWrapper(data), writer);
+ return writer.toString();
+ } catch (JAXBException e) {
+ throw new DataBindingException(e);
+ }
+ }
+
+ @Override
+ public Object convertDataValueToObjectValue(Object databaseValue, Session session) {
+ if (databaseValue == null) {
+ return new HashMap<String, String>();
+ }
+
+ try {
+ String dataXml = (String) databaseValue;
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ JaxbWrappers.StringStringMapWrapper mapWrapper = (JaxbWrappers.StringStringMapWrapper) unmarshaller.unmarshal(new StringReader(dataXml));
+ return mapWrapper.getData();
+ } catch (JAXBException e) {
+ throw new DataBindingException(e);
+ }
+ }
+
+ @Override
+ public boolean isMutable() {
+ //assuming this is talking about the results of the convertDataValueToObjectValue call...
+ return true;
+ }
+
+ @Override
+ public void initialize(DatabaseMapping databaseMapping, Session session) {
+ }
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/StringStringMapToXmlConverter.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/URLConverter.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/URLConverter.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/URLConverter.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/URLConverter.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.model.util;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.persistence.mappings.converters.Converter;
+import org.eclipse.persistence.mappings.DatabaseMapping;
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class URLConverter implements Converter
+{
+ private static final Log log = LogFactory.getLog(URLConverter.class);
+
+ @Override
+ public Object convertObjectValueToDataValue(Object objectValue, Session session) {
+ if (objectValue == null)
+ return null;
+
+ URL urlValue = (URL)objectValue;
+ return urlValue.toString();
+ }
+
+ @Override
+ public Object convertDataValueToObjectValue(Object dataValue, Session session) {
+ String stringValue = (String)dataValue;
+
+ if (stringValue == null || stringValue.isEmpty())
+ return null;
+
+ URL url = null;
+ try {
+ url = new URL(stringValue);
+ }
+ catch (MalformedURLException e) {
+ log.error("unable to convert database value '" + stringValue + "' to a URL object");
+ }
+
+ return url;
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+
+ @Override
+ public void initialize(DatabaseMapping databaseMapping, Session session) {
+
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/URLConverter.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRegistryRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRegistryRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRegistryRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRegistryRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.net.URL;
+import java.util.List;
+import org.mitre.portal.model.Container;
+import org.mitre.portal.model.ContainerRegistry;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetAudience;
+import org.mitre.portal.model.GadgetAuthorType;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface ContainerRegistryRepository {
+ public ContainerRegistry get(Long containerRegistryId);
+ public ContainerRegistry find(Container container, Gadget gadget);
+ public ContainerRegistry find(Container container, URL gadgetUrl);
+ public List<ContainerRegistry> find(Container container);
+ public List<ContainerRegistry> findByAuthor(Container container, String authorName);
+ public List<ContainerRegistry> findByAuthorUserId(Container container, String authorUserId);
+ public List<ContainerRegistry> findByGadgetAuthorType(Container container, GadgetAuthorType gadgetAuthorType);
+ public List<ContainerRegistry> findByTagName(Container container, String tagName);
+ public List<ContainerRegistry> findByAudience(Container container, GadgetAudience gadgetAudience);
+ public void registerNewGadget(Gadget gadget, Container container);
+ public void delete(ContainerRegistry containerRegistry);
+ public List<ContainerRegistry> findByGadgetTitleOrDesc(Container container, String queryString);
+ public List<ContainerRegistry> findByGadgetId(Container container, Long gadgetId);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRegistryRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import org.mitre.portal.model.Container;
+
+import java.util.List;
+
+/**
+ * @author ACARLUCCI
+ */
+public interface ContainerRepository {
+ public Container get(Long containerId);
+
+ public Container find(String name);
+
+ public List<Container> findAll();
+
+ public void save(Container container);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/ContainerRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAudienceRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAudienceRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAudienceRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAudienceRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+
+import org.mitre.portal.model.GadgetAudience;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetAudienceRepository {
+ public List<GadgetAudience> findAll();
+ public List<GadgetAudience> findAllAssignedToGadgets();
+ public GadgetAudience get(Long gadgetAudienceId);
+ public void save(GadgetAudience gadgetAudience);
+ public void delete(GadgetAudience gadgetAudience);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAudienceRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAuthorTypeRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAuthorTypeRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAuthorTypeRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAuthorTypeRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.GadgetAuthorType;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetAuthorTypeRepository {
+ public List<GadgetAuthorType> findAll();
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetAuthorTypeRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetCommentRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetCommentRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetCommentRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetCommentRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetComment;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetCommentRepository {
+ public GadgetComment get(Long gadgetCommentId);
+ public List<GadgetComment> findByGadget(Gadget gadget);
+ public void save(GadgetComment gadgetComment);
+ public void delete(GadgetComment gadgetComment);
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetCommentRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRatingRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRatingRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRatingRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRatingRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetRating;
+
+/**
+ *
+ * @author Sean Cooper <se...@mitre.org>
+ */
+public interface GadgetRatingRepository {
+ public GadgetRating get(Long gadgetRatingId);
+ public List<GadgetRating> find(Gadget gadget);
+ public GadgetRating find(Gadget gadget, String userId);
+ public List<GadgetRating> find(String userId);
+ public void save(GadgetRating rating);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRatingRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+
+import org.mitre.portal.model.Gadget;
+import java.util.List;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetRepository {
+ public Gadget get(Long gadgetId);
+ public void save(Gadget gadget);
+ public void delete(Gadget gadget);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetSupportLinkTypeRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetSupportLinkTypeRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetSupportLinkTypeRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetSupportLinkTypeRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.GadgetSupportLinkType;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetSupportLinkTypeRepository {
+ public List<GadgetSupportLinkType> findAll();
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetSupportLinkTypeRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetTagRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetTagRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetTagRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetTagRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import org.mitre.portal.model.GadgetTag;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: MAHADEVAN
+ * Date: May 7, 2010
+ * Time: 11:23:54 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface GadgetTagRepository {
+ public List<String> findAll();
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetTagRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetUserPrefRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetUserPrefRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetUserPrefRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetUserPrefRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetUserPref;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface GadgetUserPrefRepository {
+ public GadgetUserPref get(Long gadgetUserPrefId);
+ public List<GadgetUserPref> find(Gadget gadget);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/GadgetUserPrefRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageLayoutRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageLayoutRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageLayoutRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageLayoutRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.PageLayout;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface PageLayoutRepository {
+ public PageLayout get(Long pageLayoutId);
+ public List<PageLayout> findAll();
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageLayoutRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Container;
+import org.mitre.portal.model.Page;
+import org.mitre.portal.model.RegionGadget;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface PageRepository {
+ // returns a page based on pk
+ public Page get(Long pageId);
+ // retuns a page in a given container for a given user
+ public Page find(Container container, String pageName, String userId);
+ // returns all pages for a user in a container
+ public List<Page> find(Container container, String userId);
+ public Page findDefault(Container container, String userId);
+ public void save(Page page);
+ public void delete(Page page);
+ public void updatePageRenderSequences(List<Page> pages);
+ // moves a regionGadget to a new region in the same page
+ public void move(RegionGadget regionGadget, Long toRegionId, int toRenderSequence);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateOwnerTypeRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateOwnerTypeRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateOwnerTypeRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateOwnerTypeRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.PageTemplateOwnerType;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface PageTemplateOwnerTypeRepository {
+ public PageTemplateOwnerType get(String code);
+ public List<PageTemplateOwnerType> findAll();
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateOwnerTypeRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Container;
+import org.mitre.portal.model.PageTemplate;
+import org.mitre.portal.model.PageTemplateOwnerType;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface PageTemplateRepository {
+ // PageTemplate methods
+ public PageTemplate get(Long pageTemplateId);
+ public List<PageTemplate> findAll();
+ public PageTemplate getDefault();
+ public PageTemplate find(Container container, String name);
+ public List<PageTemplate> find(Container container, PageTemplateOwnerType pageTemplateOwnerType);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PageTemplateRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonGadgetRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonGadgetRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonGadgetRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonGadgetRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.PersonGadget;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface PersonGadgetRepository {
+ public PersonGadget get(Long personGadgetId);
+ public List<PersonGadget> find(String userId);
+ public List<PersonGadget> find(Gadget gadget);
+ public void delete(PersonGadget personGadget);
+ public void save(PersonGadget personGadget);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonGadgetRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import org.mitre.portal.model.Person;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+
+
+/**
+ * @author ACARLUCCI
+ */
+public interface PersonRepository {
+ /**
+ * Gets the person with the given userId.
+ *
+ * @param userId The userId of the person to get.
+ * @return The person with the specified userId.
+ * @throws IncorrectResultSizeDataAccessException
+ * if the person cannot be found.
+ */
+ Person getPersonByUserId(String userId);
+
+ /**
+ * Gets the person with the given Username.
+ *
+ * @param username The username of the person to get.
+ * @return The person with the specified username.
+ * @throws IncorrectResultSizeDataAccessException
+ * if the person cannot be found.
+ */
+ Person getPersonByUsername(String username);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/PersonRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionGadgetRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionGadgetRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionGadgetRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionGadgetRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.Region;
+import org.mitre.portal.model.RegionGadget;
+import org.mitre.portal.service.*;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface RegionGadgetRepository {
+ public RegionGadget get(Long regionGadgetId);
+ public List<RegionGadget> find(Region region);
+ public List<RegionGadget> find(Gadget gadget);
+ public void save(RegionGadget regionGadget);
+ public void delete(RegionGadget regionGadget);
+ public void move(RegionGadget regionGadget, Region toRegion, int toRenderSequence);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionGadgetRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.Page;
+import org.mitre.portal.model.Region;
+import org.mitre.portal.model.RegionGadget;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface RegionRepository {
+ public Region get(Long regionId);
+ public Region find(String regionName, Page page);
+ public List<Region> find(Page page);
+ public void save(Region region);
+ public void delete(RegionGadget regionGadget);
+ public void move(RegionGadget regionGadget, int newRenderSequence);
+ public void addGadget(Region region, Gadget gadget, Region.Location location);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/RegionRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityRoleRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityRoleRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityRoleRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityRoleRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import org.mitre.portal.model.SecurityRole;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: VENKATM
+ * Date: Oct 6, 2010
+ * Time: 12:58:36 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface SecurityRoleRepository {
+ public List<SecurityRole> findAll();
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityRoleRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityUserRoleRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityUserRoleRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityUserRoleRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityUserRoleRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import org.mitre.portal.model.SecurityUserRole;
+
+import java.util.List;
+
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface SecurityUserRoleRepository {
+ public List<SecurityUserRole> find(String userId);
+ public SecurityUserRole get(String userId);
+ public void save(SecurityUserRole securityUserRole);
+ public void delete(SecurityUserRole securityUserRole);
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/SecurityUserRoleRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/StatisticsRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/StatisticsRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/StatisticsRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/StatisticsRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+
+import java.util.List;
+import java.util.Map;
+import org.mitre.portal.model.ContainerRegistry;
+import org.mitre.portal.model.util.GadgetStatistics;
+
+/**
+ *
+ * @author Sean Cooper
+ */
+public interface StatisticsRepository {
+ public Map<String, GadgetStatistics> getAllGadgetStatistics(List<ContainerRegistry> containerRegistryList);
+ public Map<String, GadgetStatistics> getAllGadgetStatistics(final String userId, List<ContainerRegistry> containerRegistryList);
+ public GadgetStatistics getGadgetStatistics(final Long gadgetId);
+ public GadgetStatistics getGadgetStatistics(final Long gadgetId, final String userId);
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/StatisticsRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/UserWizardCompletedRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/UserWizardCompletedRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/UserWizardCompletedRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/UserWizardCompletedRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.UserWizardCompleted;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface UserWizardCompletedRepository {
+ public UserWizardCompleted get(Long userWizardCompletedId);
+ public List<UserWizardCompleted> find(String userId);
+ public List<UserWizardCompleted> findAll();
+ public void save(UserWizardCompleted userWizardCompleted);
+ public void delete(UserWizardCompleted userWizardCompleted);
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/UserWizardCompletedRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/WizardRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/WizardRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/WizardRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/WizardRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository;
+
+import java.util.List;
+import org.mitre.portal.model.Wizard;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public interface WizardRepository {
+ public Wizard get(Long wizardId);
+ public Wizard find(String name);
+ public List<Wizard> findAll();
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/WizardRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JdbcStatisticsRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JdbcStatisticsRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JdbcStatisticsRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JdbcStatisticsRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.sql.DataSource;
+import org.mitre.portal.model.ContainerRegistry;
+import org.mitre.portal.model.util.GadgetStatistics;
+import org.mitre.portal.repository.StatisticsRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * @author Sean Cooper
+ */
+@Repository
+@Transactional(readOnly = true)
+public class JdbcStatisticsRepository implements StatisticsRepository {
+
+ private JdbcTemplate jdbcTemplate;
+
+ private final String LIKE = "5";
+ private final String DISLIKE = "0";
+
+ @Autowired
+ public JdbcStatisticsRepository(DataSource dataSource)
+ {
+ jdbcTemplate = new JdbcTemplate(dataSource);
+ }
+
+ @Override
+ public Map<String, GadgetStatistics> getAllGadgetStatistics(List<ContainerRegistry> containerRegistryList) {
+ Map<String, GadgetStatistics> ratings = new HashMap<String, GadgetStatistics>();
+ for (ContainerRegistry registry : containerRegistryList)
+ ratings.put(registry.getGadget().getGadgetId().toString(), getGadgetStatistics(registry.getGadget().getGadgetId()));
+
+ return ratings;
+ }
+
+ @Override
+ public Map<String, GadgetStatistics> getAllGadgetStatistics(final String userId, List<ContainerRegistry> containerRegistryList) {
+ Map<String, GadgetStatistics> ratings = new HashMap<String, GadgetStatistics>();
+ for (ContainerRegistry registry : containerRegistryList)
+ ratings.put(registry.getGadget().getGadgetId().toString(), getGadgetStatistics(registry.getGadget().getGadgetId(), userId));
+
+ return ratings;
+ }
+
+ @Override
+ public GadgetStatistics getGadgetStatistics(final Long gadgetId) {
+ GadgetStatistics stats = new GadgetStatistics();
+ stats.setGadgetId(gadgetId);
+ stats.setUserCount(jdbcTemplate.queryForInt("select count(distinct user_id) from person_gadget where gadget_id = ?", gadgetId.longValue()));
+ stats.setUserLike(jdbcTemplate.queryForInt("select count(user_id) from gadget_rating where rating = ? and gadget_id = ?", LIKE, gadgetId.longValue()));
+ stats.setUserDislike(jdbcTemplate.queryForInt("select count(user_id) from gadget_rating where rating = ? and gadget_id = ?", DISLIKE, gadgetId.longValue()));
+ return stats;
+ }
+
+ @Override
+ public GadgetStatistics getGadgetStatistics(final Long gadgetId, final String userId) {
+ GadgetStatistics stats = getGadgetStatistics(gadgetId);
+ try
+ {
+ stats.setUserRating(jdbcTemplate.queryForInt("select rating from gadget_rating where user_id = ? and gadget_id = ?", userId, gadgetId.longValue()));
+ }
+ catch (EmptyResultDataAccessException e)
+ {
+ stats.setUserRating(-1);
+ }
+ return stats;
+ }
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JdbcStatisticsRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRegistryRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRegistryRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRegistryRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRegistryRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository.impl;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import javax.persistence.Query;
+import javax.persistence.EntityManager;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Join;
+import javax.persistence.criteria.JoinType;
+import javax.persistence.criteria.ParameterExpression;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.model.Container;
+import org.mitre.portal.model.ContainerRegistry;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetAudience;
+import org.mitre.portal.model.GadgetAuthorType;
+import org.mitre.portal.model.GadgetTag;
+import org.mitre.portal.repository.ContainerRegistryRepository;
+import org.mitre.portal.repository.util.JpaUtils;
+import org.mitre.portal.model.util.FeaturedComparator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.orm.jpa.EntityManagerFactoryUtils;
+import org.springframework.orm.jpa.support.JpaDaoSupport;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Repository
+@Transactional(readOnly = true)
+public class JpaContainerRegistryRepository extends JpaDaoSupport implements ContainerRegistryRepository
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Autowired
+ public JpaContainerRegistryRepository(EntityManagerFactory entityManagerFactory)
+ {
+ setEntityManagerFactory(entityManagerFactory);
+ }
+
+ @Override
+ public ContainerRegistry get(Long containerRegistryId)
+ {
+ log.debug("get(containerRegistryId=" + containerRegistryId + ")");
+
+ ContainerRegistry containerRegistry = getJpaTemplate().find(ContainerRegistry.class, containerRegistryId);
+ if (containerRegistry == null) {
+ throw new IncorrectResultSizeDataAccessException("ContainerRegistry with id '" + containerRegistryId + "' was not found.", 1);
+ }
+
+ return containerRegistry;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> find(Container container)
+ {
+ log.debug("get(container=" + container + ")");
+
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+
+ //ORIG return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findAllByContainer", params);
+ // SMII-242
+ // ContainerRegistry.findAllByContainer - Cannot add a boolean to the ORDER BY clause hence sorting is done here
+ List <ContainerRegistry> registry = getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findAllByContainer", params);
+ Collections.sort(registry, new FeaturedComparator()) ;
+
+ return registry ;
+
+ }
+
+ @Override
+ @Transactional(readOnly = false)
+ public void registerNewGadget(Gadget gadget, Container container)
+ {
+ if (gadget == null)
+ throw new IllegalArgumentException("Invalid gadget passed as parameter");
+
+ if (container == null || container.getContainerId() == null)
+ throw new IllegalArgumentException("Invalid container passed as parameter");
+
+ log.debug("registering a new gadget " + gadget + " to container " + container);
+
+ ContainerRegistry containerRegistry = new ContainerRegistry();
+ containerRegistry.setContainer(container);
+ containerRegistry.setGadget(gadget);
+
+ getJpaTemplate().persist(containerRegistry);
+ }
+
+ @Override
+ @Transactional (readOnly = false)
+ public void delete(ContainerRegistry containerRegistry) {
+ if (containerRegistry != null) {
+ JpaUtils.managedDelete(getJpaTemplate(), containerRegistry);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ContainerRegistry find(Container container, Gadget gadget) {
+ log.debug("find(container=" + container + ", gadget=" + gadget + ")");
+
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("gadget", gadget);
+
+ List<ContainerRegistry> list = getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByContainerAndGadget", params);
+ if (list.isEmpty())
+ return null;
+ else
+ return list.get(0);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ContainerRegistry find(Container container, URL gadgetUrl) {
+ log.debug("find(container=" + container + ", gadgetUrl=" + gadgetUrl + ")");
+
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("gadgetUrl", gadgetUrl);
+
+ List<ContainerRegistry> list = getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByContainerAndGadgetUrl", params);
+ if (list.isEmpty())
+ return null;
+ else
+ return list.get(0);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> findByAuthor(Container container, String authorName)
+ {
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("author", authorName);
+
+ return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByAuthor", params);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> findByAuthorUserId(Container container, String authorUserId)
+ {
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("authorUserId", authorUserId);
+
+ return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByAuthorUserId", params);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> findByGadgetAuthorType(Container container, GadgetAuthorType gadgetAuthorType)
+ {
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("gadgetAuthorType", gadgetAuthorType);
+
+ return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByGadgetAuthorType", params);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> findByTagName(Container container, String tagName)
+ {
+ // obtain the underlying EntityManager object
+ EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(getJpaTemplate().getEntityManagerFactory());
+ CriteriaBuilder cb = em.getCriteriaBuilder();
+
+ // setup the root object based on ContainerRegistry entity
+ CriteriaQuery<ContainerRegistry> c = cb.createQuery(ContainerRegistry.class);
+ Root<ContainerRegistry> cr = c.from(ContainerRegistry.class);
+ c.select(cr);
+ c.distinct(false);
+ // setup the joins to gadget and gadget tag
+ Join<ContainerRegistry, Gadget> gadget = cr.join("gadget", JoinType.INNER);
+ Join<Gadget, GadgetTag> gadgetTag = gadget.join("gadgetTagList", JoinType.INNER);
+ // setup the predicate conditions
+ List<Predicate> criteria = new ArrayList<Predicate>();
+ if (container != null) {
+ ParameterExpression<Container> p = cb.parameter(Container.class, "container");
+ criteria.add(cb.equal(cr.get("container"), p));
+ }
+ if (tagName != null) {
+ ParameterExpression<String> p = cb.parameter(String.class, "tagName");
+ criteria.add(cb.equal(gadgetTag.get("tagName"), p));
+ }
+ // add the predicate conditions to the where clause
+ Predicate[] p = new Predicate[criteria.size()];
+ p = criteria.toArray(p);
+ c.where(cb.and(p));
+ // setup the order by
+ c.orderBy(cb.asc(gadget.get("title")));
+
+ // create the query and bind the parameter objects
+ TypedQuery<ContainerRegistry> q = em.createQuery(c);
+ if (container != null) q.setParameter("container", container);
+ if (tagName != null) q.setParameter("tagName", tagName);
+
+ // execute and return
+ return q.getResultList();
+
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<ContainerRegistry> findByAudience(Container container, GadgetAudience gadgetAudience)
+ {
+ // TODO - is there a more efficient way of doing this query except for
+ // low level JPQL syntax? both NamedQueries and CriteriaQuery didn't seem to work because
+ // of the many-to-many relationship
+
+ // obtain the underlying EntityManager object
+ EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(getJpaTemplate().getEntityManagerFactory());
+
+ StringBuilder query = new StringBuilder();
+ query.append("SELECT cr FROM ContainerRegistry cr INNER JOIN cr.gadget g INNER JOIN g.gadgetAudienceList gal WHERE cr.container = :container AND gal = :gadgetAudience ORDER BY g.title");
+ Query q = em.createQuery(query.toString());
+ q.setParameter("container", container);
+ q.setParameter("gadgetAudience", gadgetAudience);
+
+ return (List<ContainerRegistry>)q.getResultList();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ContainerRegistry> findByGadgetTitleOrDesc(Container container, String queryString)
+ {
+ if (queryString == null || queryString.length() == 0)
+ return new ArrayList();
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("queryString", "%"+queryString+"%");
+
+ return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByGadgetTitleOrDescription", params);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ContainerRegistry> findByGadgetId(Container container, Long findByGadgetId)
+ {
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("container", container);
+ params.put("gadgetId", findByGadgetId);
+
+ return getJpaTemplate().findByNamedQueryAndNamedParams("ContainerRegistry.findByGadgetId", params);
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRegistryRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import javax.persistence.EntityManagerFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.repository.ContainerRepository;
+import org.mitre.portal.model.Container;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.orm.jpa.support.JpaDaoSupport;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Repository
+@Transactional(readOnly = true)
+public class JpaContainerRepository extends JpaDaoSupport implements ContainerRepository
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Autowired
+ public JpaContainerRepository(EntityManagerFactory entityManagerFactory)
+ {
+ setEntityManagerFactory(entityManagerFactory);
+ }
+
+ @Override
+ public Container get(Long containerId)
+ {
+ log.debug("get(containerId=" + containerId + ")");
+ Container container = getJpaTemplate().find(Container.class, containerId);
+ if (container == null) {
+ throw new IncorrectResultSizeDataAccessException("Container with id '" + containerId + "' was not found.", 1);
+ }
+
+ return container;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<Container> findAll()
+ {
+ return getJpaTemplate().findByNamedQuery("Container.findAll");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Container find(String name)
+ {
+ log.debug("get(name=" + name + ")");
+
+ // build params map
+ HashMap<String, Object> params = new HashMap<String,Object>();
+ params.put("name", name);
+
+ List<Container> list = getJpaTemplate().findByNamedQueryAndNamedParams("Container.findByName", params);
+ if (list.isEmpty())
+ return null;
+ else
+ return list.get(0);
+ }
+
+ @Override
+ @Transactional(readOnly = false)
+ public void save(Container container)
+ {
+ log.debug("containerId before: " + container.getContainerId());
+
+ if (container.getContainerId() == null) {
+ log.debug("calling persist for container " + container);
+ getJpaTemplate().persist(container);
+ getJpaTemplate().flush();
+ }
+ else {
+ log.debug("calling merge for container " + container);
+ getJpaTemplate().merge(container);
+ }
+
+ log.debug("containerId after: " + container.getContainerId());
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaContainerRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAudienceRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAudienceRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAudienceRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAudienceRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository.impl;
+
+import java.util.List;
+import javax.persistence.Cache;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.GadgetAudience;
+import org.mitre.portal.repository.GadgetAudienceRepository;
+import org.mitre.portal.repository.util.JpaUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.orm.jpa.support.JpaDaoSupport;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Repository
+@Transactional(readOnly = true)
+public class JpaGadgetAudienceRepository extends JpaDaoSupport implements GadgetAudienceRepository
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Autowired
+ public JpaGadgetAudienceRepository(EntityManagerFactory entityManagerFactory)
+ {
+ setEntityManagerFactory(entityManagerFactory);
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<GadgetAudience> findAll()
+ {
+ return getJpaTemplate().findByNamedQuery("GadgetAudience.findAll");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<GadgetAudience> findAllAssignedToGadgets()
+ {
+ return getJpaTemplate().findByNamedQuery("GadgetAudience.findAllAssignedToGadgets");
+ }
+
+ @Override
+ public GadgetAudience get(Long gadgetAudienceId)
+ {
+ log.debug("get(gadgetAudienceId=" + gadgetAudienceId + ")");
+ GadgetAudience ga = getJpaTemplate().find(GadgetAudience.class, gadgetAudienceId);
+ if (ga == null) {
+ throw new IncorrectResultSizeDataAccessException("GadgetAudience with id '" + gadgetAudienceId + "' was not found.", 1);
+ }
+ return ga;
+ }
+
+ @Override
+ public void save(GadgetAudience gadgetAudience) {
+ log.debug("gadgetAudienceId before: " + gadgetAudience.getGadgetAudienceId());
+
+ if (gadgetAudience.getGadgetAudienceId() == null) {
+ log.debug("calling persist for gadgetAudience " + gadgetAudience);
+ getJpaTemplate().persist(gadgetAudience);
+ getJpaTemplate().flush();
+ }
+ else {
+ log.debug("calling merge for gadgetAudience " + gadgetAudience);
+ getJpaTemplate().merge(gadgetAudience);
+ getJpaTemplate().flush();
+ }
+
+ log.debug("gadgetAudienceId after: " + gadgetAudience.getGadgetAudienceId());
+ }
+
+ @Override
+ public void delete(GadgetAudience gadgetAudience) {
+ if (gadgetAudience != null) {
+ log.debug("attempting to completely remove gadgetAudience " + gadgetAudience + " from portal");
+ JpaUtils.managedDelete(getJpaTemplate(), gadgetAudience);
+ // wipe the internal cache of gadget objects to reflect the removed gadgetaudience
+ Cache cache = getJpaTemplate().getEntityManagerFactory().getCache();
+ cache.evict(Gadget.class);
+ }
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAudienceRepository.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAuthorTypeRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAuthorTypeRepository.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAuthorTypeRepository.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAuthorTypeRepository.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.mitre.portal.repository.impl;
+
+import java.util.List;
+import javax.persistence.EntityManagerFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.model.GadgetAuthorType;
+import org.mitre.portal.repository.GadgetAuthorTypeRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.orm.jpa.support.JpaDaoSupport;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Repository
+@Transactional(readOnly = true)
+public class JpaGadgetAuthorTypeRepository extends JpaDaoSupport implements GadgetAuthorTypeRepository
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Autowired
+ public JpaGadgetAuthorTypeRepository(EntityManagerFactory entityManagerFactory)
+ {
+ setEntityManagerFactory(entityManagerFactory);
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<GadgetAuthorType> findAll()
+ {
+ return getJpaTemplate().findByNamedQuery("GadgetAuthorType.findAll");
+ }
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/repository/impl/JpaGadgetAuthorTypeRepository.java
------------------------------------------------------------------------------
svn:executable = *