Package fr.openwide.maven.artifact.notifier.core.business.artifact.model

Examples of fr.openwide.maven.artifact.notifier.core.business.artifact.model.ArtifactVersion


 
  private int addNewVersions(Artifact artifact, List<ArtifactVersionBean> versions) throws ServiceException, SecurityServiceException {
    int newVersionsCount = 0;
   
    for (ArtifactVersionBean versionBean : versions) {
      ArtifactVersion artifactVersion = artifactVersionService.getByArtifactAndVersion(artifact, versionBean.getVersion());
     
      if (artifactVersion == null) {
        artifactVersion = new ArtifactVersion(versionBean.getVersion(), new Date(versionBean.getTimestamp()));
        // it is necessary to create the version before adding it to the artifact because, otherwise, we have a cascading problem with latestVersion
        artifactVersionService.create(artifactVersion);
       
        artifact.addVersion(artifactVersion);
        artifactService.update(artifact);
View Full Code Here


    newVersionsTable.add(new ListView<ArtifactVersionNotification>("newVersions", getModel()) {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected void populateItem(ListItem<ArtifactVersionNotification> item) {
        ArtifactVersion version = item.getModelObject().getArtifactVersion();
        IModel<ArtifactVersionNotification> versionNotificationModel = item.getModel();
       
        Label groupId = new CustomLabel("groupId", BindingModel.of(versionNotificationModel,
            Binding.artifactVersionNotification().artifactVersion().artifact().group().groupId()), STYLE_TABLE_TD);
        if (item.getIndex() == NewVersionsHtmlNotificationPanel.this.getModelObject().size() - 1) {
          groupId.add(new StyleAttributeAppender(STYLE_TABLE_BOTTOM_LEFT_RADIUS));
        }
        item.add(groupId);
       
        WebMarkupContainer artifactIdContainer = new CustomWebMarkupContainer("artifactIdContainer", STYLE_TABLE_TD);
        item.add(artifactIdContainer);
        ExternalLink artifactIdLink = new ExternalLink("artifactIdLink",
            notificationUrlBuilderService.getArtifactDescriptionUrl(version.getArtifact()));
        artifactIdLink.add(new StyleAttributeAppender(STYLE_LINK));
        artifactIdLink.add(new Label("artifactIdLabel", BindingModel.of(versionNotificationModel,
            Binding.artifactVersionNotification().artifactVersion().artifact().artifactId())));
        artifactIdContainer.add(artifactIdLink);
       
View Full Code Here

  public ArtifactBean(FollowedArtifact followedArtifact) {
    if (followedArtifact != null) {
      setArtifactId(followedArtifact.getArtifact().getArtifactId());
      setGroupId(followedArtifact.getArtifact().getGroup().getGroupId());
      ArtifactVersion artifactLatestVersion = followedArtifact.getArtifact().getLatestVersion();
      if (artifactLatestVersion != null) {
        setLatestVersion(artifactLatestVersion.getVersion());
      }
    }
  }
View Full Code Here

public class TestMavenCentralComparableVersion {

  @Test
  public void testMavenCentralComparableVersion() {
    ArtifactVersion classic1 = new ArtifactVersion("1.2", new Date(1131452383000L));
    ArtifactVersion classic2 = new ArtifactVersion("3.0-rc3", new Date(1299460443000L));
    ArtifactVersion date1 = new ArtifactVersion("20041127.091804", new Date(1132834783000L));
    ArtifactVersion date2 = new ArtifactVersion("20060216.105226", new Date(1176203983000L));
   
    Assert.assertEquals(1, MavenCentralVersionComparator.get().compare(classic2, classic1));
    Assert.assertEquals(1, MavenCentralVersionComparator.get().compare(classic2, date1));
    Assert.assertEquals(1, MavenCentralVersionComparator.get().compare(classic1, date1));
    Assert.assertEquals(0, MavenCentralVersionComparator.get().compare(date1, date1));
View Full Code Here

    add(new ExternalLink("mavenCentralLink", new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;

      @Override
      protected String load() {
        ArtifactVersion artifactVersion = getModelObject();
        return artifactVersion != null ? mavenCentralSearchUrlService.getVersionUrl(artifactVersion) : null;
      }
    }));
  }
View Full Code Here

      this.artifactVersionAdditionalInformationModel = artifactVersionAdditionalInformationModel;
    }
   
    @Override
    protected boolean shouldGetFirstModel() {
      ArtifactVersion artifactVersion = ArtifactVersionLinksPanel.this.getModelObject();
      return artifactVersion != null ? !artifactService.hasProject(artifactVersion.getArtifact()) ||
          artifactVersionAdditionalInformationModel.getObject() != null : true;
    }
View Full Code Here

    AjaxButton validate = new AjaxButton("save", form) {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        ArtifactVersion artifactVersion = ArtifactVersionFormPopupPanel.this.getModelObject();
       
        try {
          artifactVersionService.update(artifactVersion);
          getSession().success(getString("artifact.version.edit.success"));
          closePopup(target);
View Full Code Here

  @Override
  public void linkWithArtifactVersions(ProjectVersion projectVersion) throws ServiceException, SecurityServiceException {
    boolean onMavenCentral = false;
    Date lastUpdateDate = null;
    for (Artifact artifact : projectVersion.getProject().getArtifacts()) {
      ArtifactVersion artifactVersion = artifactVersionService.getByArtifactAndVersion(artifact, projectVersion.getVersion());
     
      if (artifactVersion != null) {
        artifactVersion.setProjectVersion(projectVersion);
        artifactVersionService.update(artifactVersion);
       
        lastUpdateDate = artifactVersion.getLastUpdateDate();
        onMavenCentral = true;
      }
    }
    if (onMavenCentral) {
      projectVersion.setLastUpdateDate(lastUpdateDate);
View Full Code Here

     
      userService.followArtifact(user, artifact);
      user.getFollowedArtifacts().get(0).setLastNotifiedVersionDate(previousDate.getTime());
      artifact.setStatus(ArtifactStatus.INITIALIZED);
     
      ArtifactVersion artifactVersion = new ArtifactVersion("2.0-test", new Date());
      artifactVersionService.create(artifactVersion);
      artifact.addVersion(artifactVersion);
    }
    mavenSynchronizationService.synchronizeAllArtifactsAndNotifyUsers();
View Full Code Here

    assertEquals(ArtifactStatus.NOT_INITIALIZED, artifact.getStatus());
   
    mavenSynchronizationService.synchronizeAllArtifactsAndNotifyUsers();
    assertEquals(ArtifactStatus.INITIALIZED, artifact.getStatus());
    assertTrue(artifact.getVersions().size() > 0);
    ArtifactVersion firstVersion = (ArtifactVersion) artifact.getVersions().toArray()[artifact.getVersions().size() - 1];
    assertEquals("1.0", firstVersion.getVersion());
  }
View Full Code Here

TOP

Related Classes of fr.openwide.maven.artifact.notifier.core.business.artifact.model.ArtifactVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.