@SuppressWarnings("unchecked") protected Class<? extends Entity> loadClass(final String returnType) throws SBusinessDataRepositoryException { try { return (Class<? extends Entity>) Thread.currentThread().getContextClassLoader().loadClass(returnType); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException(e); } }
protected Class<? extends Serializable> loadSerializableClass(final String className) throws SBusinessDataRepositoryException { try { return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(className); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException("unable to load class " + className); } }
@SuppressWarnings("unchecked") protected Class<? extends Entity> loadClass(final String returnType) throws SBusinessDataRepositoryException { try { return (Class<? extends Entity>) Thread.currentThread().getContextClassLoader().loadClass(returnType); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException(e); } }
protected Class<? extends Serializable> loadSerializableClass(final String className) throws SBusinessDataRepositoryException { try { return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(className); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException("unable to load class " + className); } }
protected Object instantiateDAO(final String daoClassName) throws Exception { Class daoImplClass = Thread.currentThread().getContextClassLoader().loadClass(daoClassName); if (daoImplClass != null) { Constructor constructor = daoImplClass.getConstructor(BusinessDataRepository.class); return constructor.newInstance(businessDataRepository); } throw new SBusinessDataRepositoryException("Cannot load class " + daoClassName); }
protected Object instantiateDAO(final String daoClassName) throws Exception { Class daoImplClass = Thread.currentThread().getContextClassLoader().loadClass(daoClassName); if (daoImplClass != null) { Constructor constructor = daoImplClass.getConstructor(BusinessDataRepository.class); return constructor.newInstance(businessDataRepository); } throw new SBusinessDataRepositoryException("Cannot load class " + daoClassName); }
private Object callJavaOperationOnEntityList(final List<Entity> businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataRepositoryException, SBusinessDataNotFoundException { try { invokeJavaMethod(businessObject, methodName, parameterType, valueToSetObjectWith); return businessObject; } catch (final Exception e) { throw new SBusinessDataRepositoryException(e); } }
private Object callJavaOperationOnEntityList(final List<Entity> businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataRepositoryException, SBusinessDataNotFoundException { try { invokeJavaMethod(businessObject, methodName, parameterType, valueToSetObjectWith); return businessObject; } catch (final Exception e) { throw new SBusinessDataRepositoryException(e); } }
@Override public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { throw new SBusinessDataRepositoryException("no client-bdm.zip found in tenant resources"); } return sTenantResource.getContent(); }
@Override public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { throw new SBusinessDataRepositoryException("no client-bdm.zip found in tenant resources"); } return sTenantResource.getContent(); }
@Override public String getInstalledBDMVersion() throws SBusinessDataRepositoryException { try { Optional returnedId = dependencyService.getIdOfDependencyOfArtifact(tenantId, ScopeType.TENANT, BDR_DEPENDENCY_FILENAME); if (returnedId.isPresent()) { return String.valueOf(returnedId); } } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } return null; }
@Override public String getInstalledBDMVersion() throws SBusinessDataRepositoryException { try { Optional returnedId = dependencyService.getIdOfDependencyOfArtifact(tenantId, ScopeType.TENANT, BDR_DEPENDENCY_FILENAME); if (returnedId.isPresent()) { return String.valueOf(returnedId); } } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } return null; }
private Query getQueryDefinition(BusinessObject businessObject, String className, final String queryName) throws SBusinessDataRepositoryException { final List<Query> allQueries = new ArrayList<>(); allQueries.addAll(businessObject.getQueries()); allQueries.addAll(BDMQueryUtil.createProvidedQueriesForBusinessObject(businessObject)); for (final Query query : allQueries) { if (query.getName().equals(queryName)) { return query; } } throw new SBusinessDataRepositoryException("unable to get query " + queryName + " for business object " + className); }
private Query getQueryDefinition(BusinessObject businessObject, String className, final String queryName) throws SBusinessDataRepositoryException { final List<Query> allQueries = new ArrayList<>(); allQueries.addAll(businessObject.getQueries()); allQueries.addAll(BDMQueryUtil.createProvidedQueriesForBusinessObject(businessObject)); for (final Query query : allQueries) { if (query.getName().equals(queryName)) { return query; } } throw new SBusinessDataRepositoryException("unable to get query " + queryName + " for business object " + className); }
private Class<? extends Serializable> getQueryReturnType(final Query queryDefinition, final String entityClassName) throws SBusinessDataRepositoryException { if (queryDefinition.hasMultipleResults()) { return loadClass(entityClassName); } try { return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(queryDefinition.getReturnType()); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException("unable to load class " + queryDefinition.getReturnType()); } }
private Class<? extends Serializable> getQueryReturnType(final Query queryDefinition, final String entityClassName) throws SBusinessDataRepositoryException { if (queryDefinition.hasMultipleResults()) { return loadClass(entityClassName); } try { return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(queryDefinition.getReturnType()); } catch (final ClassNotFoundException e) { throw new SBusinessDataRepositoryException("unable to load class " + queryDefinition.getReturnType()); } }
private Object callJavaOperationOnEntity(final Entity businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataRepositoryException, SBusinessDataNotFoundException { Entity jpaEntity = businessDataReloader.reloadEntitySoftly(businessObject); final Object valueToSet = loadValueToSet(businessObject, valueToSetObjectWith, methodName); try { invokeJavaMethod(jpaEntity, methodName, parameterType, valueToSet); // TODO Auto-generated method stub return jpaEntity; } catch (final Exception e) { throw new SBusinessDataRepositoryException(e); } }
private Object callJavaOperationOnEntity(final Entity businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataRepositoryException, SBusinessDataNotFoundException { Entity jpaEntity = businessDataReloader.reloadEntitySoftly(businessObject); final Object valueToSet = loadValueToSet(businessObject, valueToSetObjectWith, methodName); try { invokeJavaMethod(jpaEntity, methodName, parameterType, valueToSet); // TODO Auto-generated method stub return jpaEntity; } catch (final Exception e) { throw new SBusinessDataRepositoryException(e); } }
@SuppressWarnings("unchecked") @Override public Object callJavaOperation(final Object businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataNotFoundException, SBusinessDataRepositoryException { if (businessObject == null) { throw new SBusinessDataNotFoundException("business data is null"); } if (isEntity(businessObject)) { return callJavaOperationOnEntity((Entity) businessObject, valueToSetObjectWith, methodName, parameterType); } if (isListOfEntities(businessObject)) { return callJavaOperationOnEntityList((List<Entity>) businessObject, valueToSetObjectWith, methodName, parameterType); } throw new SBusinessDataRepositoryException("not a business data"); }
@SuppressWarnings("unchecked") @Override public Object callJavaOperation(final Object businessObject, final Object valueToSetObjectWith, final String methodName, final String parameterType) throws SBusinessDataNotFoundException, SBusinessDataRepositoryException { if (businessObject == null) { throw new SBusinessDataNotFoundException("business data is null"); } if (isEntity(businessObject)) { return callJavaOperationOnEntity((Entity) businessObject, valueToSetObjectWith, methodName, parameterType); } if (isListOfEntities(businessObject)) { return callJavaOperationOnEntityList((List<Entity>) businessObject, valueToSetObjectWith, methodName, parameterType); } throw new SBusinessDataRepositoryException("not a business data"); }