Skip to content

Commit

Permalink
Merge branch 'maintenance' into merge_from_maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Zarnekow authored and Sebastian Zarnekow committed Dec 8, 2015
2 parents f64c95a + 47492b6 commit 9df9f1e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Expand Up @@ -68,7 +68,11 @@ class GeneratorService extends AbstractCachedService<GeneratorService.GeneratedA
def getArtifact(XtextWebDocumentAccess document, String artifactId) {
val artifacts = getResult(document).artifacts
val searchString = artifactId ?: DEFAULT_ARTIFACT
val result = artifacts.findFirst[name == searchString]
var result = artifacts.findFirst[name == searchString]
if (result === null && !searchString.startsWith(IFileSystemAccess.DEFAULT_OUTPUT)) {
val defaultSearchString = IFileSystemAccess.DEFAULT_OUTPUT + searchString
result = artifacts.findFirst[name == defaultSearchString]
}
if (result === null)
throw new ResourceNotFoundException('The requested generator artifact was not found.')
return result
Expand Down
Expand Up @@ -163,7 +163,27 @@ public Boolean apply(final GeneratorResult it) {
return Boolean.valueOf(Objects.equal(_name, searchString));
}
};
final GeneratorResult result = IterableExtensions.<GeneratorResult>findFirst(artifacts, _function);
GeneratorResult result = IterableExtensions.<GeneratorResult>findFirst(artifacts, _function);
boolean _and = false;
if (!(result == null)) {
_and = false;
} else {
boolean _startsWith = searchString.startsWith(IFileSystemAccess.DEFAULT_OUTPUT);
boolean _not = (!_startsWith);
_and = _not;
}
if (_and) {
final String defaultSearchString = (IFileSystemAccess.DEFAULT_OUTPUT + searchString);
final Function1<GeneratorResult, Boolean> _function_1 = new Function1<GeneratorResult, Boolean>() {
@Override
public Boolean apply(final GeneratorResult it) {
String _name = it.getName();
return Boolean.valueOf(Objects.equal(_name, defaultSearchString));
}
};
GeneratorResult _findFirst = IterableExtensions.<GeneratorResult>findFirst(artifacts, _function_1);
result = _findFirst;
}
if ((result == null)) {
throw new InvalidRequestException.ResourceNotFoundException("The requested generator artifact was not found.");
}
Expand Down

0 comments on commit 9df9f1e

Please sign in to comment.