@Override public void exportToBusinessArchive(long processDefinitionId, BusinessArchiveBuilder businessArchiveBuilder) throws SBonitaException { final ExportActorMapping exportActorMapping = new ExportActorMapping(actorMappingService, identityService, processDefinitionId); businessArchiveBuilder.setActorMapping(exportActorMapping.getActorMapping()); }
@Override public void exportToBusinessArchive(long processDefinitionId, BusinessArchiveBuilder businessArchiveBuilder) throws SBonitaException { final ExportActorMapping exportActorMapping = new ExportActorMapping(actorMappingService, identityService, processDefinitionId); businessArchiveBuilder.setActorMapping(exportActorMapping.getActorMapping()); }
/** * Set the actor mapping for this {@link BusinessArchive} <p> * The file must be compliant with the xsd actorMapping.xsd The actor mapping specify for each {@link org.bonitasoft.engine.bpm.actor.ActorDefinition} of * the process who it is in the * organization. * <p> * It is not mandatory to set it in the {@link BusinessArchive}, it can be set after the process was deployed using * {@link org.bonitasoft.engine.api.ProcessAPI#addUserToActor(long, long)}, {@link org.bonitasoft.engine.api.ProcessAPI#addGroupToActor(long, long)}, * {@link org.bonitasoft.engine.api.ProcessAPI#addRoleToActor(long, long)} or * {@link org.bonitasoft.engine.api.ProcessAPI#addRoleAndGroupToActor(long, long, long)} * * @param xmlContent * the xml file content that describe the actor mapping * @return * the same {@link BusinessArchiveBuilder} in order to chain calls */ @Deprecated public BusinessArchiveBuilder setActorMapping(final byte[] xmlContent) throws IOException { ActorMapping actorMapping; ActorMappingMarshaller marshaller = new ActorMappingMarshaller(); try { actorMapping = marshaller.deserializeFromXML(xmlContent); } catch (XmlMarshallException e) { throw new IOException("Generation of the actorMapping from the provided Xml failed", e); } setActorMapping(actorMapping); return this; }
/** * Set the actor mapping for this {@link BusinessArchive} <p> * The file must be compliant with the xsd actorMapping.xsd The actor mapping specify for each {@link org.bonitasoft.engine.bpm.actor.ActorDefinition} of * the process who it is in the * organization. * <p> * It is not mandatory to set it in the {@link BusinessArchive}, it can be set after the process was deployed using * {@link org.bonitasoft.engine.api.ProcessAPI#addUserToActor(long, long)}, {@link org.bonitasoft.engine.api.ProcessAPI#addGroupToActor(long, long)}, * {@link org.bonitasoft.engine.api.ProcessAPI#addRoleToActor(long, long)} or * {@link org.bonitasoft.engine.api.ProcessAPI#addRoleAndGroupToActor(long, long, long)} * * @param xmlContent * the xml file content that describe the actor mapping * @return * the same {@link BusinessArchiveBuilder} in order to chain calls */ @Deprecated public BusinessArchiveBuilder setActorMapping(final byte[] xmlContent) throws IOException { ActorMapping actorMapping; ActorMappingMarshaller marshaller = new ActorMappingMarshaller(); try { actorMapping = marshaller.deserializeFromXML(xmlContent); } catch (XmlMarshallException e) { throw new IOException("Generation of the actorMapping from the provided Xml failed", e); } setActorMapping(actorMapping); return this; }
@Test public void putActorMappingInBar() throws Exception { final ProcessDefinitionBuilder processDefinitionBuilder = new ProcessDefinitionBuilder().createNewInstance("ProductionPlanning", "3.1"); final DesignProcessDefinition designProcessDefinition = processDefinitionBuilder.done(); ActorMapping actorMapping = new ActorMapping(); // Add a resource to the biz archive: final BusinessArchive businessArchive = new BusinessArchiveBuilder().createNewBusinessArchive().setProcessDefinition(designProcessDefinition) .setActorMapping(actorMapping).done(); BusinessArchiveFactory.writeBusinessArchiveToFile(businessArchive, barFile); // read from the file final BusinessArchive readBusinessArchive = BusinessArchiveFactory.readBusinessArchive(barFile); // final ProcessDefinition processDefinition = processAPI.deploy(readBusinessArchive); assertEquals(actorMapping, readBusinessArchive.getActorMapping()); }