X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Fimpl%2FRangeUpdateRequest.java;fp=bundles%2Forg.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Fimpl%2FRangeUpdateRequest.java;h=b84b9c94ff8b866eb8ecea86471914d6dc7d1bda;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=fed1918c3a896529b19b99a419b02f1d207099fa;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java index fed1918c3..b84b9c94f 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java @@ -1,77 +1,77 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.objmap.graph.impl; - -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.procedure.SyncListener; -import org.simantics.db.request.Read; - -import org.simantics.objmap.exceptions.MappingException; -import org.simantics.objmap.forward.IForwardMapping; -import org.simantics.objmap.graph.impl.Link; - - -public class RangeUpdateRequest implements Read, SyncListener { - - Link link; - /* - * Note that this map uses a read request that it has got from caller and - * not the one that is used in updateRange. This is intentional. - */ - IForwardMapping map; // map==null is used to flag that request is performed once - Mapping mapping; // mapping==null is used as a flag the request disposed - - public RangeUpdateRequest(Link link, IForwardMapping map, Mapping mapping) { - this.link = link; - this.map = map; - this.mapping = mapping; - } - - @Override - public Boolean perform(ReadGraph g) throws DatabaseException { - if(map != null) { - link.type.updateRange(g, map, link.domainElement, link.rangeElement); - map = null; - return Boolean.TRUE; - } - else if(mapping != null) { - mapping.domainModified(link); - mapping = null; - return Boolean.FALSE; - } - else - return null; - } - - @Override - public void exception(ReadGraph graph, Throwable throwable) - throws DatabaseException { - if(throwable instanceof DatabaseException) - throw (DatabaseException)throwable; - else - throw new MappingException(throwable); - } - - @Override - public void execute(ReadGraph graph, Boolean result) - throws DatabaseException { - } - - @Override - public boolean isDisposed() { - return mapping == null || link.removed || mapping.isDisposed(); - } - - - -} +/******************************************************************************* + * Copyright (c) 2007, 2013 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.objmap.graph.impl; + +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.procedure.SyncListener; +import org.simantics.db.request.Read; + +import org.simantics.objmap.exceptions.MappingException; +import org.simantics.objmap.forward.IForwardMapping; +import org.simantics.objmap.graph.impl.Link; + + +public class RangeUpdateRequest implements Read, SyncListener { + + Link link; + /* + * Note that this map uses a read request that it has got from caller and + * not the one that is used in updateRange. This is intentional. + */ + IForwardMapping map; // map==null is used to flag that request is performed once + Mapping mapping; // mapping==null is used as a flag the request disposed + + public RangeUpdateRequest(Link link, IForwardMapping map, Mapping mapping) { + this.link = link; + this.map = map; + this.mapping = mapping; + } + + @Override + public Boolean perform(ReadGraph g) throws DatabaseException { + if(map != null) { + link.type.updateRange(g, map, link.domainElement, link.rangeElement); + map = null; + return Boolean.TRUE; + } + else if(mapping != null) { + mapping.domainModified(link); + mapping = null; + return Boolean.FALSE; + } + else + return null; + } + + @Override + public void exception(ReadGraph graph, Throwable throwable) + throws DatabaseException { + if(throwable instanceof DatabaseException) + throw (DatabaseException)throwable; + else + throw new MappingException(throwable); + } + + @Override + public void execute(ReadGraph graph, Boolean result) + throws DatabaseException { + } + + @Override + public boolean isDisposed() { + return mapping == null || link.removed || mapping.isDisposed(); + } + + + +}