Example #1
0
  private ArtifactImpl loadArtifact(ArtifactState state) {
    ArtifactType type = ArtifactType.findById(state.getArtifactType());
    if (type == null) {
      return createInvalidArtifact(state, "Unknown artifact type: " + state.getArtifactType());
    }

    final Element element = state.getRootElement();
    final String artifactName = state.getName();
    final CompositePackagingElement<?> rootElement;
    if (element != null) {
      try {
        rootElement = (CompositePackagingElement<?>) deserializeElement(element);
      } catch (UnknownPackagingElementTypeException e) {
        return createInvalidArtifact(state, "Unknown element: " + e.getTypeId());
      }
    } else {
      rootElement = type.createRootElement(artifactName);
    }

    final ArtifactImpl artifact =
        new ArtifactImpl(
            artifactName, type, state.isBuildOnMake(), rootElement, state.getOutputPath());
    final List<ArtifactPropertiesState> propertiesList = state.getPropertiesList();
    for (ArtifactPropertiesState propertiesState : propertiesList) {
      final ArtifactPropertiesProvider provider =
          ArtifactPropertiesProvider.findById(propertiesState.getId());
      if (provider != null) {
        deserializeProperties(artifact.getProperties(provider), propertiesState);
      } else {
        return createInvalidArtifact(
            state, "Unknown artifact properties: " + propertiesState.getId());
      }
    }
    return artifact;
  }
Example #2
0
 private boolean equals(ArtifactPlan other) {
   if (dest != null ? !dest.equals(other.dest) : other.dest != null) {
     return false;
   }
   return !(src != null ? !src.equals(other.src) : other.src != null)
       && artifactType.equals(other.artifactType);
 }
Example #3
0
 public int hashCode() {
   int result = 0;
   result = 31 * result + (src != null ? src.hashCode() : 0);
   result = 31 * result + (dest != null ? dest.hashCode() : 0);
   result = 31 * result + (artifactType != null ? artifactType.hashCode() : 0);
   return result;
 }