continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r478920 - /maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
Date Fri, 24 Nov 2006 17:19:39 GMT
Author: evenisse
Date: Fri Nov 24 09:19:38 2006
New Revision: 478920

URL: http://svn.apache.org/viewvc?view=rev&rev=478920
Log:
Add missing action

Added:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
  (with props)

Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java?view=auto&rev=478920
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
Fri Nov 24 09:19:38 2006
@@ -0,0 +1,122 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2004-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.util.Iterator;
+
+import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.ContinuumException;
+
+import com.opensymphony.xwork.Validateable;
+
+/**
+ * @author Henry Isidro <hisidro@exist.com>
+ *
+ * @plexus.component
+ *   role="com.opensymphony.xwork.Action"
+ *   role-hint="addProjectGroup"
+ */
+public class AddProjectGroupAction
+    extends ContinuumActionSupport
+    implements Validateable
+{
+    private String name;
+
+    private String groupId;
+
+    private String description;
+
+    public void validate()
+    {
+        clearErrorsAndMessages();
+        if ( name != null && name.equals( "" ) )
+        {
+            addActionError( "projectGroup.error.name.required" );
+        }
+        if ( name != null && !name.equals( "" ) )
+        {
+            Iterator iterator = getContinuum().getAllProjectGroups().iterator();
+            while ( iterator.hasNext() )
+            {
+                ProjectGroup projectGroup = (ProjectGroup) iterator.next();
+                if ( projectGroup.getName().equals( name ) )
+                {
+                    addActionError( "projectGroup.error.name.already.exists" );
+                    break;
+                }
+            }
+        }
+        if ( groupId != null && groupId.equals( "" ) )
+        {
+            addActionError( "projectGroup.error.groupId.required" );
+        }
+    }
+
+    public String execute()
+    {
+        ProjectGroup projectGroup = new ProjectGroup();
+
+        projectGroup.setName( name );
+
+        projectGroup.setGroupId( groupId );
+
+        projectGroup.setDescription( description );
+
+        try
+        {
+            getContinuum().addProjectGroup( projectGroup );
+        }
+        catch ( ContinuumException e )
+        {
+            getLogger().error( "Error adding project group: " + e.getLocalizedMessage() );
+
+            return ERROR;
+        }
+
+        return SUCCESS;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+}

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message