private void writeSite(Site site, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (site.getId() != null) { writeValue(serializer, "id", site.getId(), site); } if (site.getName() != null) { writeValue(serializer, "name", site.getName(), site); } if (site.getUrl() != null) { writeValue(serializer, "url", site.getUrl(), site); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(site, "", start, b.length()); }
@Override protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getUrl(); if ( src != null ) { if ( sourceDominant ) { target.setUrl( src ); target.setLocation( "url", source.getLocation( "url" ) ); } else if ( target.getUrl() == null ) { target.setUrl( appendPath( src, context ) ); target.setLocation( "url", source.getLocation( "url" ) ); } } }
private void writeDistributionManagement(DistributionManagement distributionManagement, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (distributionManagement.getRepository() != null) { writeDeploymentRepository((DeploymentRepository) distributionManagement.getRepository(), "repository", serializer); } if (distributionManagement.getSnapshotRepository() != null) { writeDeploymentRepository((DeploymentRepository) distributionManagement.getSnapshotRepository(), "snapshotRepository", serializer); } if (distributionManagement.getSite() != null) { writeSite((Site) distributionManagement.getSite(), "site", serializer); } if (distributionManagement.getDownloadUrl() != null) { writeValue(serializer, "downloadUrl", distributionManagement.getDownloadUrl(), distributionManagement); } if (distributionManagement.getRelocation() != null) { writeRelocation((Relocation) distributionManagement.getRelocation(), "relocation", serializer); } if (distributionManagement.getStatus() != null) { writeValue(serializer, "status", distributionManagement.getStatus(), distributionManagement); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(distributionManagement, "", start, b.length()); }
/** * Method updateSite * * @param value * @param element * @param counter * @param xmlTag */ protected void updateSite( Site value, String xmlTag, Counter counter, Element element ) { boolean shouldExist = value != null; Element root = updateElement( counter, element, xmlTag, shouldExist ); if ( shouldExist ) { Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); } }
private void visitDistributionManagement( ModelVisitor visitor, DistributionManagement distributionManagement ) { DeploymentRepository repository = distributionManagement.getRepository(); if ( repository != null ) { visitor.visitDistributionManagementRepository( repository ); visitDistributionManagementRepository( visitor, repository ); repository = visitor.replaceDistributionManagementRepository( repository ); distributionManagement.setRepository( repository ); } DeploymentRepository snapshotRepository = distributionManagement.getSnapshotRepository(); if ( snapshotRepository != null ) { visitor.visitDistributionManagementSnapshotRepository( snapshotRepository ); visitDistributionManagementSnapshotRepository( visitor, snapshotRepository ); snapshotRepository = visitor.replaceDistributionManagementSnapshotRepository( snapshotRepository ); distributionManagement.setSnapshotRepository( snapshotRepository ); } Site site = distributionManagement.getSite(); if ( site != null ) { visitor.visitDistributionManagementSite( site ); site = visitor.replaceDistributionManagementSite( site ); distributionManagement.setSite( site ); } Relocation relocation = distributionManagement.getRelocation(); if ( relocation != null ) { visitor.visitDistributionManagementRelocation( relocation ); relocation = visitor.replaceDistributionManagementRelocation( relocation ); distributionManagement.setRelocation( relocation ); } }
private void visitProfileDistributionManagement( ModelVisitor visitor, DistributionManagement distributionManagement ) { DeploymentRepository repository = distributionManagement.getRepository(); if ( repository != null ) { visitor.visitProfileDistributionManagementRepository( repository ); visitProfileDistributionManagementRepository( visitor, repository ); repository = visitor.replaceProfileDistributionManagementRepository( repository ); distributionManagement.setRepository( repository ); } DeploymentRepository snapshotRepository = distributionManagement.getSnapshotRepository(); if ( snapshotRepository != null ) { visitor.visitProfileDistributionManagementSnapshotRepository( snapshotRepository ); visitProfileDistributionManagementSnapshotRepository( visitor, snapshotRepository ); snapshotRepository = visitor.replaceProfileDistributionManagementSnapshotRepository( snapshotRepository ); distributionManagement.setSnapshotRepository( snapshotRepository ); } Site site = distributionManagement.getSite(); if ( site != null ) { visitor.visitProfileDistributionManagementSite( site ); site = visitor.replaceProfileDistributionManagementSite( site ); distributionManagement.setSite( site ); } Relocation relocation = distributionManagement.getRelocation(); if ( relocation != null ) { visitor.visitProfileDistributionManagementRelocation( relocation ); relocation = visitor.replaceProfileDistributionManagementRelocation( relocation ); distributionManagement.setRelocation( relocation ); } }
protected void mergeSite_Id( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getId(); if ( src != null ) { if ( sourceDominant || target.getId() == null ) { target.setId( src ); target.setLocation( "id", source.getLocation( "id" ) ); } } }
protected void mergeSite_Name( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getName(); if ( src != null ) { if ( sourceDominant || target.getName() == null ) { target.setName( src ); target.setLocation( "name", source.getLocation( "name" ) ); } } }
protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getUrl(); if ( src != null ) { if ( sourceDominant || target.getUrl() == null ) { target.setUrl( src ); target.setLocation( "url", source.getLocation( "url" ) ); } } }
public void normalize( Model model, ModelBuildingRequest request ) { if ( model == null ) { return; } model.setUrl( normalize( model.getUrl() ) ); Scm scm = model.getScm(); if ( scm != null ) { scm.setUrl( normalize( scm.getUrl() ) ); scm.setConnection( normalize( scm.getConnection() ) ); scm.setDeveloperConnection( normalize( scm.getDeveloperConnection() ) ); } DistributionManagement dist = model.getDistributionManagement(); if ( dist != null ) { Site site = dist.getSite(); if ( site != null ) { site.setUrl( normalize( site.getUrl() ) ); } } }
@Override public Site replaceDistributionManagementSite( Site site ) { return site; }
@Override public Site replaceProfileDistributionManagementSite( Site site ) { return site; }
@Override public void visitDistributionManagementSite( Site site ) { }
@Override public void visitProfileDistributionManagementSite( Site site ) { }
protected void mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { mergeSite_Id( target, source, sourceDominant, context ); mergeSite_Name( target, source, sourceDominant, context ); mergeSite_Url( target, source, sourceDominant, context ); }
Site replaceDistributionManagementSite( Site site );
Site replaceProfileDistributionManagementSite( Site site );
void visitDistributionManagementSite( Site site );
void visitProfileDistributionManagementSite( Site site );