-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from jsight/WINDUP-214
WINDUP-214: Add Story Points to Windup 2 application report
- Loading branch information
Showing
19 changed files
with
453 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.jboss.windup.reporting.service; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.windup.graph.GraphContext; | ||
import org.jboss.windup.graph.model.ProjectModel; | ||
import org.jboss.windup.graph.model.WindupVertexFrame; | ||
import org.jboss.windup.graph.service.GraphService; | ||
import org.jboss.windup.reporting.model.ClassificationModel; | ||
|
||
import com.thinkaurelius.titan.core.attribute.Text; | ||
import com.tinkerpop.blueprints.Vertex; | ||
import com.tinkerpop.gremlin.java.GremlinPipeline; | ||
|
||
public class ClassificationService extends GraphService<ClassificationModel> | ||
{ | ||
@Inject | ||
public ClassificationService(GraphContext context) | ||
{ | ||
super(context, ClassificationModel.class); | ||
} | ||
|
||
/** | ||
* Returns the total effort points in all of the {@link ClassificationModel}s associated with the files in this | ||
* project. | ||
* | ||
* If set to recursive, then also include the effort points from child projects. | ||
* | ||
*/ | ||
public int getMigrationEffortPoints(ProjectModel projectModel, boolean recursive) | ||
{ | ||
// 1. Get all classification models | ||
GremlinPipeline<Vertex, Vertex> classificationPipeline = new GremlinPipeline<>(projectModel.asVertex()); | ||
classificationPipeline.out(ProjectModel.PROJECT_MODEL_TO_FILE).in(ClassificationModel.FILE_MODEL); | ||
classificationPipeline.has(WindupVertexFrame.TYPE_PROP, Text.CONTAINS, ClassificationModel.TYPE); | ||
|
||
int classificationEffort = 0; | ||
for (Vertex v : classificationPipeline) | ||
{ | ||
classificationEffort += (Integer) v.getProperty(ClassificationModel.PROPERTY_EFFORT); | ||
} | ||
if (recursive) | ||
{ | ||
for (ProjectModel childProject : projectModel.getChildProjects()) | ||
{ | ||
classificationEffort += getMigrationEffortPoints(childProject, recursive); | ||
} | ||
} | ||
return classificationEffort; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.