use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistableDataObject in project kie-wb-common by kiegroup.
the class DataModelerEventObserver method onDataObjectDeleted.
public void onDataObjectDeleted(@Observes DataObjectDeletedEvent event) {
Path descriptorPath;
PersistenceDescriptorModel persistenceDescriptor;
descriptorPath = descriptorService.calculatePersistenceDescriptorPath(event.getCurrentModule());
persistenceDescriptor = safeLoad(descriptorPath);
if (persistenceDescriptor != null && containsClass(persistenceDescriptor.getPersistenceUnit(), event.getCurrentDataObject().getClassName())) {
persistenceDescriptor.getPersistenceUnit().getClasses().remove(new PersistableDataObject(event.getCurrentDataObject().getClassName()));
descriptorService.save(descriptorPath, persistenceDescriptor, null, "Entity removed from persistence descriptor");
}
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistableDataObject in project kie-wb-common by kiegroup.
the class PersistenceDescriptor2DOMVisitor method visitPersistenceUnit.
private void visitPersistenceUnit(Element parent, PersistenceUnitModel persistenceUnit) {
Element persistenceUnitElement = document.createElement(PersistenceDescriptorXMLMarshaller.PERSISTENCE_UNIT);
parent.appendChild(persistenceUnitElement);
persistenceUnitElement.setAttribute(PersistenceDescriptorXMLMarshaller.NAME, persistenceUnit.getName());
if (persistenceUnit.getTransactionType() != null) {
persistenceUnitElement.setAttribute(PersistenceDescriptorXMLMarshaller.TRANSACTION_TYPE, persistenceUnit.getTransactionType().name());
}
visitDescription(persistenceUnitElement, persistenceUnit.getDescription());
visitProvider(persistenceUnitElement, persistenceUnit.getProvider());
visitJTADataSource(persistenceUnitElement, persistenceUnit.getJtaDataSource());
visitNonJTADataSource(persistenceUnitElement, persistenceUnit.getNonJtaDataSource());
if (persistenceUnit.getMappingFile() != null) {
for (String mappingFile : persistenceUnit.getMappingFile()) {
visitMappingFile(persistenceUnitElement, mappingFile);
}
}
if (persistenceUnit.getJarFile() != null) {
for (String jarFile : persistenceUnit.getJarFile()) {
visitJarFile(persistenceUnitElement, jarFile);
}
}
if (persistenceUnit.getClasses() != null) {
for (PersistableDataObject clazz : persistenceUnit.getClasses()) {
visitClass(persistenceUnitElement, clazz.getValue());
}
}
visitExcludeUnlistedClasses(persistenceUnitElement, persistenceUnit.getExcludeUnlistedClasses());
visitSharedChacheMode(persistenceUnitElement, persistenceUnit.getSharedCacheMode());
visitValidationMode(persistenceUnitElement, persistenceUnit.getValidationMode());
visitProperties(persistenceUnitElement, persistenceUnit.getProperties());
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistableDataObject in project kie-wb-common by kiegroup.
the class PersistableDataObjectsItemPresenterTest method testSetup.
@Test
public void testSetup() {
persistableDataObjectsItemPresenter.setup(new PersistableDataObject("ClassName"), mock(PersistencePresenter.class));
verify(view).init(eq(persistableDataObjectsItemPresenter));
verify(view).setClassName(eq("ClassName"));
}
Aggregations