Skip to content

Commit cca7db2

Browse files
authored
Check Aspect Model if migration is successful (#10)
* Check Aspect Model if migration is successful If shared Aspect Models are defined, they may no longer be available. In this case the editor should receive this information and consider the aspect model as not integrated. * Fix unit test
1 parent fd613dc commit cca7db2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/io/openmanufacturing/ame/services/ModelService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,17 @@ private Namespace resolveNamespace( final List<Namespace> namespaces, final Aspe
132132
private void namespaceFileInfo( final Namespace namespace, final Try<VersionedModel> model,
133133
final AspectModelUrn aspectModelUrn, final String storagePath ) {
134134

135+
boolean modelIsSuccess = false;
136+
135137
if ( model.isSuccess() ) {
136138
saveVersionedModel( model.get(), aspectModelUrn, storagePath );
139+
modelIsSuccess = !getModel(
140+
namespace.versionedNamespace + ':' + aspectModelUrn.getName() + ModelUtils.TTL_EXTENSION,
141+
Optional.of( storagePath ) ).contains( "undefined:" );
137142
}
138143

139144
final AspectModelFile aspectModelFile = new AspectModelFile( aspectModelUrn.getName() + ModelUtils.TTL_EXTENSION,
140-
model.isSuccess() );
145+
modelIsSuccess );
141146

142147
namespace.addAspectModelFile( aspectModelFile );
143148
}

0 commit comments

Comments
 (0)