X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Ftypicals%2FTypicalSynchronizationMetadata.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Ftypicals%2FTypicalSynchronizationMetadata.java;h=d87ba96822935c442485921edb377d2840cc1c53;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=84abbc2af27f2ed3aebc50c98e0ff97860b9815c;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalSynchronizationMetadata.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalSynchronizationMetadata.java index 84abbc2af..d87ba9682 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalSynchronizationMetadata.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalSynchronizationMetadata.java @@ -1,80 +1,80 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 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.modeling.typicals; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.serialization.SerializationException; -import org.simantics.databoard.serialization.Serializer; -import org.simantics.db.Metadata; -import org.simantics.db.Resource; -import org.simantics.db.Session; - -/** - * @author Tuukka Lehtonen - */ -public class TypicalSynchronizationMetadata implements Metadata { - - private static final Binding BINDING = - Bindings.getBindingUnchecked(TypicalSynchronizationMetadata.class); - private static final Serializer SERIALIZER = - Bindings.getSerializerUnchecked(BINDING); - - public List synchronizedTypicals; - - public TypicalSynchronizationMetadata() { - } - - @Override - public byte[] serialise(Session session) { - try { - return SERIALIZER.serialize(this); - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public static TypicalSynchronizationMetadata deserialise(Session session, byte[] input) { - if (input == null) { - TypicalSynchronizationMetadata metadata = new TypicalSynchronizationMetadata(); - metadata.synchronizedTypicals = new ArrayList(); - return metadata; - } - try { - return (TypicalSynchronizationMetadata) SERIALIZER.deserialize(input); - } catch (SerializationException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - /** - * @param typicalInstance - * @return - */ - public TypicalSynchronizationMetadata addTypical(Resource typicalInstance) { - synchronizedTypicals.add(typicalInstance); - return this; - } - - public List getTypicals() { - return synchronizedTypicals; - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2012 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.modeling.typicals; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.simantics.databoard.Bindings; +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.serialization.SerializationException; +import org.simantics.databoard.serialization.Serializer; +import org.simantics.db.Metadata; +import org.simantics.db.Resource; +import org.simantics.db.Session; + +/** + * @author Tuukka Lehtonen + */ +public class TypicalSynchronizationMetadata implements Metadata { + + private static final Binding BINDING = + Bindings.getBindingUnchecked(TypicalSynchronizationMetadata.class); + private static final Serializer SERIALIZER = + Bindings.getSerializerUnchecked(BINDING); + + public List synchronizedTypicals; + + public TypicalSynchronizationMetadata() { + } + + @Override + public byte[] serialise(Session session) { + try { + return SERIALIZER.serialize(this); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public static TypicalSynchronizationMetadata deserialise(Session session, byte[] input) { + if (input == null) { + TypicalSynchronizationMetadata metadata = new TypicalSynchronizationMetadata(); + metadata.synchronizedTypicals = new ArrayList(); + return metadata; + } + try { + return (TypicalSynchronizationMetadata) SERIALIZER.deserialize(input); + } catch (SerializationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @param typicalInstance + * @return + */ + public TypicalSynchronizationMetadata addTypical(Resource typicalInstance) { + synchronizedTypicals.add(typicalInstance); + return this; + } + + public List getTypicals() { + return synchronizedTypicals; + } + +}