use of org.kie.workbench.common.screens.datamodeller.model.TypeInfoResult in project kie-wb-common by kiegroup.
the class DataModelerServiceImpl method loadJavaTypeInfo.
public TypeInfoResult loadJavaTypeInfo(final String source) {
try {
JavaRoasterModelDriver modelDriver = new JavaRoasterModelDriver();
TypeInfoResult result = new TypeInfoResult();
org.kie.workbench.common.services.datamodeller.driver.TypeInfoResult driverResult = modelDriver.loadJavaTypeInfo(source);
result.setJavaTypeInfo(driverResult.getTypeInfo());
if (driverResult.hasErrors()) {
result.setErrors(serviceHelper.toDataModelerError(driverResult.getErrors()));
}
return result;
} catch (Exception e) {
logger.error("JavaTypeInfo object couldn't be loaded for source: " + source, e);
throw new ServiceException("JavaTypeInfo object couldn't be loaded for source.", e);
}
}
use of org.kie.workbench.common.screens.datamodeller.model.TypeInfoResult in project kie-wb-common by kiegroup.
the class DataModelerScreenPresenter method checkDirtyAndSaveFile.
private void checkDirtyAndSaveFile() {
final JavaTypeInfoImpl newTypeInfo = new JavaTypeInfoImpl();
if (isDirty()) {
if (context.isEditorChanged()) {
newTypeInfo.setPackageName(context.getDataObject().getPackageName());
newTypeInfo.setName(context.getDataObject().getName());
saveFile(newTypeInfo);
} else {
view.showLoading();
modelerService.call(new RemoteCallback<TypeInfoResult>() {
@Override
public void callback(TypeInfoResult typeInfoResult) {
view.hideBusyIndicator();
if (!typeInfoResult.hasErrors() && typeInfoResult.getJavaTypeInfo() != null) {
newTypeInfo.setPackageName(typeInfoResult.getJavaTypeInfo().getPackageName());
newTypeInfo.setName(typeInfoResult.getJavaTypeInfo().getName());
saveFile(newTypeInfo);
} else {
saveFile(null);
}
}
}).loadJavaTypeInfo(getSource());
}
} else {
saveFile(null);
}
}
Aggregations