Coverage Report - org.apache.maven.archiva.database.constraints.ProjectsByArtifactUsageConstraint
 
Classes in this File Line Coverage Branch Coverage Complexity
ProjectsByArtifactUsageConstraint
0%
0/12
N/A
1
 
 1  
 package org.apache.maven.archiva.database.constraints;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.archiva.database.DeclarativeConstraint;
 23  
 import org.apache.maven.archiva.model.ArchivaArtifact;
 24  
 import org.apache.maven.archiva.model.Dependency;
 25  
 
 26  
 /**
 27  
  * ProjectsByArtifactUsageConstraint 
 28  
  *
 29  
  * @version $Id: ProjectsByArtifactUsageConstraint.java 718864 2008-11-19 06:33:35Z brett $
 30  
  */
 31  
 public class ProjectsByArtifactUsageConstraint
 32  
     extends AbstractDeclarativeConstraint
 33  
     implements DeclarativeConstraint
 34  
 {
 35  
     private String filter;
 36  
     
 37  
     public ProjectsByArtifactUsageConstraint( ArchivaArtifact artifact )
 38  
     {
 39  0
         this( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion() );
 40  0
     }
 41  
     
 42  
     public ProjectsByArtifactUsageConstraint( String groupId, String artifactId, String version )
 43  0
     {
 44  0
         super.declImports = new String[] {
 45  
             "import " + Dependency.class.getName()
 46  
         };
 47  
         
 48  0
         super.variables = new String[] {
 49  
             "Dependency dep"
 50  
         };
 51  
         
 52  0
         super.declParams = new String[] {
 53  
             "String selectedGroupId",
 54  
             "String selectedArtifactId",
 55  
             "String selectedVersion"
 56  
         };
 57  
         
 58  0
         filter = "dependencies.contains( dep ) && " +
 59  
                  "dep.groupId == selectedGroupId && " +
 60  
                  "dep.artifactId == selectedArtifactId && " +
 61  
                  "dep.version == selectedVersion";
 62  
    
 63  0
         super.params = new Object[] { groupId, artifactId, version };
 64  0
     }
 65  
 
 66  
     public String getSortColumn()
 67  
     {
 68  0
         return "groupId";
 69  
     }
 70  
 
 71  
     public String getWhereCondition()
 72  
     {
 73  0
         return null;
 74  
     }
 75  
     
 76  
     public String getFilter()
 77  
     {
 78  0
         return filter;
 79  
     }
 80  
 }