private BusinessObject getBusinessObjectFromClassName(String className) throws SBusinessDataRepositoryException { BusinessObject businessObject = null; final BusinessObjectModel businessObjectModel = businessDataModelRepository.getBusinessObjectModel(); if (businessObjectModel != null) { for (final BusinessObject currentBo : businessObjectModel.getBusinessObjects()) { if (currentBo.getQualifiedName().equals(className)) { businessObject = currentBo; } } } return businessObject; }
private synchronized void recreateEntityManagerFactory(ClassLoader newClassLoader) { if (businessDataModelRepository.isBDMDeployed()) { log.debug("Recreating entity factory for classloader {} on tenant {}", newClassLoader, tenantId); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(newClassLoader); entityManagerFactory.close(); entityManagerFactory = createEntityManagerFactory(); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } log.debug("Entity factory recreated"); } }
@Override @AvailableWhenTenantIsPaused(only = true) public void uninstallBusinessDataModel() throws BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); bdmRepository.uninstall(tenantAccessor.getTenantId()); } catch (final SBusinessDataRepositoryException sbdre) { throw new BusinessDataRepositoryDeploymentException(sbdre); } }
@Override @AvailableWhenTenantIsPaused public byte[] getClientBDMZip() throws BusinessDataRepositoryException { final BusinessDataModelRepository bdmRepository = getTenantAccessor().getBusinessDataModelRepository(); try { return bdmRepository.getClientBDMZip(); } catch (final SBusinessDataRepositoryException e) { throw new BusinessDataRepositoryException(e); } }
@Override @AvailableWhenTenantIsPaused(only = true) public void cleanAndUninstallBusinessDataModel() throws BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); bdmRepository.dropAndUninstall(tenantAccessor.getTenantId()); } catch (final SBusinessDataRepositoryException sbdre) { throw new BusinessDataRepositoryDeploymentException(sbdre); } }
@Override @AvailableWhenTenantIsPaused public String getBusinessDataModelVersion() throws BusinessDataRepositoryException { try { final BusinessDataModelRepository modelRepository = getTenantAccessor().getBusinessDataModelRepository(); return modelRepository.getInstalledBDMVersion(); } catch (final SBusinessDataRepositoryException e) { throw new BusinessDataRepositoryException(e); } }
@Override @AvailableWhenTenantIsPaused(only = true) public String installBusinessDataModel(final byte[] zip) throws InvalidBusinessDataModelException, BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final long userId; try { userId = getUserId(); } catch (IllegalStateException e) { throw new BusinessDataRepositoryDeploymentException("Unable to determine user ID"); } try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); return bdmRepository.install(zip, tenantAccessor.getTenantId(), userId); } catch (final IllegalStateException e) { throw new InvalidBusinessDataModelException(e); } catch (final SBusinessDataRepositoryDeploymentException e) { throw new BusinessDataRepositoryDeploymentException(e); } }
@Override @AvailableWhenTenantIsPaused(only = true) public void uninstallBusinessDataModel() throws BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); bdmRepository.uninstall(tenantAccessor.getTenantId()); } catch (final SBusinessDataRepositoryException sbdre) { throw new BusinessDataRepositoryDeploymentException(sbdre); } }
@Override @AvailableWhenTenantIsPaused public byte[] getClientBDMZip() throws BusinessDataRepositoryException { final BusinessDataModelRepository bdmRepository = getTenantAccessor().getBusinessDataModelRepository(); try { return bdmRepository.getClientBDMZip(); } catch (final SBusinessDataRepositoryException e) { throw new BusinessDataRepositoryException(e); } }
@Override @AvailableWhenTenantIsPaused(only = true) public void cleanAndUninstallBusinessDataModel() throws BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); bdmRepository.dropAndUninstall(tenantAccessor.getTenantId()); } catch (final SBusinessDataRepositoryException sbdre) { throw new BusinessDataRepositoryDeploymentException(sbdre); } }
@Override @AvailableWhenTenantIsPaused public String getBusinessDataModelVersion() throws BusinessDataRepositoryException { try { final BusinessDataModelRepository modelRepository = getTenantAccessor().getBusinessDataModelRepository(); return modelRepository.getInstalledBDMVersion(); } catch (final SBusinessDataRepositoryException e) { throw new BusinessDataRepositoryException(e); } }
@Override @AvailableWhenTenantIsPaused(only = true) public String installBusinessDataModel(final byte[] zip) throws InvalidBusinessDataModelException, BusinessDataRepositoryDeploymentException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final long userId; try { userId = getUserId(); } catch (IllegalStateException e) { throw new BusinessDataRepositoryDeploymentException("Unable to determine user ID"); } try { final BusinessDataModelRepository bdmRepository = tenantAccessor.getBusinessDataModelRepository(); return bdmRepository.install(zip, tenantAccessor.getTenantId(), userId); } catch (final IllegalStateException e) { throw new InvalidBusinessDataModelException(e); } catch (final SBusinessDataRepositoryDeploymentException e) { throw new BusinessDataRepositoryDeploymentException(e); } }
private synchronized void recreateEntityManagerFactory(ClassLoader newClassLoader) { if (businessDataModelRepository.isBDMDeployed()) { log.debug("Recreating entity factory for classloader {} on tenant {}", newClassLoader, tenantId); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(newClassLoader); entityManagerFactory.close(); entityManagerFactory = createEntityManagerFactory(); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } log.debug("Entity factory recreated"); } }
private BusinessObject getBusinessObjectFromClassName(String className) throws SBusinessDataRepositoryException { BusinessObject businessObject = null; final BusinessObjectModel businessObjectModel = businessDataModelRepository.getBusinessObjectModel(); if (businessObjectModel != null) { for (final BusinessObject currentBo : businessObjectModel.getBusinessObjects()) { if (currentBo.getQualifiedName().equals(className)) { businessObject = currentBo; } } } return businessObject; }
@Override public void start() { if (businessDataModelRepository.isBDMDeployed()) { log.debug("Creating entity factory on tenant {}", tenantId); entityManagerFactory = createEntityManagerFactory(); log.debug("Entity factory created"); } classLoaderService.addListener(ScopeType.TENANT.name(), tenantId, this); }
@Override public void start() { if (businessDataModelRepository.isBDMDeployed()) { log.debug("Creating entity factory on tenant {}", tenantId); entityManagerFactory = createEntityManagerFactory(); log.debug("Entity factory created"); } classLoaderService.addListener(ScopeType.TENANT.name(), tenantId, this); }