public static ArchivaProjectModel clone( ArchivaProjectModel model ) { if ( model == null ) { return null; } ArchivaProjectModel cloned = new ArchivaProjectModel(); cloned.setGroupId( model.getGroupId() ); cloned.setArtifactId( model.getArtifactId() ); cloned.setVersion( model.getVersion() ); cloned.setParentProject( clone( model.getParentProject() ) ); cloned.setName( model.getName() ); cloned.setDescription( model.getDescription() ); cloned.setUrl( model.getUrl() ); cloned.setPackaging( model.getPackaging() ); cloned.setOrigin( model.getOrigin() ); cloned.setMailingLists( cloneMailingLists( model.getMailingLists() ) ); cloned.setCiManagement( clone( model.getCiManagement() ) ); cloned.setIndividuals( cloneIndividuals( model.getIndividuals() ) ); cloned.setIssueManagement( clone( model.getIssueManagement() ) ); cloned.setLicenses( cloneLicenses( model.getLicenses() ) ); cloned.setOrganization( clone( model.getOrganization() ) ); cloned.setScm( clone( model.getScm() ) ); cloned.setRepositories( cloneRepositories( model.getRepositories() ) ); cloned.setDependencies( cloneDependencies( model.getDependencies() ) ); cloned.setPlugins( clonePlugins( model.getPlugins() ) ); cloned.setReports( cloneReports( model.getReports() ) ); cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) ); return cloned; }
public static String toKey( ArchivaProjectModel model ) { return toKey( model.getGroupId(), model.getArtifactId(), model.getVersion() ); }
private void appendModel( StringBuffer buf, ArchivaProjectModel model ) { buf.append( "groupId:" ).append( model.getGroupId() ); buf.append( "|artifactId:" ).append( model.getArtifactId() ); buf.append( "|version:" ).append( model.getVersion() ); buf.append( "|packaging:" ).append( model.getPackaging() ); }
private ArchivaProjectModel createDefaultModel( ArtifactReference reference ) { ArchivaProjectModel model = new ArchivaProjectModel(); // Create default (dummy) model model = new ArchivaProjectModel(); model.setGroupId( reference.getGroupId() ); model.setArtifactId( reference.getArtifactId() ); model.setVersion( reference.getVersion() ); model.setPackaging( reference.getType() ); return model; } }
if ( !artifact.getArtifactId().equalsIgnoreCase( model.getArtifactId() ) ) emsg.append( " has an invalid project model [" ); appendModel( emsg, model ); emsg.append( "]: The model artifactId [" ).append( model.getArtifactId() ); emsg.append( "] does not match the artifactId portion of the filename: " ).append( artifact.getArtifactId() ); if ( !artifact.getVersion().equalsIgnoreCase( model.getVersion() ) && !VersionUtil.getBaseVersion( artifact.getVersion() ).equalsIgnoreCase( model.getVersion() ) ) emsg.append( " has an invalid project model [" ); appendModel( emsg, model ); emsg.append( "]; The model version [" ).append( model.getVersion() ); emsg.append( "] does not match the version portion of the filename: " ).append( artifact.getVersion() );
model.setOrigin( "filesystem" ); model.setVersion( artifact.getVersion() );
if ( model.getRelocation() != null ) refTO.setType( fromNode.getArtifact().getType() ); VersionedReference relocation = model.getRelocation(); if ( CollectionUtils.isNotEmpty( model.getDependencyManagement() ) ) for ( Dependency dependency : model.getDependencyManagement() ) if ( CollectionUtils.isNotEmpty( model.getDependencies() ) ) for ( Dependency dependency : model.getDependencies() )
model.setVersion( artifact.getVersion() );
/** * Method addDependency * * @param dependency */ public void addDependency(Dependency dependency) { if ( !(dependency instanceof Dependency) ) { throw new ClassCastException( "ArchivaProjectModel.addDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() ); } getDependencies().add( dependency ); } //-- void addDependency(Dependency)
/** * Method addDependencyManagement * * @param dependency */ public void addDependencyManagement(Dependency dependency) { if ( !(dependency instanceof Dependency) ) { throw new ClassCastException( "ArchivaProjectModel.addDependencyManagement(dependency) parameter must be instanceof " + Dependency.class.getName() ); } getDependencyManagement().add( dependency ); } //-- void addDependencyManagement(Dependency)
private String toProjectKey( ArchivaProjectModel project ) { StringBuilder key = new StringBuilder(); key.append( project.getGroupId() ).append( ":" ); key.append( project.getArtifactId() ).append( ":" ); key.append( project.getVersion() ); return key.toString(); } }
private void appendModel( StringBuffer buf, ArchivaProjectModel model ) { buf.append( "groupId:" ).append( model.getGroupId() ); buf.append( "|artifactId:" ).append( model.getArtifactId() ); buf.append( "|version:" ).append( model.getVersion() ); buf.append( "|packaging:" ).append( model.getPackaging() ); }
if ( !artifact.getArtifactId().equalsIgnoreCase( model.getArtifactId() ) ) emsg.append( " has an invalid project model [" ); appendModel( emsg, model ); emsg.append( "]: The model artifactId [" ).append( model.getArtifactId() ); emsg.append( "] does not match the artifactId portion of the filename: " ).append( artifact.getArtifactId() ); if ( !artifact.getVersion().equalsIgnoreCase( model.getVersion() ) && !VersionUtil.getBaseVersion( artifact.getVersion() ).equalsIgnoreCase( model.getVersion() ) ) emsg.append( " has an invalid project model [" ); appendModel( emsg, model ); emsg.append( "]; The model version [" ).append( model.getVersion() ); emsg.append( "] does not match the version portion of the filename: " ).append( artifact.getVersion() );
/** * Method removeDependency * * @param dependency */ public void removeDependency(Dependency dependency) { if ( !(dependency instanceof Dependency) ) { throw new ClassCastException( "ArchivaProjectModel.removeDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() ); } getDependencies().remove( dependency ); } //-- void removeDependency(Dependency)
/** * Method removeDependencyManagement * * @param dependency */ public void removeDependencyManagement(Dependency dependency) { if ( !(dependency instanceof Dependency) ) { throw new ClassCastException( "ArchivaProjectModel.removeDependencyManagement(dependency) parameter must be instanceof " + Dependency.class.getName() ); } getDependencyManagement().remove( dependency ); } //-- void removeDependencyManagement(Dependency)
/** * Method equals * * @param other */ public boolean equals(Object other) { if ( this == other) { return true; } if ( !(other instanceof ArchivaProjectModel) ) { return false; } ArchivaProjectModel that = (ArchivaProjectModel) other; boolean result = true; result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) ); result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) ); result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) ); return result; } //-- boolean equals(Object)
private String toProjectKey( ArchivaProjectModel project ) { StringBuilder key = new StringBuilder(); key.append( project.getGroupId() ).append( ":" ); key.append( project.getArtifactId() ).append( ":" ); key.append( project.getVersion() ); return key.toString(); }
/** * Method toString */ public java.lang.String toString() { StringBuffer buf = new StringBuffer(); buf.append( "groupId = '" ); buf.append( getGroupId() + "'" ); buf.append( "\n" ); buf.append( "artifactId = '" ); buf.append( getArtifactId() + "'" ); buf.append( "\n" ); buf.append( "version = '" ); buf.append( getVersion() + "'" ); return buf.toString(); } //-- java.lang.String toString()
private void validateAppropriateModel( String location, ArchivaArtifact artifact, ArchivaProjectModel model ) throws ConsumerException { if ( model != null ) { if ( !StringUtils.equals( model.getGroupId(), artifact.getGroupId() ) ) { addProblem( artifact, "The groupId of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getGroupId() + ">, but was actually <" + model.getGroupId() + ">" ); } if ( !StringUtils.equals( model.getArtifactId(), artifact.getArtifactId() ) ) { addProblem( artifact, "The artifactId of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getArtifactId() + ">, but was actually <" + model.getArtifactId() + ">" ); } if ( !StringUtils.equals( model.getVersion(), artifact.getVersion() ) ) { addProblem( artifact, "The version of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getVersion() + ">, but was actually <" + model.getVersion() + ">" ); } } }