Package services.gui

Class ComponentService


  • @Singleton
    public class ComponentService
    extends java.lang.Object
    Service class for JATOS Controllers (not Publix).
    • Method Detail

      • clone

        public Component clone​(Component componentToBeCloned)
        Clones a Component entity. Does not clone id, uuid, or date. Does not persist the clone. Does not clone the HTML file.
      • updateComponentAfterEdit

        public void updateComponentAfterEdit​(Component component,
                                             ComponentProperties updatedProps)
        Update component's properties with the ones from updatedComponent, but not htmlFilePath and not active.
      • cloneWholeComponent

        public Component cloneWholeComponent​(Component component)
        Does the same as cloneComponent and additionally clones the HTML file and changes the title.
      • createAndPersistComponent

        public Component createAndPersistComponent​(Study study,
                                                   Component component)
        Initialise and persist the given Component. Updates its study.
      • createAndPersistComponent

        public Component createAndPersistComponent​(Study study,
                                                   ComponentProperties componentProperties)
        Create and persist a Component with given properties. Updates its study.
      • renameHtmlFilePath

        public void renameHtmlFilePath​(Component component,
                                       java.lang.String newHtmlFilePath,
                                       boolean htmlFileRename)
                                throws java.io.IOException
        Renames the path to the HTML file in the file system and persists the component's property.
        Throws:
        java.io.IOException
      • validate

        public void validate​(Component component)
                      throws javax.validation.ValidationException
        Validates the component by using the Component's model validation method. Throws ValidationException in case of an error.
        Throws:
        javax.validation.ValidationException
      • remove

        public void remove​(Component component,
                           User signedinUser)
        Remove Component: Remove it from the given study, remove all its ComponentResults, and remove the component itself.
      • getComponentFromIdOrUuid

        public Component getComponentFromIdOrUuid​(java.lang.String idOrUuid)