+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.sysdyn;\r
-\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-public class SysdynResource {\r
- \r
- public final Resource Admin1;\r
- public final Resource Admin1CM;\r
- public final Resource Admin2;\r
- public final Resource Admin2CM;\r
- public final Resource Auxiliary;\r
- public final Resource AuxiliarySymbol;\r
- public final Resource BasicExperiment;\r
- public final Resource CapacityModuleConfigurationDiagram;\r
- public final Resource CapacitySymbol;\r
- public final Resource Cloud;\r
- public final Resource CloudSymbol;\r
- public final Resource Configuration;\r
- public final Resource ConfigurationDiagram;\r
- public final Resource ConstantExpression;\r
- public final Resource CustomerModuleConfigurationDiagram;\r
- public final Resource CustomersSymbol;\r
- public final Resource DefaultRealization;\r
- public final Resource DelayExpression;\r
- public final Resource Dependency;\r
- public final Resource DependencyConnection;\r
- public final Resource DiagramToCompositeMapping;\r
- public final Resource Experiment;\r
- public final Resource Expression;\r
- public final Resource Flow;\r
- public final Resource FlowConnection;\r
- public final Resource GameExperiment;\r
- public final Resource HasDefaultInputValue;\r
- public final Resource HasEquation;\r
- public final Resource HasExpression;\r
- public final Resource HasHead;\r
- public final Resource HasHeadTerminal;\r
- public final Resource HasInitialEquation;\r
- public final Resource HasLookup;\r
- public final Resource HasMaxX;\r
- public final Resource HasMaxY;\r
- public final Resource HasMinX;\r
- public final Resource HasMinY;\r
- public final Resource HasParameterFile;\r
- public final Resource HasRangeEnd;\r
- public final Resource HasRangeStart;\r
- public final Resource HasRangeStep;\r
- public final Resource HasResult;\r
- public final Resource HasResultFile;\r
- public final Resource HasStartTime;\r
- public final Resource HasStopTime;\r
- public final Resource HasTail;\r
- public final Resource HasTailTerminal;\r
- public final Resource HasTolerance;\r
- public final Resource HasUnit;\r
- public final Resource HasX;\r
- public final Resource HasY;\r
- public final Resource HistoryRealization;\r
- public final Resource IndependentVariable;\r
- public final Resource Input;\r
- public final Resource InputSymbol;\r
- public final Resource IsHeadOf;\r
- public final Resource IsHeadOfTerminal;\r
- public final Resource IsOutput;\r
- public final Resource IsTailOf;\r
- public final Resource IsTailOfTerminal;\r
- public final Resource LookupExpression;\r
- public final Resource Module;\r
- public final Resource ModuleSymbol;\r
- public final Resource NormalExpression;\r
- public final Resource ParameterExpression;\r
- public final Resource RefersTo;\r
- public final Resource Result;\r
- public final Resource RootConfigurationDiagram;\r
- public final Resource SimulateOnChangeExperiment;\r
- public final Resource Stock;\r
- public final Resource StockExpression;\r
- public final Resource StockSymbol;\r
- public final Resource SysdynConnectionType;\r
- public final Resource SysdynModel;\r
- public final Resource SysdynModelManager;\r
- public final Resource SysdynProject;\r
- public final Resource SysdynTerminal;\r
- public final Resource Valve;\r
- public final Resource ValveSymbol;\r
- public final Resource Variable;\r
- public final Resource WithLookupExpression;\r
- public final Resource WorkModelConfigurationDiagram;\r
- public final Resource WorkModuleConfigurationDiagram;\r
- public final Resource WorkSymbol;\r
- public final Resource WorkforceModuleConfigurationDiagram;\r
- public final Resource WorkforceSymbol;\r
- public final Resource angle;\r
- \r
- public static class URIs {\r
- public static final String Admin1 = "http://www.simantics.org/Sysdyn-1.0/Admin1";\r
- public static final String Admin1CM = "http://www.simantics.org/Sysdyn-1.0/Admin1CM";\r
- public static final String Admin2 = "http://www.simantics.org/Sysdyn-1.0/Admin2";\r
- public static final String Admin2CM = "http://www.simantics.org/Sysdyn-1.0/Admin2CM";\r
- public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary";\r
- public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol";\r
- public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.0/BasicExperiment";\r
- public static final String CapacityModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CapacityModuleConfigurationDiagram";\r
- public static final String CapacitySymbol = "http://www.simantics.org/Sysdyn-1.0/CapacitySymbol";\r
- public static final String Cloud = "http://www.simantics.org/Sysdyn-1.0/Cloud";\r
- public static final String CloudSymbol = "http://www.simantics.org/Sysdyn-1.0/CloudSymbol";\r
- public static final String Configuration = "http://www.simantics.org/Sysdyn-1.0/Configuration";\r
- public static final String ConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram";\r
- public static final String ConstantExpression = "http://www.simantics.org/Sysdyn-1.0/ConstantExpression";\r
- public static final String CustomerModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CustomerModuleConfigurationDiagram";\r
- public static final String CustomersSymbol = "http://www.simantics.org/Sysdyn-1.0/CustomersSymbol";\r
- public static final String DefaultRealization = "http://www.simantics.org/Sysdyn-1.0/DefaultRealization";\r
- public static final String DelayExpression = "http://www.simantics.org/Sysdyn-1.0/DelayExpression";\r
- public static final String Dependency = "http://www.simantics.org/Sysdyn-1.0/Dependency";\r
- public static final String DependencyConnection = "http://www.simantics.org/Sysdyn-1.0/DependencyConnection";\r
- public static final String DiagramToCompositeMapping = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping";\r
- public static final String Experiment = "http://www.simantics.org/Sysdyn-1.0/Experiment";\r
- public static final String Expression = "http://www.simantics.org/Sysdyn-1.0/Expression";\r
- public static final String Flow = "http://www.simantics.org/Sysdyn-1.0/Flow";\r
- public static final String FlowConnection = "http://www.simantics.org/Sysdyn-1.0/FlowConnection";\r
- public static final String GameExperiment = "http://www.simantics.org/Sysdyn-1.0/GameExperiment";\r
- public static final String HasDefaultInputValue = "http://www.simantics.org/Sysdyn-1.0/HasDefaultInputValue";\r
- public static final String HasEquation = "http://www.simantics.org/Sysdyn-1.0/HasEquation";\r
- public static final String HasExpression = "http://www.simantics.org/Sysdyn-1.0/HasExpression";\r
- public static final String HasHead = "http://www.simantics.org/Sysdyn-1.0/HasHead";\r
- public static final String HasHeadTerminal = "http://www.simantics.org/Sysdyn-1.0/HasHeadTerminal";\r
- public static final String HasInitialEquation = "http://www.simantics.org/Sysdyn-1.0/HasInitialEquation";\r
- public static final String HasLookup = "http://www.simantics.org/Sysdyn-1.0/HasLookup";\r
- public static final String HasMaxX = "http://www.simantics.org/Sysdyn-1.0/HasMaxX";\r
- public static final String HasMaxY = "http://www.simantics.org/Sysdyn-1.0/HasMaxY";\r
- public static final String HasMinX = "http://www.simantics.org/Sysdyn-1.0/HasMinX";\r
- public static final String HasMinY = "http://www.simantics.org/Sysdyn-1.0/HasMinY";\r
- public static final String HasParameterFile = "http://www.simantics.org/Sysdyn-1.0/HasParameterFile";\r
- public static final String HasRangeEnd = "http://www.simantics.org/Sysdyn-1.0/HasRangeEnd";\r
- public static final String HasRangeStart = "http://www.simantics.org/Sysdyn-1.0/HasRangeStart";\r
- public static final String HasRangeStep = "http://www.simantics.org/Sysdyn-1.0/HasRangeStep";\r
- public static final String HasResult = "http://www.simantics.org/Sysdyn-1.0/HasResult";\r
- public static final String HasResultFile = "http://www.simantics.org/Sysdyn-1.0/HasResultFile";\r
- public static final String HasStartTime = "http://www.simantics.org/Sysdyn-1.0/HasStartTime";\r
- public static final String HasStopTime = "http://www.simantics.org/Sysdyn-1.0/HasStopTime";\r
- public static final String HasTail = "http://www.simantics.org/Sysdyn-1.0/HasTail";\r
- public static final String HasTailTerminal = "http://www.simantics.org/Sysdyn-1.0/HasTailTerminal";\r
- public static final String HasTolerance = "http://www.simantics.org/Sysdyn-1.0/HasTolerance";\r
- public static final String HasUnit = "http://www.simantics.org/Sysdyn-1.0/HasUnit";\r
- public static final String HasX = "http://www.simantics.org/Sysdyn-1.0/HasX";\r
- public static final String HasY = "http://www.simantics.org/Sysdyn-1.0/HasY";\r
- public static final String HistoryRealization = "http://www.simantics.org/Sysdyn-1.0/HistoryRealization";\r
- public static final String IndependentVariable = "http://www.simantics.org/Sysdyn-1.0/IndependentVariable";\r
- public static final String Input = "http://www.simantics.org/Sysdyn-1.0/Input";\r
- public static final String InputSymbol = "http://www.simantics.org/Sysdyn-1.0/InputSymbol";\r
- public static final String IsHeadOf = "http://www.simantics.org/Sysdyn-1.0/IsHeadOf";\r
- public static final String IsHeadOfTerminal = "http://www.simantics.org/Sysdyn-1.0/IsHeadOfTerminal";\r
- public static final String IsOutput = "http://www.simantics.org/Sysdyn-1.0/IsOutput";\r
- public static final String IsTailOf = "http://www.simantics.org/Sysdyn-1.0/IsTailOf";\r
- public static final String IsTailOfTerminal = "http://www.simantics.org/Sysdyn-1.0/IsTailOfTerminal";\r
- public static final String LookupExpression = "http://www.simantics.org/Sysdyn-1.0/LookupExpression";\r
- public static final String Module = "http://www.simantics.org/Sysdyn-1.0/Module";\r
- public static final String ModuleSymbol = "http://www.simantics.org/Sysdyn-1.0/ModuleSymbol";\r
- public static final String NormalExpression = "http://www.simantics.org/Sysdyn-1.0/NormalExpression";\r
- public static final String ParameterExpression = "http://www.simantics.org/Sysdyn-1.0/ParameterExpression";\r
- public static final String RefersTo = "http://www.simantics.org/Sysdyn-1.0/RefersTo";\r
- public static final String Result = "http://www.simantics.org/Sysdyn-1.0/Result";\r
- public static final String RootConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/RootConfigurationDiagram";\r
- public static final String SimulateOnChangeExperiment = "http://www.simantics.org/Sysdyn-1.0/SimulateOnChangeExperiment";\r
- public static final String Stock = "http://www.simantics.org/Sysdyn-1.0/Stock";\r
- public static final String StockExpression = "http://www.simantics.org/Sysdyn-1.0/StockExpression";\r
- public static final String StockSymbol = "http://www.simantics.org/Sysdyn-1.0/StockSymbol";\r
- public static final String SysdynConnectionType = "http://www.simantics.org/Sysdyn-1.0/SysdynConnectionType";\r
- public static final String SysdynModel = "http://www.simantics.org/Sysdyn-1.0/SysdynModel";\r
- public static final String SysdynModelManager = "http://www.simantics.org/Sysdyn-1.0/SysdynModelManager";\r
- public static final String SysdynProject = "http://www.simantics.org/Sysdyn-1.0/SysdynProject";\r
- public static final String SysdynTerminal = "http://www.simantics.org/Sysdyn-1.0/SysdynTerminal";\r
- public static final String Valve = "http://www.simantics.org/Sysdyn-1.0/Valve";\r
- public static final String ValveSymbol = "http://www.simantics.org/Sysdyn-1.0/ValveSymbol";\r
- public static final String Variable = "http://www.simantics.org/Sysdyn-1.0/Variable";\r
- public static final String WithLookupExpression = "http://www.simantics.org/Sysdyn-1.0/WithLookupExpression";\r
- public static final String WorkModelConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkModelConfigurationDiagram";\r
- public static final String WorkModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkModuleConfigurationDiagram";\r
- public static final String WorkSymbol = "http://www.simantics.org/Sysdyn-1.0/WorkSymbol";\r
- public static final String WorkforceModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkforceModuleConfigurationDiagram";\r
- public static final String WorkforceSymbol = "http://www.simantics.org/Sysdyn-1.0/WorkforceSymbol";\r
- public static final String angle = "http://www.simantics.org/Sysdyn-1.0/angle";\r
- }\r
- \r
- public static Resource getResourceOrNull(ReadGraph graph, String uri) {\r
- try {\r
- return graph.getResource(uri);\r
- } catch(DatabaseException e) {\r
- System.err.println(e.getMessage());\r
- return null;\r
- }\r
- }\r
- \r
- public SysdynResource(ReadGraph graph) {\r
- Admin1 = getResourceOrNull(graph, URIs.Admin1);\r
- Admin1CM = getResourceOrNull(graph, URIs.Admin1CM);\r
- Admin2 = getResourceOrNull(graph, URIs.Admin2);\r
- Admin2CM = getResourceOrNull(graph, URIs.Admin2CM);\r
- Auxiliary = getResourceOrNull(graph, URIs.Auxiliary);\r
- AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol);\r
- BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment);\r
- CapacityModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CapacityModuleConfigurationDiagram);\r
- CapacitySymbol = getResourceOrNull(graph, URIs.CapacitySymbol);\r
- Cloud = getResourceOrNull(graph, URIs.Cloud);\r
- CloudSymbol = getResourceOrNull(graph, URIs.CloudSymbol);\r
- Configuration = getResourceOrNull(graph, URIs.Configuration);\r
- ConfigurationDiagram = getResourceOrNull(graph, URIs.ConfigurationDiagram);\r
- ConstantExpression = getResourceOrNull(graph, URIs.ConstantExpression);\r
- CustomerModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CustomerModuleConfigurationDiagram);\r
- CustomersSymbol = getResourceOrNull(graph, URIs.CustomersSymbol);\r
- DefaultRealization = getResourceOrNull(graph, URIs.DefaultRealization);\r
- DelayExpression = getResourceOrNull(graph, URIs.DelayExpression);\r
- Dependency = getResourceOrNull(graph, URIs.Dependency);\r
- DependencyConnection = getResourceOrNull(graph, URIs.DependencyConnection);\r
- DiagramToCompositeMapping = getResourceOrNull(graph, URIs.DiagramToCompositeMapping);\r
- Experiment = getResourceOrNull(graph, URIs.Experiment);\r
- Expression = getResourceOrNull(graph, URIs.Expression);\r
- Flow = getResourceOrNull(graph, URIs.Flow);\r
- FlowConnection = getResourceOrNull(graph, URIs.FlowConnection);\r
- GameExperiment = getResourceOrNull(graph, URIs.GameExperiment);\r
- HasDefaultInputValue = getResourceOrNull(graph, URIs.HasDefaultInputValue);\r
- HasEquation = getResourceOrNull(graph, URIs.HasEquation);\r
- HasExpression = getResourceOrNull(graph, URIs.HasExpression);\r
- HasHead = getResourceOrNull(graph, URIs.HasHead);\r
- HasHeadTerminal = getResourceOrNull(graph, URIs.HasHeadTerminal);\r
- HasInitialEquation = getResourceOrNull(graph, URIs.HasInitialEquation);\r
- HasLookup = getResourceOrNull(graph, URIs.HasLookup);\r
- HasMaxX = getResourceOrNull(graph, URIs.HasMaxX);\r
- HasMaxY = getResourceOrNull(graph, URIs.HasMaxY);\r
- HasMinX = getResourceOrNull(graph, URIs.HasMinX);\r
- HasMinY = getResourceOrNull(graph, URIs.HasMinY);\r
- HasParameterFile = getResourceOrNull(graph, URIs.HasParameterFile);\r
- HasRangeEnd = getResourceOrNull(graph, URIs.HasRangeEnd);\r
- HasRangeStart = getResourceOrNull(graph, URIs.HasRangeStart);\r
- HasRangeStep = getResourceOrNull(graph, URIs.HasRangeStep);\r
- HasResult = getResourceOrNull(graph, URIs.HasResult);\r
- HasResultFile = getResourceOrNull(graph, URIs.HasResultFile);\r
- HasStartTime = getResourceOrNull(graph, URIs.HasStartTime);\r
- HasStopTime = getResourceOrNull(graph, URIs.HasStopTime);\r
- HasTail = getResourceOrNull(graph, URIs.HasTail);\r
- HasTailTerminal = getResourceOrNull(graph, URIs.HasTailTerminal);\r
- HasTolerance = getResourceOrNull(graph, URIs.HasTolerance);\r
- HasUnit = getResourceOrNull(graph, URIs.HasUnit);\r
- HasX = getResourceOrNull(graph, URIs.HasX);\r
- HasY = getResourceOrNull(graph, URIs.HasY);\r
- HistoryRealization = getResourceOrNull(graph, URIs.HistoryRealization);\r
- IndependentVariable = getResourceOrNull(graph, URIs.IndependentVariable);\r
- Input = getResourceOrNull(graph, URIs.Input);\r
- InputSymbol = getResourceOrNull(graph, URIs.InputSymbol);\r
- IsHeadOf = getResourceOrNull(graph, URIs.IsHeadOf);\r
- IsHeadOfTerminal = getResourceOrNull(graph, URIs.IsHeadOfTerminal);\r
- IsOutput = getResourceOrNull(graph, URIs.IsOutput);\r
- IsTailOf = getResourceOrNull(graph, URIs.IsTailOf);\r
- IsTailOfTerminal = getResourceOrNull(graph, URIs.IsTailOfTerminal);\r
- LookupExpression = getResourceOrNull(graph, URIs.LookupExpression);\r
- Module = getResourceOrNull(graph, URIs.Module);\r
- ModuleSymbol = getResourceOrNull(graph, URIs.ModuleSymbol);\r
- NormalExpression = getResourceOrNull(graph, URIs.NormalExpression);\r
- ParameterExpression = getResourceOrNull(graph, URIs.ParameterExpression);\r
- RefersTo = getResourceOrNull(graph, URIs.RefersTo);\r
- Result = getResourceOrNull(graph, URIs.Result);\r
- RootConfigurationDiagram = getResourceOrNull(graph, URIs.RootConfigurationDiagram);\r
- SimulateOnChangeExperiment = getResourceOrNull(graph, URIs.SimulateOnChangeExperiment);\r
- Stock = getResourceOrNull(graph, URIs.Stock);\r
- StockExpression = getResourceOrNull(graph, URIs.StockExpression);\r
- StockSymbol = getResourceOrNull(graph, URIs.StockSymbol);\r
- SysdynConnectionType = getResourceOrNull(graph, URIs.SysdynConnectionType);\r
- SysdynModel = getResourceOrNull(graph, URIs.SysdynModel);\r
- SysdynModelManager = getResourceOrNull(graph, URIs.SysdynModelManager);\r
- SysdynProject = getResourceOrNull(graph, URIs.SysdynProject);\r
- SysdynTerminal = getResourceOrNull(graph, URIs.SysdynTerminal);\r
- Valve = getResourceOrNull(graph, URIs.Valve);\r
- ValveSymbol = getResourceOrNull(graph, URIs.ValveSymbol);\r
- Variable = getResourceOrNull(graph, URIs.Variable);\r
- WithLookupExpression = getResourceOrNull(graph, URIs.WithLookupExpression);\r
- WorkModelConfigurationDiagram = getResourceOrNull(graph, URIs.WorkModelConfigurationDiagram);\r
- WorkModuleConfigurationDiagram = getResourceOrNull(graph, URIs.WorkModuleConfigurationDiagram);\r
- WorkSymbol = getResourceOrNull(graph, URIs.WorkSymbol);\r
- WorkforceModuleConfigurationDiagram = getResourceOrNull(graph, URIs.WorkforceModuleConfigurationDiagram);\r
- WorkforceSymbol = getResourceOrNull(graph, URIs.WorkforceSymbol);\r
- angle = getResourceOrNull(graph, URIs.angle);\r
- }\r
- \r
- public static SysdynResource getInstance(ReadGraph graph) {\r
- Session session = graph.getSession();\r
- SysdynResource ret = session.peekService(SysdynResource.class);\r
- if(ret == null) {\r
- ret = new SysdynResource(graph);\r
- session.registerService(SysdynResource.class, ret);\r
- }\r
- return ret;\r
- }\r
- \r
- public static SysdynResource getInstance(Session session) throws DatabaseException {\r
- SysdynResource ret = session.peekService(SysdynResource.class);\r
- if(ret == null) {\r
- ret = session.syncRequest(new Read<SysdynResource>() {\r
- public SysdynResource perform(ReadGraph graph) throws DatabaseException {\r
- return new SysdynResource(graph);\r
- }\r
- });\r
- session.registerService(SysdynResource.class, ret);\r
- }\r
- return ret;\r
- }\r
- \r
-}\r
-\r