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 [10/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/service/exception/PageException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,60 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class PageException extends Exception
+{
+    protected Long pageId;
+    protected String pageName;
+    protected String userId;
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     */
+    public PageException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public PageException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getPageId() {
+        return pageId;
+    }
+
+    public String getPageName() {
+        return pageName;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,50 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class PageLayoutException extends Exception
+{
+    protected Long pageLayoutId;
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     */
+    public PageLayoutException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public PageLayoutException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getPageLayoutId() {
+        return pageLayoutId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutNotFoundException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class PageLayoutNotFoundException extends PageLayoutException
+{
+    public PageLayoutNotFoundException(Long pageLayoutId) {
+        super("pageLayoutId " + pageLayoutId + " not found");
+        this.pageLayoutId = pageLayoutId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageLayoutNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageNotFoundException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,59 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class PageNotFoundException extends PageException
+{
+    /**
+     * Creates a new page not found exception
+     * @param pageId the page id
+     */
+    public PageNotFoundException(Long pageId) {
+        super("pageId " + pageId + " not found");
+        this.pageId = pageId;
+    }
+
+    /**
+     * Creates a new page not found exception
+     * @param pageId the page id
+     * @param userId the user owning page id
+
+     */
+    public PageNotFoundException(Long pageId, String userId) {
+        super("pageId " + pageId + " not found for user " + userId);
+        this.pageId = pageId;
+        this.userId = userId;
+    }
+
+    /**
+     * Creates a new page not found exception
+     * @param pageName the page name
+     * @param userId the user
+     */
+    public PageNotFoundException(String pageName, String userId) {
+        super("pageName " + pageName + " not found for user " + userId);
+        this.pageName = pageName;
+        this.userId = userId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class PageTemplateException extends Exception
+{
+    protected Long pageTemplateId;
+    protected String name;
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     */
+    public PageTemplateException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public PageTemplateException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getPageTemplateId() {
+        return pageTemplateId;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateNotFoundException.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.
+ */
+
+package org.mitre.portal.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class PageTemplateNotFoundException extends PageTemplateException
+{
+    public PageTemplateNotFoundException() {
+        super("default page template not found");
+    }
+
+    public PageTemplateNotFoundException(Long pageTemplateId) {
+        super("pageTemplateId " + pageTemplateId + " not found");
+        this.pageTemplateId = pageTemplateId;
+    }
+
+    public PageTemplateNotFoundException(String name) {
+        super("name: " + name + " not found");
+        this.name = name;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeException.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.
+ */
+
+package org.mitre.portal.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class PageTemplateOwnerTypeException extends Exception
+{
+    protected String pageTemplateOwnerTypeCode;
+
+    public PageTemplateOwnerTypeException(String message) {
+        super(message);
+    }
+
+    public PageTemplateOwnerTypeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public String getPageTemplateOwnerTypeCode() {
+        return pageTemplateOwnerTypeCode;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeNotFoundException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class PageTemplateOwnerTypeNotFoundException extends PageTemplateOwnerTypeException
+{
+    public PageTemplateOwnerTypeNotFoundException(String pageTemplateOwnerTypeCode) {
+        super("pageTemplateOwnerTypeCode " + pageTemplateOwnerTypeCode + " not found");
+        this.pageTemplateOwnerTypeCode = pageTemplateOwnerTypeCode;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PageTemplateOwnerTypeNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetException.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.
+ */
+
+package org.mitre.portal.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class PersonGadgetException extends Exception
+{
+    protected Long personGadgetId;
+
+    public PersonGadgetException(String message) {
+        super(message);
+    }
+
+    public PersonGadgetException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getPersonGadgetId() {
+        return personGadgetId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetNotFoundException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class PersonGadgetNotFoundException extends PersonGadgetException
+{
+    public PersonGadgetNotFoundException(Long personGadgetId) {
+        super("personGadgetId " + personGadgetId + " not found");
+        this.personGadgetId = personGadgetId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/PersonGadgetNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,60 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class RegionException extends Exception
+{
+    protected Long regionId;
+    protected String regionName;
+    protected Long pageId;
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     */
+    public RegionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public RegionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public String getRegionName() {
+        return regionName;
+    }
+
+    public Long getRegionId() {
+        return regionId;
+    }
+
+    public Long getPageId() {
+        return pageId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class RegionGadgetException extends Exception
+{
+    protected Long regionGadgetId;
+    protected String userId;
+
+    /**
+     * Creates a new region gadget exception
+     * @param message the message
+     */
+    public RegionGadgetException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new region gadget exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public RegionGadgetException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getRegionGadgetId() {
+        return regionGadgetId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetNotFoundException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class RegionGadgetNotFoundException extends RegionGadgetException
+{
+    /**
+     * Creates a new regionGadget not found exception
+     * @param regionGadgetId the regionGadget id
+     */
+    public RegionGadgetNotFoundException(Long regionGadgetId) {
+        super("regionGadgetId " + regionGadgetId + " not found");
+        this.regionGadgetId = regionGadgetId;
+    }
+
+    /**
+     * Creates a new regionGadget not found exception
+     * @param regionGadgetId the regionGadget id
+     * @param userId the user owning regionGadget id
+
+     */
+    public RegionGadgetNotFoundException(Long regionGadgetId, String userId) {
+        super("regionGadgetId " + regionGadgetId + " not found for user " + userId);
+        this.regionGadgetId = regionGadgetId;
+        this.userId = userId;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionGadgetNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionNotFoundException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class RegionNotFoundException extends RegionException
+{
+    public RegionNotFoundException(Long regionId) {
+        super("regionId " + regionId + " not found");
+        this.regionId = regionId;
+    }
+    
+    public RegionNotFoundException(Long pageId, String regionName) {
+        super("regionName " + regionName + " not found in pageId " + pageId);
+        this.pageId = pageId;
+        this.regionName = regionName;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/RegionNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/SecurityTokenException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/SecurityTokenException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/SecurityTokenException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/SecurityTokenException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class SecurityTokenException extends Exception
+{
+    /**
+     * Creates a new security token exception
+     * @param message the message
+     */
+    public SecurityTokenException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new security token exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public SecurityTokenException(String message, Throwable cause) {
+        super(message, cause);
+    }
+   
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/SecurityTokenException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownGadgetException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownGadgetException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownGadgetException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownGadgetException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class UnknownGadgetException extends GadgetException
+{
+    public UnknownGadgetException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownGadgetException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownPageException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownPageException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownPageException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownPageException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class UnknownPageException extends PageException
+{
+    /**
+     * Creates a new unknown page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public UnknownPageException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownPageException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownRegionGadgetException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownRegionGadgetException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownRegionGadgetException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownRegionGadgetException.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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class UnknownRegionGadgetException extends RegionGadgetException
+{
+    /**
+     * Creates a new unknown region gadget exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public UnknownRegionGadgetException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/UnknownRegionGadgetException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,57 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public abstract class WizardException extends Exception
+{
+    protected Long wizardId;
+    protected String name;
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     */
+    public WizardException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new page exception
+     * @param message the message
+     * @param cause the cause
+     */
+    public WizardException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Long getWizardId() {
+        return wizardId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardNotFoundException.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardNotFoundException.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardNotFoundException.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,47 @@
+/*
+ * 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.service.exception;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class WizardNotFoundException extends WizardException
+{
+    /**
+     * Creates a new page not found exception
+     * @param wizardId the page id
+     */
+    public WizardNotFoundException(Long wizardId) {
+        super("wizardId " + wizardId + " not found");
+        this.wizardId = wizardId;
+    }
+
+    /**
+     * Creates a new page not found exception
+     * @param wizardId the page id
+     * @param name the user owning page id
+
+     */
+    public WizardNotFoundException(String name) {
+        super("wizard with name '" + name + "' not found");
+        this.name = name;
+    }    
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/exception/WizardNotFoundException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultContainerService.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultContainerService.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultContainerService.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultContainerService.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,235 @@
+/*
+ * 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.service.impl;
+
+import java.net.URL;
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.mitre.portal.model.*;
+import org.mitre.portal.repository.ContainerRegistryRepository;
+import org.mitre.portal.repository.ContainerRepository;
+import org.mitre.portal.repository.GadgetAudienceRepository;
+import org.mitre.portal.repository.GadgetTagRepository;
+import org.mitre.portal.repository.util.JpaConstants;
+import org.mitre.portal.security.UserService;
+import org.mitre.portal.service.ContainerService;
+import org.mitre.portal.service.exception.ContainerNotFoundException;
+import org.mitre.portal.service.exception.ContainerRegistryNotFoundException;
+import org.mitre.portal.service.exception.DuplicateGadgetUrlException;
+import org.mitre.portal.service.exception.GadgetAudienceNotFoundException;
+import org.mitre.portal.service.exception.GadgetException;
+import org.mitre.portal.service.exception.UnknownGadgetException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Service(value="containerService")
+public class DefaultContainerService implements ContainerService
+{
+    private final ContainerRepository containerRepository;
+    private final ContainerRegistryRepository containerRegistryRepository;
+    private final UserService userService;
+    private final GadgetAudienceRepository gadgetAudienceRepository;
+    private final GadgetTagRepository gadgetTagRepository;
+
+    @Autowired
+    public DefaultContainerService(ContainerRepository containerRepository, 
+                                   ContainerRegistryRepository containerRegistryRepository,
+                                   UserService userService,
+                                   GadgetAudienceRepository gadgetAudienceRepository,
+                                   GadgetTagRepository gadgetTagRepository)
+    {
+        this.containerRepository = containerRepository;
+        this.containerRegistryRepository = containerRegistryRepository;
+        this.userService = userService;
+        this.gadgetAudienceRepository = gadgetAudienceRepository ;
+        this.gadgetTagRepository = gadgetTagRepository ;
+    }
+
+    @Override
+    public List<Container> getAll()
+    {
+        return containerRepository.findAll();
+    }
+
+    @Override
+    public Container getContainer(Long containerId) throws ContainerNotFoundException
+    {
+        Container c = null;
+        try {
+            c = containerRepository.get(containerId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new ContainerNotFoundException(containerId);
+        }
+
+        return c;
+    }
+
+    @Override
+    public Container findContainer(String name)
+    {
+        return containerRepository.find(name);
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")
+    public void saveContainer(Container container)
+    {
+        containerRepository.save(container);
+    }
+
+    @Override
+    public ContainerRegistry getContainerRegistry(Long containerRegistryId) throws ContainerRegistryNotFoundException
+    {
+        ContainerRegistry cr = null;
+        try {
+            cr = containerRegistryRepository.get(containerRegistryId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new ContainerRegistryNotFoundException(containerRegistryId);
+        }
+        return cr;
+    }
+
+    @Override
+    public ContainerRegistry findContainerRegistry(Container container, Gadget gadget)
+    {
+        return containerRegistryRepository.find(container, gadget);
+    }
+
+    @Override
+    public List<ContainerRegistry> findContainerRegistry(Container container)
+    {
+        return containerRegistryRepository.find(container);
+    }
+
+    @Override
+    public ContainerRegistry findContainerRegistry(Container container, URL gadgetUrl) {
+        return containerRegistryRepository.find(container, gadgetUrl);
+    }
+
+    @Override
+    @PreAuthorize("hasAnyRole('UNOFFICIAL_GADGET_DEVELOPER','OFFICIAL_GADGET_DEVELOPER')")
+    public void registerNewGadget(Gadget gadget, Container container) throws GadgetException, GadgetAudienceNotFoundException
+    {
+        try {
+            Date now = new Date();
+            Person user = userService.getCurrentAuthenticatedUser();
+            gadget.setCreatedBy(user.getUserId());
+            gadget.setCreatedDate(now);
+            gadget.setModifiedBy(user.getUserId());
+            gadget.setModifiedDate(now);
+            containerRegistryRepository.registerNewGadget(gadget, container);
+        }
+        catch (Exception e) {
+            Throwable rootException = ExceptionUtils.getRootCause(e);
+            // check to see if the database error is a unique gadget url constraint violation
+            if (rootException instanceof SQLIntegrityConstraintViolationException) {
+                if (rootException.getMessage() != null && rootException.getMessage().contains(JpaConstants.Constraint.UNIQUE_GADGET_URL)) {
+                    throw new DuplicateGadgetUrlException(gadget.getUrl().toString());
+                } else {
+                    throw new UnknownGadgetException("Unknown SQLIntegrityConstraintViolationException thrown: ", rootException);
+                }
+            } else if (rootException instanceof IllegalStateException) {
+                if (rootException.getMessage() != null && rootException.getMessage().contains("synchronization") && rootException.getMessage().contains("GadgetAudience")) {
+                    throw new GadgetAudienceNotFoundException("attempted to save gadget with dirty gadgetAudience");
+                } else {
+                    throw new UnknownGadgetException("Unknown IllegalStateException thrown: ", rootException);
+                }
+            } else {
+                throw new UnknownGadgetException("Unknown Exception thrown: ", e);
+            }
+        }
+
+    }
+
+    @Override
+    @PreAuthorize("hasRole('REPOSITORY_ADMIN')")
+    public void delete(ContainerRegistry containerRegistry) {
+        containerRegistryRepository.delete(containerRegistry);
+    }
+
+    @Override
+    public List<ContainerRegistry> findByAuthor(Container container, String authorName)
+    {
+     	return containerRegistryRepository.findByAuthor(container, authorName);
+    }
+
+    @Override
+    public List<ContainerRegistry> findByAuthorUserId(Container container, String authorUserId)
+    {
+     	return containerRegistryRepository.findByAuthorUserId(container, authorUserId);
+    }
+
+    @Override
+    public List<ContainerRegistry> findByGadgetAuthorType(Container container, GadgetAuthorType gadgetAuthorType)
+    {
+     	return containerRegistryRepository.findByGadgetAuthorType(container, gadgetAuthorType);
+    }
+    
+    @Override
+    public List<ContainerRegistry> findByGadgetTitleOrDesc(Container container, String queryString)
+    {
+     	return containerRegistryRepository.findByGadgetTitleOrDesc(container, queryString);
+    }
+    
+
+    @Override
+    public List<ContainerRegistry> findByTagName(Container container, String tagName)
+    {
+     	return containerRegistryRepository.findByTagName(container, tagName) ;
+    }
+    
+    @Override
+    public List<ContainerRegistry> findByAudience(Container container, GadgetAudience gadgetAudience)
+    {
+     	return containerRegistryRepository.findByAudience(container, gadgetAudience) ;
+    }
+
+    @Override
+    public List<ContainerRegistry> findByGadgetId(Container container, Long gadgetId)
+    {
+     	return containerRegistryRepository.findByGadgetId(container, gadgetId) ;
+    }
+
+    @Override
+    public List<GadgetAudience> findAllGadgetAudience()
+    {
+        return gadgetAudienceRepository.findAll();
+    }
+
+    @Override
+    public List<String> findAllGadgetTags()
+    {
+        return gadgetTagRepository.findAll();
+
+    }
+
+
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultContainerService.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultGadgetService.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultGadgetService.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultGadgetService.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultGadgetService.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,633 @@
+/*
+ * 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.service.impl;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shindig.auth.SecurityToken;
+import org.mitre.portal.model.*;
+import org.mitre.portal.repository.*;
+import org.mitre.portal.security.SecurityTokenService;
+import org.mitre.portal.security.UserService;
+import org.mitre.portal.service.GadgetService;
+import org.mitre.portal.service.ShindigService;
+import org.mitre.portal.service.exception.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.security.access.prepost.PostAuthorize;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Service;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.mitre.portal.web.util.JsonUtils;
+
+/**
+ * @author ACARLUCCI
+ */
+@Service(value = "gadgetService")
+public class DefaultGadgetService implements GadgetService {
+    private GadgetRepository gadgetRepository;
+    private GadgetUserPrefRepository gadgetUserPrefRepository;
+    private PersonGadgetRepository personGadgetRepository;
+    private GadgetSupportLinkTypeRepository gadgetSupportLinkTypeRepository;
+    private GadgetAuthorTypeRepository gadgetAuthorTypeRepository;
+    private GadgetAudienceRepository gadgetAudienceRepository;
+    private SecurityTokenService securityTokenService;
+    private UserService userService;
+    private GadgetRatingRepository gadgetRatingRepository;
+    private GadgetCommentRepository gadgetCommentRepository;
+    private ShindigService shindigService;
+    private SecurityRoleRepository securityRoleRepository;
+    private SecurityUserRoleRepository securityUserRoleRepository;
+   
+    private static final Log log = LogFactory.getLog(DefaultGadgetService.class);    
+
+    @Autowired
+    public DefaultGadgetService(GadgetRepository gadgetRepository,
+                                GadgetUserPrefRepository gadgetUserPrefRepository,
+                                PersonGadgetRepository personGadgetRepository,
+                                GadgetSupportLinkTypeRepository gadgetSupportLinkTypeRepository,
+                                GadgetAuthorTypeRepository gadgetAuthorTypeRepository,
+                                GadgetAudienceRepository gadgetAudienceRepository,
+                                SecurityTokenService securityTokenService,
+                                UserService userService,
+                                GadgetRatingRepository gadgetRating,
+                                GadgetCommentRepository gadgetCommentRepository,
+                                SecurityRoleRepository securityRoleRepository,
+                                SecurityUserRoleRepository securityUserRoleRepository,
+                                ShindigService shindigService) {                                
+        this.gadgetRepository = gadgetRepository;
+        this.gadgetUserPrefRepository = gadgetUserPrefRepository;
+        this.personGadgetRepository = personGadgetRepository;
+        this.gadgetSupportLinkTypeRepository = gadgetSupportLinkTypeRepository;
+        this.gadgetAuthorTypeRepository = gadgetAuthorTypeRepository;
+        this.gadgetAudienceRepository = gadgetAudienceRepository;
+        this.securityTokenService = securityTokenService;
+        this.userService = userService;
+        this.gadgetRatingRepository = gadgetRating;
+        this.gadgetCommentRepository = gadgetCommentRepository;
+        this.shindigService = shindigService;
+        this.securityRoleRepository = securityRoleRepository ;
+        this.securityUserRoleRepository = securityUserRoleRepository ;
+    }
+
+    @Override
+    public Gadget getGadget(Long gadgetId) throws GadgetNotFoundException {
+        Gadget g = null;
+        try {
+            g = gadgetRepository.get(gadgetId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new GadgetNotFoundException(gadgetId);
+        }
+        return g;
+    }
+
+    @Override
+    @PreAuthorize("hasAnyRole('UNOFFICIAL_GADGET_DEVELOPER','OFFICIAL_GADGET_DEVELOPER')")
+    public Gadget findGadgetFromUrl(URL gadgetUrl, Container container) {
+        log.debug("attempting to get gadget metadata from " + gadgetUrl);
+        if (gadgetUrl == null)
+            throw new IllegalArgumentException("gadgetUrl is null");
+
+        if (container == null || container.getName() == null)
+            throw new IllegalArgumentException("container is null");           
+
+        // invoke the http call to the shindig metadata service
+        String rawMetadataResponse = shindigService.invokeShindigMetadataPost(gadgetUrl, container);
+
+        // convert the response from the metadata service to a gadget object
+        return convertRawMetadataResponseToGadget(rawMetadataResponse, gadgetUrl);      
+    }
+
+    @Override
+    public GadgetUserPref getGadgetUserPref(Long gadgetUserPrefId) throws GadgetUserPrefNotFoundException {
+        GadgetUserPref gup = null;
+        try {
+            gup = gadgetUserPrefRepository.get(gadgetUserPrefId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new GadgetUserPrefNotFoundException(gadgetUserPrefId);
+        }
+        return gup;
+    }
+
+    @Override
+    public List<GadgetUserPref> findGadgetUserPrefs(Gadget gadget) {
+        return gadgetUserPrefRepository.find(gadget);
+    }
+
+    @Override
+    @PostAuthorize("returnObject == null or returnObject.userId == principal.userId")
+    public PersonGadget getPersonGadget(Long personGadgetId) throws PersonGadgetNotFoundException, SecurityTokenException {
+        PersonGadget pg = null;
+        try {
+            pg = personGadgetRepository.get(personGadgetId);
+            pg.setSecurityToken(securityTokenService.getEncryptedEncodedSecurityToken(pg));
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new PersonGadgetNotFoundException(personGadgetId);
+        }
+
+        return pg;
+     }
+
+    @Override
+    @PostAuthorize("returnObject == null or returnObject.userId == principal.userId")
+    public PersonGadget getPersonGadget(SecurityToken securityToken) throws PersonGadgetNotFoundException, SecurityTokenException {
+        if (securityToken == null)
+            throw new SecurityTokenException("securityToken is null");
+        
+        Long personGadgetId = securityToken.getModuleId();
+        return getPersonGadget(personGadgetId);
+    }
+
+    @Override
+    @PreAuthorize("#user.userId == principal.userId")
+    public List<PersonGadget> findPersonGadgets(Person user) {
+        List<PersonGadget> gadgets = null;
+        if (user == null)
+            return gadgets;
+
+        gadgets = personGadgetRepository.find(user.getUserId());
+
+        try {
+            for (PersonGadget gadget : gadgets) {
+                gadget.setSecurityToken(securityTokenService.getEncryptedEncodedSecurityToken(gadget));
+            }
+        } catch (Exception e) {
+            log.error("Error creating user token:", e);
+        }
+
+        return gadgets;
+    }
+
+    @Override
+    @PreAuthorize("hasRole('REPOSITORY_ADMIN')")
+    public void delete(Gadget gadget) {
+        gadgetRepository.delete(gadget);
+    }
+
+    @Override
+    @PreAuthorize("hasAnyRole('UNOFFICIAL_GADGET_DEVELOPER','OFFICIAL_GADGET_DEVELOPER')")
+    public void save(Gadget gadget) throws GadgetAudienceNotFoundException, UnknownGadgetException {
+        String userId = userService.getCurrentAuthenticatedUser().getUserId();
+        Date now = new Date();
+        gadget.setModifiedBy(userId);
+        gadget.setModifiedDate(now);
+        if (gadget.getGadgetId() == null) {
+            gadget.setCreatedBy(userId);
+            gadget.setCreatedDate(now);
+        }
+        try {
+            gadgetRepository.save(gadget);
+        }
+        catch (Exception e) {
+            // check to see if the database error was caused by dirty gadget audience data (deleted in separate transaction)
+            if (ExceptionUtils.getRootCause(e) instanceof SQLIntegrityConstraintViolationException) {
+                SQLIntegrityConstraintViolationException rootException = (SQLIntegrityConstraintViolationException) ExceptionUtils.getRootCause(e);
+                if (rootException.getMessage() != null && rootException.getMessage().contains("GADGET_AUDIENCE")) {
+                    throw new GadgetAudienceNotFoundException("attempted to save gadget with dirty gadgetAudience");
+                } else {
+                    throw new UnknownGadgetException("Unknown SQLIntegrityConstraintViolationException thrown: ", rootException);
+                }
+            } else {
+                throw new UnknownGadgetException("Unknown Exception thrown: ", e);
+            }
+        }
+    }
+
+    @Override
+    @PreAuthorize("hasAnyRole('UNOFFICIAL_GADGET_DEVELOPER','OFFICIAL_GADGET_DEVELOPER')")
+    public void updateUserPrefMetaData(Gadget existingGadget, Gadget updatedGadget) {
+        List<GadgetUserPref> existingUserPrefs = existingGadget.getGadgetUserPrefList();
+        if (existingUserPrefs == null) existingUserPrefs = new ArrayList<GadgetUserPref>();
+        List<GadgetUserPref> updatedUserPrefs = updatedGadget.getGadgetUserPrefList();
+        if (updatedUserPrefs == null) updatedUserPrefs = new ArrayList<GadgetUserPref>();
+        List<GadgetUserPref> newUserPrefs = new ArrayList<GadgetUserPref>();
+
+        // check to see if any existing gadget prefs have been updated or removed
+        for (GadgetUserPref gup : existingUserPrefs) {
+            String prefName = gup.getName();
+            for (GadgetUserPref newGup : updatedUserPrefs) {
+                // update the existing user pref
+                if (prefName.equals(newGup.getName())) {
+                    gup.setDataType(newGup.getDataType());
+                    gup.setDisplayName(newGup.getDisplayName());
+                    gup.setDefaultValue(newGup.getDefaultValue());
+                    gup.setRequired(newGup.getRequired());
+                    newUserPrefs.add(gup);
+                    break;
+                }
+            }
+        }
+
+        // check to see if any new gadget prefs added
+        for (GadgetUserPref newGup : updatedUserPrefs) {
+            String newPrefName = newGup.getName();
+            boolean isExisting = false;
+            for (GadgetUserPref gup : existingUserPrefs) {
+                // add the user pref if not existing
+                if (newPrefName.equals(gup.getName())) {
+                    isExisting = true;
+                    break;
+                }
+            }
+            if (!isExisting) {
+                newGup.setGadget(existingGadget);
+                newUserPrefs.add(newGup);
+            }
+        }
+
+        existingGadget.setGadgetUserPrefList(newUserPrefs);
+    }
+
+    @Override
+    public List<GadgetSupportLinkType> getAllSupportLinkTypes() {
+        return gadgetSupportLinkTypeRepository.findAll();
+    }
+
+    @Override
+    public List<GadgetAuthorType> getAllAuthorTypes() {
+        return gadgetAuthorTypeRepository.findAll();
+    }
+
+    @Override
+    public List<GadgetAudience> getAllAudiences() {
+        return gadgetAudienceRepository.findAll();
+    }
+
+    @Override
+    public List<GadgetAudience> getAllAudiencesAssignedToGadgets() {
+        return gadgetAudienceRepository.findAllAssignedToGadgets();
+    }
+
+    @Override
+    public GadgetRating getGadgetRating(Long gadgetId) throws GadgetNotFoundException, GadgetUserPrefNotFoundException {
+        try {
+            return gadgetRatingRepository.get(gadgetId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new GadgetUserPrefNotFoundException(gadgetId);
+        }
+    }
+
+    @Override
+    public GadgetRating getUserGadgetRating(Gadget gadget, String userId) throws GadgetUserPrefNotFoundException
+    {
+        try {
+            return gadgetRatingRepository.find(gadget, userId);
+        }
+        catch (IncorrectResultSizeDataAccessException e){
+            throw new GadgetUserPrefNotFoundException(gadget.getGadgetId());
+        }
+    }
+
+    @Override
+    public List<GadgetRating> getGadgetRatings(Gadget gadget) {
+        return gadgetRatingRepository.find(gadget);
+    }
+
+    @Override
+    public List<GadgetRating> getGadgetRatings(String userId) {
+        return  gadgetRatingRepository.find(userId);
+    }
+
+    @Override
+    @PreAuthorize("#rating.userId == principal.userId")
+    public void save(GadgetRating rating){
+        gadgetRatingRepository.save(rating);
+    }
+
+    @Override
+    public GadgetAudience getGadgetAudience(Long gadgetAudienceId) throws GadgetAudienceNotFoundException
+    {
+        try {
+            return gadgetAudienceRepository.get(gadgetAudienceId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new GadgetAudienceNotFoundException(gadgetAudienceId);
+        }    	
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")
+    public void save(GadgetAudience gadgetAudience) {
+        // ensure the code field is always upper case
+        if (gadgetAudience != null && gadgetAudience.getCode() != null) {
+            gadgetAudience.setCode(gadgetAudience.getCode().toUpperCase());
+        }
+        gadgetAudienceRepository.save(gadgetAudience);
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")
+    public void delete(GadgetAudience gadgetAudience) {
+        gadgetAudienceRepository.delete(gadgetAudience);
+    }
+
+    @Override
+    public GadgetComment getGadgetComment(Long gadgetCommentId) throws GadgetCommentNotFoundException {
+        GadgetComment gadgetComment = null;
+
+        try {
+            gadgetComment = gadgetCommentRepository.get(gadgetCommentId);
+        }
+        catch (IncorrectResultSizeDataAccessException e) {
+            throw new GadgetCommentNotFoundException(gadgetCommentId);
+        }
+        return gadgetComment;
+    }
+
+    @Override
+    public List<GadgetComment> findGadgetCommentsByGadget(Gadget gadget) {
+        return gadgetCommentRepository.findByGadget(gadget);
+    }
+
+    @Override
+    @PreAuthorize("#gadgetComment.userId == principal.userId or hasRole('APPLICATION_ADMIN')")
+    public void save(GadgetComment gadgetComment) {
+        String userId = userService.getCurrentAuthenticatedUser().getUserId();
+
+        gadgetComment.setCreatedByAdmin(false);
+        gadgetComment.setLastModifiedByAdmin(false);
+
+        // if this is a new gadget comment archive off the gadget version and
+        // the user's rating of the gadget, if it exists
+        if (gadgetComment.getGadgetCommentId() == null)  {
+            Gadget gadget = gadgetComment.getGadget();
+            GadgetRating gadgetRating = null;
+
+            // check to see if user has rated this gadget
+            try {
+                gadgetRating = gadgetRatingRepository.find(gadget, userId);
+            } catch (Exception e) {
+                // continue on...
+            }
+
+            gadgetComment.setUserId(userId);
+            gadgetComment.setLastModifiedUserId(userId);
+            gadgetComment.setGadgetRating(gadgetRating == null ? null : gadgetRating.getRating());
+            gadgetComment.setGadgetVersion(gadget.getVersion());
+        } else {
+            // if this gadgetComment already exists update the last mod user id
+            gadgetComment.setLastModifiedUserId(userId);
+        }
+        
+        gadgetCommentRepository.save(gadgetComment);
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")    
+    public void saveAsAdmin(GadgetComment gadgetComment) {
+        String userId = userService.getCurrentAuthenticatedUser().getUserId();
+
+        gadgetComment.setLastModifiedByAdmin(true);
+        
+        // when saving a comment as an admin ignore the rating (save null)
+        if (gadgetComment.getGadgetCommentId() == null)  {
+            gadgetComment.setCreatedByAdmin(true);
+            Gadget gadget = gadgetComment.getGadget();            
+            
+            gadgetComment.setUserId(userId);
+            gadgetComment.setLastModifiedUserId(userId);
+            gadgetComment.setGadgetRating(null);
+            gadgetComment.setGadgetVersion(gadget.getVersion());            
+        } else {
+            // if this gadgetComment already exists update the last mod user id
+            // and always update the gadget version for admin-updating-admin comments
+            gadgetComment.setGadgetVersion(gadgetComment.getGadget().getVersion());
+            gadgetComment.setLastModifiedUserId(userId);
+        }
+        
+        gadgetCommentRepository.save(gadgetComment);
+    }
+
+    @Override
+    @PreAuthorize("#gadgetComment.userId == principal.userId or hasRole('APPLICATION_ADMIN')")
+    public void delete(GadgetComment gadgetComment) {
+        gadgetCommentRepository.delete(gadgetComment);
+    }
+
+    @Override
+    public List<SecurityRole> getAllSecurityRoles()
+    {
+        return securityRoleRepository.findAll();
+    }
+
+    @Override
+    public List<SecurityUserRole> getAllSecurityUserRoleByUserId ( String userId ) {
+        return securityUserRoleRepository.find(userId);
+    }
+
+    // returns a SecurityUserRole based on userId
+    public SecurityUserRole getSecurityUserRole(String userId)
+    {
+      return securityUserRoleRepository.get(userId) ;
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")
+    public void save(SecurityUserRole securityUserRole)
+    {
+        securityUserRoleRepository.save(securityUserRole);
+    }
+
+    @Override
+    @PreAuthorize("hasRole('APPLICATION_ADMIN')")
+    public void delete(SecurityUserRole securityUserRole)
+    {
+        securityUserRoleRepository.delete(securityUserRole);
+    }
+    
+    /****** private methods ******/
+    private void createEnumTypeList(GadgetUserPref gadgetUserPref, List orderedEnumValues) {
+        gadgetUserPref.setGadgetUserPrefEnumTypeList(new ArrayList<GadgetUserPrefEnumType>());
+       
+        for (int i = 0; i < orderedEnumValues.size(); i++) {
+            Map enumObj = (Map) orderedEnumValues.get(i);
+            GadgetUserPrefEnumType gadgetUserPrefEnumType = new GadgetUserPrefEnumType();
+            gadgetUserPrefEnumType.setEnumValue((String)enumObj.get("value"));
+            gadgetUserPrefEnumType.setEnumDisplayValue((String)enumObj.get("displayValue"));
+            gadgetUserPrefEnumType.setSortValue(i + 1);
+            gadgetUserPrefEnumType.setGadgetUserPref(gadgetUserPref);
+            gadgetUserPref.getGadgetUserPrefEnumTypeList().add(gadgetUserPrefEnumType);
+        }
+    }
+
+    private void createListTypeList(GadgetUserPref gadgetUserPref, String delimitedListValues) {
+        gadgetUserPref.setGadgetUserPrefListTypeList(new ArrayList<GadgetUserPrefListType>());
+       
+        if (delimitedListValues.isEmpty()) {
+            return;
+        }
+
+        String[] valuesArray = delimitedListValues.split("\\|");
+        for (int i = 0; i < valuesArray.length; i++) {
+            GadgetUserPrefListType gadgetUserPrefListType = new GadgetUserPrefListType();
+            gadgetUserPrefListType.setListValue(valuesArray[i]);
+            gadgetUserPrefListType.setSortValue(i + 1);
+            gadgetUserPrefListType.setGadgetUserPref(gadgetUserPref);
+            gadgetUserPref.getGadgetUserPrefListTypeList().add(gadgetUserPrefListType);
+        }
+    }
+
+    private Gadget convertRawMetadataResponseToGadget(String rawMetadataResponse, URL gadgetUrl) {
+        if (rawMetadataResponse.isEmpty()) {
+            return null;
+        }
+        
+        Gadget gadget = null;
+        // parse the response and grab the relevant gadget metadata fields
+        LinkedHashMap jsonResponse = null;
+        try {
+            jsonResponse = (LinkedHashMap) JsonUtils.unmarshall(rawMetadataResponse, Object.class);
+        } catch (Exception e) {
+            log.error("unable to process metadataresponse from shindig", e);
+        }
+
+        List gadgetsList = (List) jsonResponse.get("gadgets");
+
+        if (gadgetsList.size() > 0) {
+            log.info("parsing gadget metadata...");
+            Map gadgetMap = (Map) gadgetsList.get(0);
+
+            // check to see if there are any errors getting the gadget url
+            if (gadgetMap.containsKey("errors")) {
+                String errorMsg = (String) ((List)gadgetMap.get("errors")).get(0);
+                log.error("unable to get gadget meta data: " + errorMsg);
+                return null;
+            }
+
+            String title = (String) gadgetMap.get("title");
+            log.info("title: " + title);
+            Integer height = (Integer)gadgetMap.get("height");
+            log.info("height: " + height);
+            Boolean scrolling = (Boolean) gadgetMap.get("scrolling");
+            log.info("scrolling: " + scrolling);
+
+            // TODO - for some reason the description is not returned in the
+            // json respose, figure out why?  limitation in shindig?
+            //String description = gadgetMap.get("description");
+            String description = "HARD_CODED_DESCRIPTION";
+            log.info("description: " + description);
+            String author = (String) gadgetMap.get("author");
+            log.info("author: " + author);
+            String authorEmail = (String) gadgetMap.get("authorEmail");
+            log.info("authorEmail: " + authorEmail);
+            String thumbnailUrlStr = (String) gadgetMap.get("thumbnail");
+            log.info("thumbnailUrlStr: " + thumbnailUrlStr);
+            String screenshotUrlStr = (String) gadgetMap.get("screenshot");
+            log.info("screenshotUrlStr: " + screenshotUrlStr);
+
+            gadget = new Gadget();
+            gadget.setAuthor(author);
+            gadget.setDescription(description);
+
+            URL thumbnailUrl = null;
+            URL screenshotUrl = null;
+
+            // if the thumbnail or screenshot urls are invalid fail gracefully and continue parsing metadata
+            try {
+                if (!thumbnailUrlStr.isEmpty())
+                    thumbnailUrl = new URL(thumbnailUrlStr);
+                gadget.setThumbnailUrl(thumbnailUrl);
+            } catch (MalformedURLException e) {
+                log.warn("malformed thumbnail url in gadget metadata", e);
+            }
+
+            try {
+                if (!screenshotUrlStr.isEmpty())
+                    screenshotUrl = new URL(screenshotUrlStr);
+                gadget.setScreenshotUrl(screenshotUrl);
+            } catch (MalformedURLException e) {
+                log.warn("malformed screenshot url in gadget metadata", e);
+            }
+
+            gadget.setTitle(title);
+            gadget.setUrl(gadgetUrl);
+            gadget.setHeight(height.longValue());
+            gadget.setScrolling(scrolling);
+            
+            // check to see if this gadget has user prefs
+            Map<String, Map<String,Object>> userPrefs = (Map<String, Map<String,Object>>) gadgetMap.get("userPrefs");
+            if (!userPrefs.isEmpty()) {
+                log.info("gadget has user prefs");
+                ArrayList<GadgetUserPref> gadgetUserPrefs = new ArrayList<GadgetUserPref>(userPrefs.size());
+
+                for (Map.Entry<String, Map<String,Object>> entry : userPrefs.entrySet()) {
+                    String key = entry.getKey();
+                    Map<String,Object> values = entry.getValue();
+                    gadgetUserPrefs.add(createGadgetUserPrefFromValueMap(gadget, key, values));
+                }
+
+                gadget.setGadgetUserPrefList(gadgetUserPrefs);
+            } else {
+                log.info("gadget has no user prefs");
+            }
+        }
+
+        return gadget;
+    }
+
+    private GadgetUserPref createGadgetUserPrefFromValueMap(Gadget gadget, String prefName, Map<String,Object> prefValues) {
+        GadgetUserPref gadgetUserPref = new GadgetUserPref();
+        log.info("pref: " + prefName);
+
+        String defaultValue = (String)prefValues.get("default");
+        log.info("      default: " + defaultValue);
+        String dataType = (String)prefValues.get("type");
+        log.info("      type: " + dataType);
+        String displayName = (String)prefValues.get("displayName");
+        log.info("      displayName: " + displayName);
+
+        // TODO - required is not coming over from metadata service, do we need to fix the shindig code?
+        //boolean required = userPref.getBoolean("required");
+        //log.info("required: " + required);
+
+        // if data type is enum or list perform array loading
+        if ("enum".equals(dataType)) {
+           createEnumTypeList(gadgetUserPref, (List)prefValues.get("orderedEnumValues"));
+        } else if ("list".equals(dataType)) {
+           createListTypeList(gadgetUserPref, (String)prefValues.get("default"));
+        }
+
+        // update the gadgetUserPref object fields and add to list
+        gadgetUserPref.setGadget(gadget);
+        gadgetUserPref.setDataType(dataType);
+        // don't fill in the default value for list type since they are stored in a different table
+        if (!"list".equals(dataType))
+            gadgetUserPref.setDefaultValue(defaultValue);
+        gadgetUserPref.setDisplayName(displayName);
+        gadgetUserPref.setName(prefName);
+        // TODO - this is hardcoded b/c of above issue with required not coming over
+        gadgetUserPref.setRequired(false);
+
+        return gadgetUserPref;
+    }
+}
\ No newline at end of file

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultGadgetService.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultMetricsLoggingService.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultMetricsLoggingService.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultMetricsLoggingService.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultMetricsLoggingService.java Fri Apr  1 16:42:22 2011
@@ -0,0 +1,90 @@
+/*
+ * 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.service.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.model.Gadget;
+import org.mitre.portal.model.Page;
+import org.mitre.portal.model.Person;
+import org.mitre.portal.service.MetricsLoggingService;
+import org.mitre.portal.service.util.MetricsLoggingKeys;
+import org.springframework.stereotype.Service;
+
+/**
+ * Implementation of the MetricsLoggingService to log specific metrics
+ * actions to a separate log file from the main log file
+ *
+ * @author ACARLUCCI
+ */
+@Service(value = "metricsLoggingService")
+public class DefaultMetricsLoggingService implements MetricsLoggingService {
+    private static final Log log = LogFactory.getLog("metrics");
+
+    @Override
+    public String logGadgetAction(MetricsLoggingKeys.GadgetActions action, Person user, Gadget gadget, Page toPage, Page fromPage) {
+        // log the gadget action        
+        String logText = null;        
+        String sui = null;
+        Long gadgetId = null;
+        String gadgetTitle = null;
+        Long fromPageId = null;
+        String fromPageName = null;
+        Long toPageId = null;
+        String toPageName = null;
+
+        if (user != null) {
+            sui = user.getUsername();
+        }
+
+        if (gadget != null) {
+            gadgetId = gadget.getGadgetId();
+            gadgetTitle = gadget.getTitle();
+        }
+
+        if (toPage != null) {
+            toPageId = toPage.getPageId();
+            toPageName = toPage.getName();
+        }
+
+        if (fromPage != null) {
+            fromPageId = fromPage.getPageId();
+            fromPageName = fromPage.getName();
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append(action)
+          .append("|sui:").append(sui)
+          .append("|gadgetId:").append(gadgetId)
+          .append("|gadgetTitle:\"").append(gadgetTitle).append("\"")
+          .append("|toPageId:").append(toPageId)
+          .append("|toPageName:\"").append(toPageName).append("\"")
+          .append("|fromPageId:").append(fromPageId)
+          .append("|fromPageName:\"").append(fromPageName).append("\"");
+
+        logText = sb.toString();
+        // write it out...
+        log.info(logText);
+
+        // return the text that was logged out, mostly useful for
+        // testing purposes
+        return logText;
+    }
+}

Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/service/impl/DefaultMetricsLoggingService.java
------------------------------------------------------------------------------
    svn:executable = *