class PomEditorDefault implements PomEditor {

    public boolean addDependency(DynamicPomDependency dep,
                                 Path pomPath) {
        if (dep == null || !isGroupIDValid(dep) || !isArtifactIDValid(dep)) {
            return false;
        }

        try {
            Dependency pomDep = getMavenDependency(dep);
            org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI());
            Model model = getPOMModel(filePath);
            Map<String, String> keys = getKeysFromDeps(model.getDependencies());
            String keyDep = getKeyFromDep(dep);
            if (!keys.containsKey(keyDep)) {
                model.getDependencies().add(pomDep);
            } else {
                //override dep version with the version contained in the json
                String versionKey = keys.get(keyDep);
                List<Dependency> modelDeps = model.getDependencies();
                for (Dependency modelDep : modelDeps) {
                    if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID())) {
                        modelDep.setVersion(versionKey);
                    }
                }
                return false;
            }
            writePOMModelOnFS(filePath,
                              model);
        } catch (Exception ex) {
            logger.error(ex.getMessage(),
                         ex);
            return false;
        }
        return true;
    }

    public  PomEditorDefault();

}