protected void update(final Set<String> annotatedClassNames) throws SBusinessDataRepositoryDeploymentException { final List<Exception> exceptions = schemaManager.update(annotatedClassNames); if (!exceptions.isEmpty()) { throw new SBusinessDataRepositoryDeploymentException("Updating schema fails due to: " + exceptions); } }
protected void update(final Set<String> annotatedClassNames) throws SBusinessDataRepositoryDeploymentException { final List<Exception> exceptions = schemaManager.update(annotatedClassNames); if (!exceptions.isEmpty()) { throw new SBusinessDataRepositoryDeploymentException("Updating schema fails due to: " + exceptions); } }
void createAndDeployClientBDMZip(final BusinessObjectModel model, long userId) throws SBusinessDataRepositoryDeploymentException { STenantResourceLight accessControl; try { accessControl = tenantResourcesService.getSingleLightResource(TenantResourceType.BDM_ACCESS_CTRL); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryDeploymentException(e); } if (accessControl != null) { throw new SBusinessDataRepositoryDeploymentException( "A BDM Access Control file is installed. Uninstall it before deploying the BDM"); } try { tenantResourcesService.add(CLIENT_BDM_ZIP, TenantResourceType.BDM, generateClientBDMZip(model), userId); } catch (IOException | SRecorderException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }
void createAndDeployClientBDMZip(final BusinessObjectModel model, long userId) throws SBusinessDataRepositoryDeploymentException { STenantResourceLight accessControl; try { accessControl = tenantResourcesService.getSingleLightResource(TenantResourceType.BDM_ACCESS_CTRL); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryDeploymentException(e); } if (accessControl != null) { throw new SBusinessDataRepositoryDeploymentException( "A BDM Access Control file is installed. Uninstall it before deploying the BDM"); } try { tenantResourcesService.add(CLIENT_BDM_ZIP, TenantResourceType.BDM, generateClientBDMZip(model), userId); } catch (IOException | SRecorderException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }
protected BusinessObjectModel getBusinessObjectModel(final byte[] bdmZip) throws SBusinessDataRepositoryDeploymentException { final BusinessObjectModelConverter converter = new BusinessObjectModelConverter(); try { return converter.unzip(bdmZip); } catch (final Exception e) { throw new SBusinessDataRepositoryDeploymentException("Unable to get business object model", e); } }
protected BusinessObjectModel getBusinessObjectModel(final byte[] bdmZip) throws SBusinessDataRepositoryDeploymentException { final BusinessObjectModelConverter converter = new BusinessObjectModelConverter(); try { return converter.unzip(bdmZip); } catch (final Exception e) { throw new SBusinessDataRepositoryDeploymentException("Unable to get business object model", e); } }
protected byte[] generateServerBDMJar(final BusinessObjectModel model) throws SBusinessDataRepositoryDeploymentException { final JDTCompiler compiler = new JDTCompiler(); final AbstractBDMJarBuilder builder = new ServerBDMJarBuilder(compiler); final IOFileFilter classFileAndXmlFilefilter = new SuffixFileFilter(Arrays.asList(".class", ".xml")); try { return builder.build(model, classFileAndXmlFilefilter); } catch (BDMJarGenerationException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }
protected byte[] generateServerBDMJar(final BusinessObjectModel model) throws SBusinessDataRepositoryDeploymentException { final JDTCompiler compiler = new JDTCompiler(); final AbstractBDMJarBuilder builder = new ServerBDMJarBuilder(compiler); final IOFileFilter classFileAndXmlFilefilter = new SuffixFileFilter(Arrays.asList(".class", ".xml")); try { return builder.build(model, classFileAndXmlFilefilter); } catch (BDMJarGenerationException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }
@Override public void dropAndUninstall(final long tenantId) throws SBusinessDataRepositoryException { final URL resource = Thread.currentThread().getContextClassLoader().getResource("bom.xml"); if (resource != null) { try { final byte[] content = IOUtil.getAllContentFrom(resource); final URL xsd = BusinessObjectModel.class.getResource("/bom.xsd"); final BusinessObjectModel model = IOUtils.unmarshallXMLtoObject(content, BusinessObjectModel.class, xsd); final List<Exception> exceptions = schemaManager.drop(model.getBusinessObjectsClassNames()); if (!exceptions.isEmpty()) { throw new SBusinessDataRepositoryDeploymentException("Updating schema fails due to: " + exceptions); } uninstall(tenantId); } catch (final IOException | JAXBException | SAXException ioe) { throw new SBusinessDataRepositoryException(ioe); } } }
@Override public void dropAndUninstall(final long tenantId) throws SBusinessDataRepositoryException { final URL resource = Thread.currentThread().getContextClassLoader().getResource("bom.xml"); if (resource != null) { try { final byte[] content = IOUtil.getAllContentFrom(resource); final URL xsd = BusinessObjectModel.class.getResource("/bom.xsd"); final BusinessObjectModel model = IOUtils.unmarshallXMLtoObject(content, BusinessObjectModel.class, xsd); final List<Exception> exceptions = schemaManager.drop(model.getBusinessObjectsClassNames()); if (!exceptions.isEmpty()) { throw new SBusinessDataRepositoryDeploymentException("Updating schema fails due to: " + exceptions); } uninstall(tenantId); } catch (final IOException | JAXBException | SAXException ioe) { throw new SBusinessDataRepositoryException(ioe); } } }
resources.put(DAO_JAR_NAME, daoJarContent); } catch (BDMJarGenerationException e1) { throw new SBusinessDataRepositoryDeploymentException(e1); resources.put(BOM_NAME, new BusinessObjectModelConverter().zip(model)); } catch (final JAXBException | SAXException e) { throw new SBusinessDataRepositoryDeploymentException(e);
resources.put(DAO_JAR_NAME, daoJarContent); } catch (BDMJarGenerationException e1) { throw new SBusinessDataRepositoryDeploymentException(e1); resources.put(BOM_NAME, new BusinessObjectModelConverter().zip(model)); } catch (final JAXBException | SAXException e) { throw new SBusinessDataRepositoryDeploymentException(e);
protected long createAndDeployServerBDMJar(final long tenantId, final BusinessObjectModel model) throws SBusinessDataRepositoryDeploymentException { final byte[] serverBdmJar = generateServerBDMJar(model); try { final SDependency mappedDependency = dependencyService.createMappedDependency(BDR_DEPENDENCY_NAME, serverBdmJar, BDR_DEPENDENCY_FILENAME, tenantId, ScopeType.TENANT); //refresh classloader now, it is used to update the schema dependencyService.refreshClassLoader(ScopeType.TENANT, tenantId); update(model.getBusinessObjectsClassNames()); return mappedDependency.getId(); } catch (final SDependencyException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }
protected long createAndDeployServerBDMJar(final long tenantId, final BusinessObjectModel model) throws SBusinessDataRepositoryDeploymentException { final byte[] serverBdmJar = generateServerBDMJar(model); try { final SDependency mappedDependency = dependencyService.createMappedDependency(BDR_DEPENDENCY_NAME, serverBdmJar, BDR_DEPENDENCY_FILENAME, tenantId, ScopeType.TENANT); //refresh classloader now, it is used to update the schema dependencyService.refreshClassLoader(ScopeType.TENANT, tenantId); update(model.getBusinessObjectsClassNames()); return mappedDependency.getId(); } catch (final SDependencyException e) { throw new SBusinessDataRepositoryDeploymentException(e); } }