X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Frules%2Fdomain%2FRelatedObjectsAccessor.java;fp=org.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Frules%2Fdomain%2FRelatedObjectsAccessor.java;h=0000000000000000000000000000000000000000;hb=23d6118551e857da09afc0437aacd2b5ebb21297;hp=5a9b1860093aa952393d06b2db9689022c08b8c8;hpb=def2c5c9bd1598baa121105cd2610e9e823a6bc7;p=simantics%2F3d.git diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java deleted file mode 100644 index 5a9b1860..00000000 --- a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * 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.rules.domain; - -import java.util.Collection; - -import org.apache.log4j.Logger; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.objmap.exceptions.MappingException; - -/** - * Accesses the set of objects attached to the element by the given relation. - * @author Hannu Niemistö - */ -public class RelatedObjectsAccessor implements IDomainAccessor> { - - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); - - Resource relation; - boolean deleteExtraObjects; - - public RelatedObjectsAccessor(Resource relation, boolean deleteExtraObjects) { - super(); - this.relation = relation; - this.deleteExtraObjects = deleteExtraObjects; - } - - @Override - public Collection get(ReadGraph g, Resource element) throws MappingException { - try { - LOGGER.info(" RelatedObjectsAccessor.get"); - return g.getObjects(element, relation); - } catch (DatabaseException e) { - throw new MappingException(e); - } - } - - @Override - public boolean set(WriteGraph g, Resource element, Collection value) - throws MappingException { - try { - LOGGER.info(" RelatedObjectsAccessor.set"); - return MappingUtils.synchronizeStatements(g, element, relation, - value.toArray(new Resource[value.size()]), deleteExtraObjects); - } catch (DatabaseException e) { - throw new MappingException(e); - } - - } - -}