private SRefBusinessDataInstance getRefBusinessDataUsingFlowNodeContext(BusinessDataContext context) throws SBonitaReadException, SFlowNodeReadException, SRefBusinessDataInstanceNotFoundException, SProcessInstanceReadException { SRefBusinessDataInstance refBusinessDataInstance = getRefBusinessDataInFlowNode(context); if (refBusinessDataInstance != null) { return refBusinessDataInstance; } return getRefBusinessDataInProcess(context, getProcessInstanceIdFromFlowNode(context)); }
public SRefBusinessDataInstance getRefBusinessDataInstance(BusinessDataContext context) throws SBonitaException { if (isProcessContext(context)) { return getRefBusinessDataUsingProcessContext(context); } return getRefBusinessDataUsingFlowNodeContext(context); }
@Override public Serializable getJsonEntity(final String entityClassName, final Long identifier, final String businessDataURIPattern) throws SBusinessDataNotFoundException, SBusinessDataRepositoryException { final Class<? extends Entity> entityClass = loadClass(entityClassName); final Entity entity = businessDataRepository.findById(entityClass, identifier); return jsonBusinessDataSerializer.serializeEntity(entity, businessDataURIPattern); }
@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"); }
@Override @SuppressWarnings("unchecked") public Serializable getJsonEntities(final String entityClassName, final List<Long> identifiers, final String businessDataURIPattern) throws SBusinessDataRepositoryException { final Class<? extends Entity> entityClass = loadClass(entityClassName); final List<? extends Entity> entities = businessDataRepository.findByIdentifiers(entityClass, identifiers); return jsonBusinessDataSerializer.serializeEntities(entities, businessDataURIPattern); }
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); } }
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); } }
private long getProcessInstanceIdThatCanContainBusinessData(long processInstanceId) throws SProcessInstanceReadException, SBonitaReadException, SProcessInstanceNotFoundException, SFlowNodeReadException, SFlowNodeNotFoundException { try { SProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return processInstanceId; } catch (SProcessInstanceNotFoundException e) { //No caller type in archived process instance, get archive business data not supported from event subprocess return processInstanceId; } }
@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(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); } }
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); } }
@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"); }
@Override public Serializable getJsonEntity(final String entityClassName, final Long identifier, final String businessDataURIPattern) throws SBusinessDataNotFoundException, SBusinessDataRepositoryException { final Class<? extends Entity> entityClass = loadClass(entityClassName); final Entity entity = businessDataRepository.findById(entityClass, identifier); return jsonBusinessDataSerializer.serializeEntity(entity, businessDataURIPattern); }
private SRefBusinessDataInstance getRefBusinessDataUsingFlowNodeContext(BusinessDataContext context) throws SBonitaReadException, SFlowNodeReadException, SRefBusinessDataInstanceNotFoundException, SProcessInstanceReadException { SRefBusinessDataInstance refBusinessDataInstance = getRefBusinessDataInFlowNode(context); if (refBusinessDataInstance != null) { return refBusinessDataInstance; } return getRefBusinessDataInProcess(context, getProcessInstanceIdFromFlowNode(context)); }
public SRefBusinessDataInstance getRefBusinessDataInstance(BusinessDataContext context) throws SBonitaException { if (isProcessContext(context)) { return getRefBusinessDataUsingProcessContext(context); } return getRefBusinessDataUsingFlowNodeContext(context); }
@Override @SuppressWarnings("unchecked") public Serializable getJsonEntities(final String entityClassName, final List<Long> identifiers, final String businessDataURIPattern) throws SBusinessDataRepositoryException { final Class<? extends Entity> entityClass = loadClass(entityClassName); final List<? extends Entity> entities = businessDataRepository.findByIdentifiers(entityClass, identifiers); return jsonBusinessDataSerializer.serializeEntities(entities, businessDataURIPattern); }
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); } }
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); } }
private long getProcessInstanceIdThatCanContainBusinessData(long processInstanceId) throws SProcessInstanceReadException, SBonitaReadException, SProcessInstanceNotFoundException, SFlowNodeReadException, SFlowNodeNotFoundException { try { SProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return processInstanceId; } catch (SProcessInstanceNotFoundException e) { //No caller type in archived process instance, get archive business data not supported from event subprocess return processInstanceId; } }