public byte[] serializeToXML(final ActorMapping model) throws XmlMarshallException { return marshall(model); }
public ActorMapping deserializeFromXML(final byte[] xmlModel) throws XmlMarshallException { return unmarshall(xmlModel); }
private ActorMapping getActorMappingFromXML(String xmlContent) throws SBonitaException { byte[] b = xmlContent.getBytes(); try { return new ActorMappingMarshaller().deserializeFromXML(b); } catch (XmlMarshallException e) { throw new SBonitaReadException("Unable to read the actor mapping xml", e); } }
@Override public void execute() throws SBonitaException { final ActorMapping mapping = getActorMapping(); ActorMappingMarshaller marshaller = new ActorMappingMarshaller(); try { xmlContent = new String(marshaller.serializeToXML(mapping)); } catch (XmlMarshallException e) { throw new SBonitaReadException("Failed to generate xml from actorMapping", e); } }
private ActorMapping getActorMappingFromXML(String xmlContent) throws SBonitaException { byte[] b = xmlContent.getBytes(); try { return new ActorMappingMarshaller().deserializeFromXML(b); } catch (XmlMarshallException e) { throw new SBonitaReadException("Unable to read the actor mapping xml", e); } }
@Override public void execute() throws SBonitaException { final ActorMapping mapping = getActorMapping(); ActorMappingMarshaller marshaller = new ActorMappingMarshaller(); try { xmlContent = new String(marshaller.serializeToXML(mapping)); } catch (XmlMarshallException e) { throw new SBonitaReadException("Failed to generate xml from actorMapping", e); } }
@Override public boolean readFromBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final File file = new File(barFolder, ACTOR_MAPPING_FILE); if (file.exists()) { final byte[] content = IOUtil.getContent(file); try { businessArchive.setActorMapping(new ActorMappingMarshaller().deserializeFromXML(content)); } catch (XmlMarshallException e) { return false; } return true; } return false; }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final ActorMapping actorMapping = businessArchive.getActorMapping(); if (actorMapping != null) { try { final byte[] fileContent = new ActorMappingMarshaller().serializeToXML(actorMapping); final File file = new File(barFolder, ACTOR_MAPPING_FILE); IOUtil.write(file, fileContent); } catch (XmlMarshallException e) { throw new IOException("Cannot write Actor Mapping to Bar folder", e); } } }
public ActorMapping deserializeFromXML(final byte[] xmlModel) throws XmlMarshallException { return unmarshall(xmlModel); }
public byte[] serializeToXML(final ActorMapping model) throws XmlMarshallException { return marshall(model); }
@Override public boolean readFromBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final File file = new File(barFolder, ACTOR_MAPPING_FILE); if (file.exists()) { final byte[] content = IOUtil.getContent(file); try { businessArchive.setActorMapping(new ActorMappingMarshaller().deserializeFromXML(content)); } catch (XmlMarshallException e) { return false; } return true; } return false; }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final ActorMapping actorMapping = businessArchive.getActorMapping(); if (actorMapping != null) { try { final byte[] fileContent = new ActorMappingMarshaller().serializeToXML(actorMapping); final File file = new File(barFolder, ACTOR_MAPPING_FILE); IOUtil.write(file, fileContent); } catch (XmlMarshallException e) { throw new IOException("Cannot write Actor Mapping to Bar folder", e); } } }
/** * 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; }