Class RDHelper


  • public class RDHelper
    extends Object
    Author:
    Niko Siltala
    • Constructor Detail

      • RDHelper

        public RDHelper​(ResourceDescription rd)
        Parameters:
        rd - Resource Description(RD) used for this helper
    • Method Detail

      • setRd

        public void setRd​(ResourceDescription rd)
        Parameters:
        rd - the Resource Description(RD) to set
      • generateRdId

        public String generateRdId()
        Generates ID for the RD by using UUID
        Returns:
        Valid unique ID for a RD.
      • generateRdId_fromStructure

        public String generateRdId_fromStructure​(String company,
                                                 String name,
                                                 String type,
                                                 String variant,
                                                 String version)
        Generates structure based ID for a RD. Valid ID must be at least 5 character long.
        Parameters:
        company -
        name -
        type -
        variant -
        version -
        Returns:
        Generated ID
      • generateRdId_fromRDData

        public String generateRdId_fromRDData()
        Generates structure based ID for a RD. Uses RD's content. Valid ID must be at least 5 character long.
        Returns:
        Generated ID
      • updateRdId

        public String updateRdId​(String id,
                                 boolean updateResources)
        Updates the RD ID and optionally also Resource IDs. ID should start with the prefix for RD.
        Parameters:
        id - ID used for update
        updateResources - = True => also Resource IDs will be updated by the given ID + separator + running integer.
        Returns:
        ID used for updating the RD ID.
      • getHelper_Resource

        public RDHelper_Resource getHelper_Resource()
        Creates ResourceCT helper for the first ResourceCT. This can be used if RD contains only one ResourceCT.
        Returns:
        ResourceCT helper
      • getHelper_Resource

        public RDHelper_Resource getHelper_Resource​(int idx)
        Creates ResourceCT helper for the specific Resource. Resources index is given as argument.
        Parameters:
        idx - index of the resource.
        Returns:
        Helper for ResourceCT
      • getHandle_StdBodies

        public StdBodies getHandle_StdBodies()
        Gets handle to the standardisation bodies list
        Returns:
        object containing the standardisation bodies
      • getIdList_StdBody_Names

        public Map<String,​String> getIdList_StdBody_Names()
        Gets Id, name list of standardisation bodies defined in this RD
        Returns:
        Map(id as key, stdBody name as value). null if no matches are found.
      • create_StdBody

        public StdBody create_StdBody()
        Creates empty StdBody instance
        Returns:
        StdBody
      • generateStdBodyId

        public String generateStdBodyId()
        Deprecated.
        Generates ID for the StdBody by using UUID. This should not be used, because linking of std bodies gets more difficult. Use instead generateStdBodyId_fromStructure(java.lang.String)
        Returns:
        Valid unique ID for a Std Body.
      • generateStdBodyId_fromStructure

        public String generateStdBodyId_fromStructure​(String name)
        Generates structure based ID for a Std Body. Valid ID must be at least 9 character long.
        Parameters:
        name - name of the standardisation body.
        Returns:
        Generated ID. Null if name is not given or not defined.
      • generateStdBodyId_fromStdBodyData

        public String generateStdBodyId_fromStdBodyData​(StdBody stdBody)
        Generates structure based ID for a Std Body. Uses std body's content. Valid ID must be at least 5 character long.
        Returns:
        Generated ID
      • updateOrAdd_StdBody

        public StdBody updateOrAdd_StdBody​(StdBody stdBody)
        Updates or adds the given StdBody on the list.
        Parameters:
        stdBody - StdBody information to be added or updated on the list
        Returns:
        object that is updated/added
      • getById_StdBody

        public Object getById_StdBody​(String id)
        Finds standardisation body by its ID and returns that object on the list.
        Parameters:
        id - id of the std body
        Returns:
        StdBody or StdBodyLink object
      • getHandle_IfStds

        public InterfaceStds getHandle_IfStds()
        Gets handle to the standards list of this RD
        Returns:
        object containing the standards for this RD
      • getIdList_IfStd_Names

        public Map<String,​String> getIdList_IfStd_Names()
        Gets Id, name list of interface standards defined in this RD
        Returns:
        Map(id as key, standard's name as value). null if no matches are found.
      • create_IfStd

        public InterfaceStdCT create_IfStd()
        Creates empty IfStd instance
        Returns:
        IfStd
      • generateIfStdId

        public String generateIfStdId()
        Generates ID for the interface standard by using UUID
        Returns:
        Valid unique ID for a IfStd.
      • generateIfStdId_fromIfStdData

        public String generateIfStdId_fromIfStdData​(InterfaceStdCT std)
        Generates structure based ID for a interface standard. Uses IfStd's content. Valid ID must be at least 5 character long.
        Returns:
        Generated ID
      • generateIfStdId_fromStructure

        public String generateIfStdId_fromStructure​(String code,
                                                    String part,
                                                    String year,
                                                    String version)
        Generates structure based ID for a interface standard. Valid ID must be at least 5 character long.
        Parameters:
        code - Code of the standard. This is mandatory input.
        part -
        year -
        version -
        Returns:
        Generated ID. Null if Code is not defined.
      • generateIfStdId_fromFullCode

        public String generateIfStdId_fromFullCode​(String fullCode)
        Generates structure based ID for a interface standard. Uses full code of standard as input.
        Parameters:
        fullCode - Expects full code of Interface Standard. E.g. IEC_61131-3:2011v1-0
        Returns:
        Normalised ID for a standard. e.g. std.IEC_61131-3_2011v1-0
      • generateFullCodeOfIfStd_fromIfStdData

        public String generateFullCodeOfIfStd_fromIfStdData​(InterfaceStdCT std)
        Generates and normalises interface standard's full code by using IfStd's content.
        Returns:
        generated full std code. Null if code is empty or not defined.
      • generateFullCodeOfIfStd

        public String generateFullCodeOfIfStd​(String code,
                                              String part,
                                              String year,
                                              String version)
        Generates and normalises interface standard's full code. In the minimum the code must be given. Examples of valid end results: ISO_9401-2:2001, DIN_34562, IEC_61131-3:2011v1-0
        Parameters:
        code - Code of the standard. This is mandatory input. e.g. ISO 9401, DIN_23456
        part - part of the standard. e.g. 3, 1
        year - year of the standard. e.g. 2001
        version - version of the standard. e.g. 1.0
        Returns:
        Generated full code. Null is returned if code is not given.
      • updateOrAdd_IfStd

        public InterfaceStdCT updateOrAdd_IfStd​(InterfaceStdCT ifStd)
        Updates or adds the given Interface Standard on the list.
        Parameters:
        ifStd - IfStd information to be added or updated on the list
        Returns:
        object that is updated/added
      • getById_IfStd

        public Object getById_IfStd​(String id)
        Finds standard by its ID and returns that object from the list.
        Parameters:
        id - id of the std
        Returns:
        InterfaceStdCT or InterfaceLink object
      • getHandle_AbstIfPorts

        public SharedElementCT.AbstractInterfacePorts getHandle_AbstIfPorts()
        Gets handle to the Abstract interface port list of this RD
        Returns:
        object containing the AbstIfPorts for this RD
      • getIdList_AbstIfPort_Names

        public Map<String,​String> getIdList_AbstIfPort_Names()
        Gets Id, purpose(s) list of AbstractInterfacePorts defined in this RD. If several purposes are defined, they are provided as comma separated list.
        Returns:
        Map(id as key, purpose(s) enumeration(s) as value). null if no matches are found.
      • create_AbstIfPort

        public AbstractInterfacePort create_AbstIfPort()
        Creates an empty AbstractInterfacePort instance. Purpose is not defined, but user needs to define it.
        Returns:
        AbstractInterfacePort
      • getById_AbstIfPort

        public AbstractInterfacePort getById_AbstIfPort​(String id)
        Finds AbstractInterfacePort by its ID and returns that object from the list.
        Parameters:
        id - id of the AbstractInterfacePort
        Returns:
        AbstractInterfacePort. null if id is not found