X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fsubscription%2FNewSubscription.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fsubscription%2FNewSubscription.java;h=8564f09ae13feecc49eb163ac0d2ce3d2ec066e9;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=e3152c0dafd827add4de819b675b2ad997c2d7d7;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/NewSubscription.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/NewSubscription.java index e3152c0da..8564f09ae 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/NewSubscription.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/NewSubscription.java @@ -1,51 +1,51 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 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.subscription; - -import java.util.UUID; - -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.common.CommentMetadata; -import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.common.utils.NameUtils; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; -import org.simantics.layer0.utils.direct.GraphUtils; -import org.simantics.modeling.ModelingResources; - -public class NewSubscription extends WriteRequest { - - public Resource subscription; - Resource model; - String name; - - public NewSubscription( Resource model, String name ) { - this.model = model; - this.name = name; - } - - @Override - public void perform(WriteGraph g) throws DatabaseException { - Layer0 l0 = Layer0.getInstance(g); - ModelingResources wr = ModelingResources.getInstance(g); - String freshLabel = NameUtils.findFreshLabel(g, name, model); - subscription = GraphUtils.create2(g, wr.Subscription, - l0.HasName, UUID.randomUUID().toString(), - l0.HasLabel, freshLabel, - l0.PartOf, model); - - CommentMetadata cm = g.getMetadata(CommentMetadata.class); - g.addMetadata(cm.add("Created subscription folder " + name)); - } - +/******************************************************************************* + * Copyright (c) 2007, 2011 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.subscription; + +import java.util.UUID; + +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.CommentMetadata; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.common.utils.NameUtils; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; +import org.simantics.layer0.utils.direct.GraphUtils; +import org.simantics.modeling.ModelingResources; + +public class NewSubscription extends WriteRequest { + + public Resource subscription; + Resource model; + String name; + + public NewSubscription( Resource model, String name ) { + this.model = model; + this.name = name; + } + + @Override + public void perform(WriteGraph g) throws DatabaseException { + Layer0 l0 = Layer0.getInstance(g); + ModelingResources wr = ModelingResources.getInstance(g); + String freshLabel = NameUtils.findFreshLabel(g, name, model); + subscription = GraphUtils.create2(g, wr.Subscription, + l0.HasName, UUID.randomUUID().toString(), + l0.HasLabel, freshLabel, + l0.PartOf, model); + + CommentMetadata cm = g.getMetadata(CommentMetadata.class); + g.addMetadata(cm.add("Created subscription folder " + name)); + } + } \ No newline at end of file