Commit 67c5336e authored by Adrien's avatar Adrien Committed by Romain Bioteau

fix export diagram with wml variable (#615)

* Avoid exception at export when an xml process variable has not been
declared

closes [BS-16853](https://bonitasoft.atlassian.net/browse/BS-16853)
parent da675745
/**
* Copyright (C) 2010 BonitaSoft S.A.
* BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.xml.export;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
......@@ -35,24 +33,22 @@ import org.eclipse.emf.ecore.EObject;
/**
* @author Romain Bioteau
*
*/
public class XSDResourceProvider implements IBOSArchiveFileStoreProvider {
@Override
public Set<IRepositoryFileStore> getFileStoreForConfiguration(AbstractProcess process, Configuration configuration) {
final Set<IRepositoryFileStore> files = new HashSet<IRepositoryFileStore>() ;
final XSDRepositoryStore store = (XSDRepositoryStore) RepositoryManager.getInstance().getRepositoryStore(XSDRepositoryStore.class) ;
final Set<IRepositoryFileStore> files = new HashSet<IRepositoryFileStore>();
final XSDRepositoryStore store = (XSDRepositoryStore) RepositoryManager.getInstance()
.getRepositoryStore(XSDRepositoryStore.class);
List<EObject> xmlData = ModelHelper.getAllItemsOfType(process, ProcessPackage.Literals.XML_DATA);
for (EObject item : xmlData) {
XMLData data = (XMLData)item;
XSDFileStore artifact = store.findArtifactWithNamespace(data.getNamespace());
files.add(artifact) ;
XMLData data = (XMLData) item;
Optional<XSDFileStore> artifact = Optional.ofNullable(store.findArtifactWithNamespace(data.getNamespace()));
artifact.ifPresent(files::add);
}
return files;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment