X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.event%2Fsrc%2Forg%2Fsimantics%2Fevent%2Fview%2Fhandler%2FCorrectMilestoneLabelsAction.java;h=2098119774af113c845e9399ff226740dcd0e848;hb=b586228b0a54c5b8aa55a31d929d7f24c4fc5f53;hp=a9783b22ae8488d5d3ec46a57843eef66075dcd8;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.event/src/org/simantics/event/view/handler/CorrectMilestoneLabelsAction.java b/bundles/org.simantics.event/src/org/simantics/event/view/handler/CorrectMilestoneLabelsAction.java index a9783b22a..209811977 100644 --- a/bundles/org.simantics.event/src/org/simantics/event/view/handler/CorrectMilestoneLabelsAction.java +++ b/bundles/org.simantics.event/src/org/simantics/event/view/handler/CorrectMilestoneLabelsAction.java @@ -1,63 +1,63 @@ -/******************************************************************************* - * 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.event.view.handler; - -import java.util.Collection; - -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.VirtualGraph; -import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.exception.DatabaseException; -import org.simantics.event.ontology.EventResource; - -/** - * This action fixes all MilestoneLabels of an EventLog. - * - * The label is derieved from the order number of an event. - * - * @author toni.kalajainen - */ -public class CorrectMilestoneLabelsAction extends WriteRequest { - - Resource eventlog; - - public CorrectMilestoneLabelsAction(Resource eventlog, VirtualGraph vg) { - super(vg); - this.eventlog = eventlog; - } - - @Override - public void perform(WriteGraph graph) throws DatabaseException { - EventResource EVENT = EventResource.getInstance(graph); - MilestoneList ml = graph.sync( new MilestoneListQuery( eventlog ) ); - //System.out.println("Setting labels"); - if ( !ml.milestones.isEmpty() ) { - for (int i=0; i events) throws DatabaseException { - Collection eventlogs = graph.sync( new GetEventLogsQuery( events ) ); - for (Resource eventlog : eventlogs) { - graph.syncRequest( new CorrectMilestoneLabelsAction(eventlog, vg) ); - } - } - -} +/******************************************************************************* + * 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.event.view.handler; + +import java.util.Collection; + +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.VirtualGraph; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.exception.DatabaseException; +import org.simantics.event.ontology.EventResource; + +/** + * This action fixes all MilestoneLabels of an EventLog. + * + * The label is derieved from the order number of an event. + * + * @author toni.kalajainen + */ +public class CorrectMilestoneLabelsAction extends WriteRequest { + + Resource eventlog; + + public CorrectMilestoneLabelsAction(Resource eventlog, VirtualGraph vg) { + super(vg); + this.eventlog = eventlog; + } + + @Override + public void perform(WriteGraph graph) throws DatabaseException { + EventResource EVENT = EventResource.getInstance(graph); + MilestoneList ml = graph.sync( new MilestoneListQuery( eventlog ) ); + //System.out.println("Setting labels"); + if ( !ml.milestones.isEmpty() ) { + for (int i=0; i events) throws DatabaseException { + Collection eventlogs = graph.sync( new GetEventLogsQuery( events ) ); + for (Resource eventlog : eventlogs) { + graph.syncRequest( new CorrectMilestoneLabelsAction(eventlog, vg) ); + } + } + +}