X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fbindings%2FResourceBinding.java;h=eca8a89dab272ab8d6eeb1e9ab3fa19d932ffcfa;hp=d623b439fc2917a051d3999412141b08ebc4b5d2;hb=48bb50bb6640506d1f150ca8e4fa5a6e878464be;hpb=91ea7a38f29bb1b02dbf55947d791d7876462e4e diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/bindings/ResourceBinding.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/bindings/ResourceBinding.java index d623b439f..eca8a89da 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/bindings/ResourceBinding.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/bindings/ResourceBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2018 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 @@ -31,23 +31,13 @@ public class ResourceBinding extends LongBinding { public static final Datatype RESOURCE_TYPE; - //SerialisationSupport support; - /** - * Create resource binding. If session is not provided, this binding cannot instantiate resources. + * Create resource binding. * * @param session or null */ - public ResourceBinding(Session session) { + public ResourceBinding() { super(Datatypes.LONG); -// if (session != null) { -// support = session.peekService(SerialisationSupport.class); -// } - } - - public ResourceBinding(SerialisationSupport serializationSupport) { - super(Datatypes.LONG); -// this.support = serializationSupport; } /** @@ -56,10 +46,6 @@ public class ResourceBinding extends LongBinding { * if not able to return a current {@link SerialisationSupport} */ private SerialisationSupport getCurrentSupport() throws BindingException { - // FIXME: this is wrong but should be optimized if possible. -// if (support != null) -// return support; - Session s = SimanticsInternal.peekSession(); if ( s == null ) { throw new BindingException("Cannot instantiate Resource without an alive database Session."); @@ -118,8 +104,6 @@ public class ResourceBinding extends LongBinding { public Long getValue(Object o) throws BindingException { SerialisationSupport support = getCurrentSupport(); // NOTE: r.getResourceId() is unsafe for this purpose, it will just return 0 if it fails, thus corrupting anything serialized with this method -// Resource r = (Resource) o; -// return r.getResourceId(); try { return support.getRandomAccessId((Resource)o); } catch (DatabaseException e) { @@ -131,8 +115,6 @@ public class ResourceBinding extends LongBinding { public long getValue_(Object o) throws BindingException { SerialisationSupport support = getCurrentSupport(); // NOTE: r.getResourceId() is unsafe for this purpose, it will just return 0 if it fails, thus corrupting anything serialized with this method -// Resource r = (Resource) o; -// return r.getResourceId(); try { return support.getRandomAccessId((Resource)o); } catch (DatabaseException e) {