/******************************************************************************* * 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.history.util.subscription; import java.util.Collection; import java.util.Iterator; import org.simantics.databoard.annotations.Identifier; import org.simantics.databoard.type.Datatype; import org.simantics.databoard.util.Bean; /** * (Utility Class) Item format for HistoryManager, Collector, and meta-data for Simantics subscription configurations. * * The items objects the HistoryManager and Collector uses are complete meta-data * descriptions. Different formats are supported and the content is written to disc * completely as is. * * The "id" is composed with the following aggregation: [subscriptionId] [variableId] [formatId]. * * @author toni.kalajainen */ public class SubscriptionItem extends Bean { /** * Create HistoryItem descriptions for collecting one variable with multiple * sampling formats. * * @param item * the item to use as a template for the created sampled items * @param groupItemId * the group item id to use with * {@link #composeItemName(String, String, String)} * @param groupId * the group id to use with * {@link #composeItemName(String, String, String)} * @param formats * the sampling formats to create * @return an array of history items */ public static SubscriptionItem[] createItems( SubscriptionItem item, String groupItemId, String groupId, Collection formats) { Iterator itr = formats.iterator(); SubscriptionItem[] items = new SubscriptionItem[ formats.size() ]; for (int i=0; i formats) { Iterator itr = formats.iterator(); SubscriptionItem[] items = new SubscriptionItem[ formats.size() ]; for (int i=0; i