(4502,5614,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.AuthorWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.editor.client.EditorError;\r\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\r\nimport com.google.gwt.event.dom.client.KeyCodes;\r\nimport com.google.gwt.event.dom.client.KeyDownEvent;\r\nimport com.google.gwt.event.dom.client.KeyDownHandler;\r\nimport com.google.gwt.user.client.ui.Label;\r\nimport com.sencha.gxt.core.client.Style.SelectionMode;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.data.client.editor.ListStoreEditor;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;\r\nimport com.sencha.gxt.widget.core.client.ListView;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.event.DialogHideEvent;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;\r\nimport com.sencha.gxt.widget.core.client.form.FieldLabel;\r\nimport com.sencha.gxt.widget.core.client.form.validator.AbstractValidator;\r\nimport com.sencha.gxt.widget.core.client.form.validator.RegExValidator;\r\nimport com.sencha.gxt.widget.core.client.info.Info;\r\nimport com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent;\r\nimport com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent.SelectionChangedHandler;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.EditionMode;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.String256Properties;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.EditorFieldLabel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.ConfirmDeleteDialog;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.FieldEmptyValidator;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.Author;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\nimport java.util.List;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which can edit the Author model type</b>\r\n * It does an automatic mapping between the Author class\'s attributes name and\r\n * the widget\'s fields name.\r\n * </p>\r\n *\r\n * @see Author\r\n * @see AuthorEditorDriver\r\n * @see EditionMode\r\n */\r\npublic class AuthorEditorWidget extends Composite implements Editor<Author> {\r\n    private static final int FIELDS_HEIGHT = 30;\r\n    private static final int LIST_EDITOR_WIDGET_HEIGHT = 230;\r\n    private static final int LISTS_HEIGHT = 150;\r\n    // class logger\r\n    private static final Logger LOGGER = Logger.getLogger(AuthorEditorWidget.class.getName());\r\n    // instance of the driver for the edition of an author (used for the edition\r\n    // the selected author in authors list)\r\n    private final AuthorEditorDriver authorEditorDriver = GWT.create(AuthorEditorDriver.class);\r\n    /*\r\n     * field to input the authorPerson attribute it is directly mapped by its\r\n     * name on \"authorPerson\" in Author\'s class.\r\n     */\r\n    String256EditorWidget authorPerson = new String256EditorWidget();\r\n    // /////////////////////////////////\r\n    // --- List of institutions\r\n    // /////////////////////////////////\r\n    /*\r\n     * List store to handle the editor on \"List<String> authorInstitutions\" in\r\n	 * Author\'s class. It is used in a listView widget and handle its content.\r\n	 * It inputs the author model authorInsitutions attribute, it is directly\r\n	 * mapped by its name on \"authorInstitutions\" in Author\'s class.\r\n	 */\r\n    ListStoreEditor<String256> authorInstitutions;\r\n    @Ignore\r\n    private ListView<String256, String> listViewAuthInstitutions;\r\n    // Sub editor for an authorInstitution\r\n    @Ignore\r\n    private String256EditorWidget authorInstitution = new String256EditorWidget();\r\n    @Ignore\r\n    private TextButton addInstitutionButton = new TextButton(\"Add\");\r\n    @Ignore\r\n    private TextButton deleteInstitutionButton = new TextButton(\"Delete entry\");\r\n    // /////////////////////////////////\r\n    // --- List of Roles\r\n    // /////////////////////////////////\r\n    /*\r\n     * List store to handle the editor on \"List<String> authorRoles\" in Author\'s\r\n	 * class. It is used in a listView widget and handle its content. It inputs\r\n	 * the author model authorRoles attribute, it is directly mapped by its name\r\n	 * on \"authorRoles\" in Author\'s class.\r\n	 */\r\n    ListStoreEditor<String256> authorRoles;\r\n    @Ignore\r\n    private ListView<String256, String> listViewAuthRoles;\r\n    // Sub Editor for an authorRole\r\n    @Ignore\r\n    private String256EditorWidget authorRole = new String256EditorWidget();\r\n    @Ignore\r\n    private TextButton addRoleButton = new TextButton(\"Add\");\r\n    @Ignore\r\n    private TextButton deleteRoleButton = new TextButton(\"Delete entry\");\r\n    // /////////////////////////////////\r\n    // --- List of Specialties\r\n    // /////////////////////////////////\r\n    /*\r\n     * List store to handle the editor on \"List<String> authorSpecialties\" in\r\n	 * Author\'s class. It is used in a listView widget and handle its content.\r\n	 * It inputs the author mode authorSpecialties attribute, it is directly\r\n	 * mapped by its name on \"authorSpecialties\" in Author\'s class.\r\n	 */\r\n    ListStoreEditor<String256> authorSpecialties;\r\n    @Ignore\r\n    private ListView<String256, String> listViewAuthSpecialties;\r\n    // Sub Editor for an authorSpecialty\r\n    @Ignore\r\n    private String256EditorWidget authorSpecialty = new String256EditorWidget();\r\n    @Ignore\r\n    private TextButton addSpecialtyButton = new TextButton(\"Add\");\r\n    @Ignore\r\n    private TextButton deleteSpecialtyButton = new TextButton(\"Delete entry\");\r\n    // /////////////////////////////////\r\n    // --- List of telecommunications\r\n    // /////////////////////////////////\r\n    /*\r\n     * List store to handle the editor on\r\n	 * \"List<String> authorTelecommunications\" in Author\'s class. It is used in\r\n	 * a listView widget and handle its content. It inputs the author model\r\n	 * authorTelecommunications attribute, it is directly mapped by its name on\r\n	 * \"authorTelecommunications\" in Author\'s class.\r\n	 */\r\n    ListStoreEditor<String256> authorTelecommunications;\r\n    @Ignore\r\n    private ListView<String256, String> listViewAuthTelecommunications;\r\n    // Sub editor for an authorInstitution\r\n    @Ignore\r\n    private String256EditorWidget authorTelecommunication = new String256EditorWidget();\r\n    @Ignore\r\n    private TextButton addTelecommunicationButton = new TextButton(\"Add\");\r\n    @Ignore\r\n    private TextButton deleteTelecommunicationButton = new TextButton(\"Delete entry\");\r\n    /*\r\n     * editionMode is an instance of EditionMode. It is used to know the state\r\n     * of the editor, to know how to display the different fields\r\n     * (enable/disable especially)\r\n     */\r\n    @Ignore\r\n    private EditionMode editionMode = EditionMode.DISPLAY;\r\n    // the author object being edited\r\n    @Ignore\r\n    private Author model;\r\n\r\n    /**\r\n     * AuthorEditorWidget default constructor\r\n     */\r\n    public AuthorEditorWidget() {\r\n        // Instance of String256 AccessProperties with value providers\r\n        final String256Properties props = GWT.create(String256Properties.class);\r\n\r\n        // Author INSTITUTIONS listWidget init\r\n        listViewAuthInstitutions = new ListView<String256, String>(new ListStore<String256>(props.key()), props.string());\r\n        listViewAuthInstitutions.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);\r\n        // init institutions store\r\n        authorInstitutions = new ListStoreEditor<String256>(listViewAuthInstitutions.getStore());\r\n\r\n        // Author ROLES listWidget init\r\n        listViewAuthRoles = new ListView<String256, String>(new ListStore<String256>(props.key()), props.string());\r\n        listViewAuthRoles.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);\r\n        // init roles store\r\n        authorRoles = new ListStoreEditor<String256>(listViewAuthRoles.getStore());\r\n\r\n        // Author SPECIALTIES listWidget init\r\n        listViewAuthSpecialties = new ListView<String256, String>(new ListStore<String256>(props.key()), props.string());\r\n        listViewAuthSpecialties.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);\r\n        // init specialties store\r\n        authorSpecialties = new ListStoreEditor<String256>(listViewAuthSpecialties.getStore());\r\n\r\n        // Author TLECOMMUNICATIONS listWidget init\r\n        listViewAuthTelecommunications = new ListView<String256, String>(new ListStore<String256>(props.key()),\r\n                props.string());\r\n        listViewAuthTelecommunications.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);\r\n        // init telecommunications store\r\n        authorTelecommunications = new ListStoreEditor<String256>(listViewAuthTelecommunications.getStore());\r\n\r\n        // /////////////////////\r\n        // --BuildUI\r\n        // /////////////////////\r\n\r\n        // containers declaration\r\n        VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n        HorizontalLayoutContainer listsContainer = new HorizontalLayoutContainer();\r\n        VerticalLayoutContainer authorInstitutionsContainer = new VerticalLayoutContainer();\r\n        VerticalLayoutContainer authorRolesContainer = new VerticalLayoutContainer();\r\n        VerticalLayoutContainer authorSpecialtiesContainer = new VerticalLayoutContainer();\r\n        VerticalLayoutContainer authorTelecommunicationsContainer = new VerticalLayoutContainer();\r\n\r\n        // Author Person field\r\n        EditorFieldLabel authorPersonLabel = new EditorFieldLabel(authorPerson, \"Author Person\");\r\n        authorPerson.addValidator(new RegExValidator(\"^([A-Za-z]*[0-9]+\\\\^){0,1}[A-z]+(\\\\^{6}&[0-9](\\\\.[0-9])+&ISO$){0,1}\"));\r\n        authorPerson.addValidator(new FieldEmptyValidator(\"author person\"));\r\n\r\n        // ///////////////////////////////////////////////////\r\n        // --- Author Institutions Widget field+listview\r\n        // ///////////////////////////////////////////////////\r\n        HorizontalLayoutContainer hcontainerInstitution = new HorizontalLayoutContainer();\r\n\r\n        FieldLabel institutionLabel = new FieldLabel();\r\n        institutionLabel.setText(\"Institution\");\r\n        authorInstitution\r\n                .addValidator(new RegExValidator(\"[A-Za-z]+(\\\\s[A-Za-z]+)*\" + \"((\\\\^{9}[0-9]+(\\\\.[0-9]+)+)|\"\r\n                        + \"(\\\\^{5}&[0-9]+(\\\\.[0-9]+)+&ISO\\\\^{4}[0-9]+)){0,1}\",\r\n                        \"This value is incorrect for an author institution.\"));\r\n        authorInstitution.setToolTipConfig(new ToolTipConfig(\"Institution format\", \"Examples:<br/>\" + \"Some Hospital<br/>\"\r\n                + \"Some Hospital^^^^^^^^^1.2.3.4.5.6.7.8.9.1789.45<br/>\"\r\n                + \"Some Hospital^^^^^&1.2.3.4.5.6.7.8.9.1789&ISO^^^^45\"));\r\n\r\n        hcontainerInstitution.add(authorInstitution, new HorizontalLayoutData(1, FIELDS_HEIGHT, new Margins(0, 10, 10, 0)));\r\n        authorInstitution.setWidth(\"auto\");\r\n        addInstitutionButton.setWidth(\"auto\");\r\n        hcontainerInstitution.add(addInstitutionButton);\r\n        hcontainerInstitution.setWidth(\"auto\");\r\n\r\n        deleteInstitutionButton.disable();\r\n\r\n        authorInstitutionsContainer.add(institutionLabel, new VerticalLayoutData(1, -1));\r\n        authorInstitutionsContainer.add(hcontainerInstitution, new VerticalLayoutData(1, FIELDS_HEIGHT));\r\n        authorInstitutionsContainer.add(listViewAuthInstitutions, new VerticalLayoutData(1, LISTS_HEIGHT));\r\n        authorInstitutionsContainer.add(deleteInstitutionButton);\r\n\r\n        // ///////////////////////////////////////////////////\r\n        // --- Author Roles Widget field+listview\r\n        // ///////////////////////////////////////////////////\r\n        HorizontalLayoutContainer hcontainerRole = new HorizontalLayoutContainer();\r\n\r\n        FieldLabel roleLabel = new FieldLabel();\r\n        roleLabel.setText(\"Role\");\r\n\r\n        hcontainerRole.add(authorRole, new HorizontalLayoutData(1, FIELDS_HEIGHT, new Margins(0, 10, 10, 0)));\r\n        authorRole.setWidth(\"auto\");\r\n        addRoleButton.setWidth(\"auto\");\r\n        hcontainerRole.add(addRoleButton);\r\n        hcontainerRole.setWidth(\"auto\");\r\n\r\n        deleteRoleButton.disable();\r\n\r\n        authorRolesContainer.add(roleLabel, new VerticalLayoutData(1, -1));\r\n        authorRolesContainer.add(hcontainerRole, new VerticalLayoutData(1, FIELDS_HEIGHT));\r\n        authorRolesContainer.add(listViewAuthRoles, new VerticalLayoutData(1, LISTS_HEIGHT));\r\n        authorRolesContainer.add(deleteRoleButton);\r\n\r\n        // ///////////////////////////////////////////////////\r\n        // --- Author Specialties Widget field+listview\r\n        // ///////////////////////////////////////////////////\r\n        HorizontalLayoutContainer hcontainerSpecialty = new HorizontalLayoutContainer();\r\n\r\n        FieldLabel specialtyLabel = new FieldLabel();\r\n        specialtyLabel.setText(\"Specialty\");\r\n\r\n        hcontainerSpecialty.add(authorSpecialty, new HorizontalLayoutData(1, FIELDS_HEIGHT, new Margins(0, 10, 10, 0)));\r\n        authorSpecialty.setWidth(\"auto\");\r\n        addSpecialtyButton.setWidth(\"auto\");\r\n        hcontainerSpecialty.add(addSpecialtyButton);\r\n        hcontainerSpecialty.setWidth(\"auto\");\r\n\r\n        deleteSpecialtyButton.disable();\r\n\r\n        authorSpecialtiesContainer.add(specialtyLabel, new VerticalLayoutData(1, -1));\r\n        authorSpecialtiesContainer.add(hcontainerSpecialty, new VerticalLayoutData(1, FIELDS_HEIGHT));\r\n        authorSpecialtiesContainer.add(listViewAuthSpecialties, new VerticalLayoutData(1, LISTS_HEIGHT));\r\n        authorSpecialtiesContainer.add(deleteSpecialtyButton);\r\n\r\n        // ///////////////////////////////////////////////////\r\n        // --- Author Telecommunications Widget field+listview\r\n        // ///////////////////////////////////////////////////\r\n        HorizontalLayoutContainer hcontainerTelecommunication = new HorizontalLayoutContainer();\r\n\r\n        FieldLabel telecommunicationLabel = new FieldLabel();\r\n        telecommunicationLabel.setText(\"Telecommunication\");\r\n\r\n        hcontainerTelecommunication.add(authorTelecommunication, new HorizontalLayoutData(1, FIELDS_HEIGHT, new Margins(0, 10, 10, 0)));\r\n        authorTelecommunication.setWidth(\"auto\");\r\n        authorTelecommunication.setToolTipConfig(new ToolTipConfig(\"Telecommunication represents the telecommunications address (e.g., email) of the document or SubmissionSet author.\"));\r\n        addTelecommunicationButton.setWidth(\"auto\");\r\n        authorTelecommunication.addValidator(new AbstractValidator<String>() {\r\n            @Override\r\n            public List<EditorError> validate(Editor<String> editor, String value) {\r\n                List<EditorError> errors = null;\r\n                if (value == null)\r\n                    value = authorTelecommunication.getField().getText();\r\n                if (/* value == null || */!value.matches(\".*@.*\\\\.[a-z]*$\")) {\r\n                    errors = createError(editor, \"Value is not a valid telecommunication email.\", value);\r\n                }\r\n                return errors;\r\n            }\r\n        });\r\n        hcontainerTelecommunication.add(addTelecommunicationButton);\r\n        hcontainerTelecommunication.setWidth(\"auto\");\r\n\r\n        deleteTelecommunicationButton.disable();\r\n\r\n        authorTelecommunicationsContainer.add(telecommunicationLabel, new VerticalLayoutData(1, -1));\r\n        authorTelecommunicationsContainer.add(hcontainerTelecommunication, new VerticalLayoutData(1, FIELDS_HEIGHT));\r\n        authorTelecommunicationsContainer.add(listViewAuthTelecommunications, new VerticalLayoutData(1, LISTS_HEIGHT));\r\n        authorTelecommunicationsContainer.add(deleteTelecommunicationButton);\r\n\r\n        // Add each widget to the main container\r\n        vcontainer.add(authorPersonLabel, new VerticalLayoutData(1, FIELDS_HEIGHT));\r\n        listsContainer.add(authorInstitutionsContainer, new HorizontalLayoutData(0.25, -1, new Margins(0, 10, 0, 0)));\r\n        listsContainer.add(authorRolesContainer, new HorizontalLayoutData(0.25, -1, new Margins(0, 10, 0, 0)));\r\n        listsContainer.add(authorSpecialtiesContainer, new HorizontalLayoutData(0.25, -1, new Margins(0, 10, 0, 0)));\r\n        listsContainer.add(authorTelecommunicationsContainer, new HorizontalLayoutData(0.25, -1, new Margins()));\r\n        vcontainer.add(listsContainer, new VerticalLayoutData(1, LIST_EDITOR_WIDGET_HEIGHT));\r\n\r\n        // init namevaluestring256 with its widgets container\r\n        initWidget(vcontainer);\r\n\r\n        bindUI();\r\n    }\r\n\r\n    private void addAuthorInstitutionToListStore() {\r\n        String s = authorInstitution.getField().getText();\r\n\r\n        if (s != null && !s.isEmpty()) {\r\n            LOGGER.info(\"adding new value (\" + s + \") to list store\");\r\n            String256 v = new String256().setString(s);\r\n            if (!contains(authorInstitutions.getStore(), v)) {\r\n                authorInstitutions.getStore().add(new String256().setString(s));\r\n                authorInstitution.getField().clear();\r\n                authorInstitution.getField().redraw();\r\n            } else {\r\n                Info.display(\"Impossible to add value\", \"It is impossible to add this value. It already is in the list.\");\r\n            }\r\n        }\r\n        authorInstitution.getField().focus();\r\n    }\r\n\r\n    private void addAuthorRoleToListStore() {\r\n        String s = authorRole.getField().getText();\r\n        if (s != null && !s.isEmpty()) {\r\n            LOGGER.info(\"adding new value (\" + s + \") to list store\");\r\n            String256 v = new String256().setString(s);\r\n            if (!contains(authorRoles.getStore(), v)) {\r\n                authorRoles.getStore().add(new String256().setString(s));\r\n                authorRole.getField().clear();\r\n                authorRole.getField().redraw();\r\n            } else {\r\n                Info.display(\"Impossible to add value\", \"It is impossible to add this value. It already is in the list.\");\r\n            }\r\n        }\r\n        authorRole.getField().focus();\r\n    }\r\n\r\n    private void addAuthorSpecialtyToListStore() {\r\n        String s = authorSpecialty.getField().getText();\r\n        if (s != null && !s.isEmpty()) {\r\n            LOGGER.info(\"adding new value (\" + s + \") to list store\");\r\n            String256 v = new String256().setString(s);\r\n            if (!contains(authorSpecialties.getStore(), v)) {\r\n                authorSpecialties.getStore().add(new String256().setString(s));\r\n                authorSpecialty.getField().clear();\r\n            } else {\r\n                Info.display(\"Impossible to add value\", \"It is impossible to add this value. It already is in the list.\");\r\n            }\r\n        }\r\n        authorSpecialty.getField().focus();\r\n    }\r\n\r\n    private void addAuthorTelecommunicationToListStore() {\r\n        String s = authorTelecommunication.getField().getText();\r\n\r\n        if (authorTelecommunication.getField().validate())\r\n            if (s != null && !s.isEmpty()) {\r\n                LOGGER.info(\"adding new value (\" + s + \") to list store\");\r\n                String256 v = new String256().setString(s);\r\n                if (!contains(authorTelecommunications.getStore(), v)) {\r\n                    authorTelecommunications.getStore().add(new String256().setString(s));\r\n                    authorTelecommunication.getField().clear();\r\n                    authorTelecommunication.getField().clearInvalid();\r\n                    authorTelecommunication.getField().redraw();\r\n                } else {\r\n                    Info.display(\"Impossible to add value\", \"It is impossible to add this value. It already is in the list.\");\r\n                }\r\n            }\r\n        authorTelecommunication.getField().focus();\r\n    }\r\n\r\n    /**\r\n     * Method that binds the UI widget\'s actions.\r\n     */\r\n    private void bindUI() {\r\n        // /////////////////////////////\r\n        // --- List selection binding\r\n        // /////////////////////////////\r\n        // institution selection handler\r\n        listViewAuthInstitutions.getSelectionModel().addSelectionChangedHandler(new SelectionChangedHandler<String256>() {\r\n            @Override\r\n            public void onSelectionChanged(SelectionChangedEvent<String256> event) {\r\n                if (listViewAuthInstitutions.isEnabled()) {\r\n                    if (listViewAuthInstitutions.getSelectionModel().getSelectedItem() != null) {\r\n                        deleteInstitutionButton.enable();\r\n                    } else {\r\n                        deleteInstitutionButton.disable();\r\n                    }\r\n                }\r\n            }\r\n        });\r\n        // role selection handler\r\n        listViewAuthRoles.getSelectionModel().addSelectionChangedHandler(new SelectionChangedHandler<String256>() {\r\n            @Override\r\n            public void onSelectionChanged(SelectionChangedEvent<String256> event) {\r\n                if (listViewAuthRoles.isEnabled()) {\r\n                    if (listViewAuthRoles.getSelectionModel().getSelectedItem() != null) {\r\n                        deleteRoleButton.enable();\r\n                    } else {\r\n                        deleteRoleButton.disable();\r\n                    }\r\n                }\r\n            }\r\n        });\r\n        // specialty selection handler\r\n        listViewAuthSpecialties.getSelectionModel().addSelectionChangedHandler(new SelectionChangedHandler<String256>() {\r\n            @Override\r\n            public void onSelectionChanged(SelectionChangedEvent<String256> event) {\r\n                if (listViewAuthSpecialties.isEnabled()) {\r\n                    if (listViewAuthSpecialties.getSelectionModel().getSelectedItem() != null) {\r\n                        deleteSpecialtyButton.enable();\r\n                    } else {\r\n                        deleteSpecialtyButton.disable();\r\n                    }\r\n                }\r\n            }\r\n        });\r\n        // telecommunication selection handler\r\n        listViewAuthTelecommunications.getSelectionModel().addSelectionChangedHandler(\r\n                new SelectionChangedHandler<String256>() {\r\n                    @Override\r\n                    public void onSelectionChanged(SelectionChangedEvent<String256> event) {\r\n                        if (listViewAuthTelecommunications.isEnabled()) {\r\n                            if (listViewAuthTelecommunications.getSelectionModel().getSelectedItem() != null) {\r\n                                deleteTelecommunicationButton.enable();\r\n                            } else {\r\n                                deleteTelecommunicationButton.disable();\r\n                            }\r\n                        }\r\n                    }\r\n                });\r\n\r\n        // ////////////////////////////////////////////////////\r\n        // --- Add and delete value from lists handlers\r\n        // ////////////////////////////////////////////////////\r\n\r\n        // Add Institution value handlers\r\n        addInstitutionButton.addSelectHandler(new SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                addAuthorInstitutionToListStore();\r\n            }\r\n        });\r\n        authorInstitution.getField().addKeyDownHandler(new KeyDownHandler() {\r\n\r\n            @Override\r\n            public void onKeyDown(KeyDownEvent event) {\r\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\r\n                    LOGGER.info(\"ENTER KEY PRESSED on Institution Field\");\r\n                    addAuthorInstitutionToListStore();\r\n                }\r\n            }\r\n        });\r\n        // Delete Institution Value handler\r\n        deleteInstitutionButton.addSelectHandler(new SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmDeleteDialog cdd = new ConfirmDeleteDialog(listViewAuthInstitutions.getSelectionModel().getSelectedItem().getString());\r\n                cdd.show();\r\n                cdd.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == PredefinedButton.YES) {\r\n                            // perform YES action\r\n                            authorInstitutions.getStore().remove(listViewAuthInstitutions.getSelectionModel().getSelectedItem());\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n\r\n        // Add Role value handlers\r\n        addRoleButton.addSelectHandler(new SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                addAuthorRoleToListStore();\r\n            }\r\n        });\r\n        authorRole.getField().addKeyDownHandler(new KeyDownHandler() {\r\n\r\n            @Override\r\n            public void onKeyDown(KeyDownEvent event) {\r\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\r\n                    LOGGER.info(\"ENTER KEY PRESSED on Role Field\");\r\n                    addAuthorRoleToListStore();\r\n                }\r\n            }\r\n        });\r\n        // Delete Role Value handler\r\n        deleteRoleButton.addSelectHandler(new SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmDeleteDialog cdd = new ConfirmDeleteDialog(listViewAuthRoles.getSelectionModel().getSelectedItem().getString());\r\n                cdd.show();\r\n                cdd.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == PredefinedButton.YES) {\r\n                            // perform YES action\r\n                            authorRoles.getStore().remove(listViewAuthRoles.getSelectionModel().getSelectedItem());\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n\r\n        // Add Specialty value handlers\r\n        addSpecialtyButton.addSelectHandler(new SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                addAuthorSpecialtyToListStore();\r\n            }\r\n        });\r\n        authorSpecialty.getField().addKeyDownHandler(new KeyDownHandler() {\r\n\r\n            @Override\r\n            public void onKeyDown(KeyDownEvent event) {\r\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\r\n                    LOGGER.info(\"ENTER KEY PRESSED on Specialty field\");\r\n                    addAuthorSpecialtyToListStore();\r\n                }\r\n            }\r\n        });\r\n        // Delete Specialty Value handler\r\n        deleteSpecialtyButton.addSelectHandler(new SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmDeleteDialog cdd = new ConfirmDeleteDialog(listViewAuthSpecialties.getSelectionModel().getSelectedItem().getString());\r\n                cdd.show();\r\n                cdd.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == PredefinedButton.YES) {\r\n                            // perform YES action\r\n                            authorSpecialties.getStore().remove(listViewAuthSpecialties.getSelectionModel().getSelectedItem());\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n        // Add Telecommunication value handlers\r\n        addTelecommunicationButton.addSelectHandler(new SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                addAuthorTelecommunicationToListStore();\r\n            }\r\n        });\r\n        authorTelecommunication.getField().addKeyDownHandler(new KeyDownHandler() {\r\n\r\n            @Override\r\n            public void onKeyDown(KeyDownEvent event) {\r\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\r\n                    LOGGER.info(\"ENTER KEY PRESSED on Telecommunication field\");\r\n                    addAuthorTelecommunicationToListStore();\r\n                }\r\n            }\r\n        });\r\n        // Delete Telecommunication Value handler\r\n        deleteTelecommunicationButton.addSelectHandler(new SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmDeleteDialog cdd = new ConfirmDeleteDialog(listViewAuthTelecommunications.getSelectionModel()                        .getSelectedItem().getString());\r\n                cdd.show();\r\n                cdd.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == PredefinedButton.YES) {\r\n                            // perform YES action\r\n                            authorTelecommunications.getStore().remove(listViewAuthTelecommunications.getSelectionModel().getSelectedItem());\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Method to check if a list of String256 contains a specific value.\r\n     *\r\n     * @param list list of String256 values\r\n     * @param str  value to look for in above list\r\n     * @return\r\n     */\r\n    private boolean contains(ListStore<String256> list, String256 str) {\r\n        for (String256 s : list.getAll()) {\r\n            if (s.getString().equals(str.getString())) {\r\n                return true;\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n\r\n    /**\r\n     * This method handle the edition of a given author. It fill the editor with\r\n     * the author\'s details and put it in edition.\r\n     *\r\n     * @param author The Author which will be edited.\r\n     */\r\n    public void edit(Author author) {\r\n        // authorEditorDriver.getErrors().clear();\r\n        resetWidgets();\r\n        setModel(author);\r\n        authorEditorDriver.edit(author);\r\n    }\r\n\r\n    /**\r\n     * Method to start the edition of a new Author.\r\n     */\r\n    public void editNew() {\r\n        // authorEditorDriver.getErrors().clear();\r\n        model = new Author();\r\n        edit(model);\r\n        resetWidgets();\r\n    }\r\n\r\n    /**\r\n     * Method to check if errors remain in the author editor.\r\n     *\r\n     * @return hasErrors boolean\r\n     */\r\n    public boolean hasErrors() {\r\n        return authorEditorDriver.hasErrors();\r\n    }\r\n\r\n    /**\r\n     * This method init the author editor driver. It must be called when the\r\n     * view is created.\r\n     */\r\n    public void initEditorDriver() {\r\n        authorEditorDriver.initialize(this);\r\n    }\r\n\r\n    /**\r\n     * This method clears the fields to add values in lists roles, institutions\r\n     * and specialties.\r\n     */\r\n    private void resetWidgets() {\r\n        authorTelecommunication.getField().clear();\r\n        authorPerson.getField().clear();\r\n        authorInstitution.getField().clear();\r\n        authorRole.getField().clear();\r\n        authorSpecialty.getField().clear();\r\n    }\r\n\r\n    /**\r\n     * Method that saves the changes in the Editor GUI in editor\'s model object\r\n     */\r\n    public void save() {\r\n        model = authorEditorDriver.flush();\r\n        if (authorEditorDriver.hasErrors()) {\r\n            Dialog d = new Dialog();\r\n            d.setHeadingText(\"Errors dialog\");\r\n            d.setPredefinedButtons(PredefinedButton.YES, PredefinedButton.NO);\r\n            d.setBodyStyleName(\"pad-text\");\r\n            d.add(new Label(authorEditorDriver.getErrors().toString()));\r\n            d.getBody().addClassName(\"pad-text\");\r\n            d.setHideOnButtonClick(true);\r\n            d.setWidth(300);\r\n            d.show();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Convenience function for setting disabled/enabled by boolean.\r\n     *\r\n     * @param enabled the enabled state\r\n     */\r\n    private void setWidgetEnable(boolean enabled) {\r\n        authorPerson.getField().setEnabled(enabled);\r\n        authorInstitution.getField().setEnabled(enabled);\r\n        listViewAuthInstitutions.setEnabled(enabled);\r\n        authorRole.getField().setEnabled(enabled);\r\n        listViewAuthRoles.setEnabled(enabled);\r\n        authorSpecialty.getField().setEnabled(enabled);\r\n        listViewAuthSpecialties.setEnabled(enabled);\r\n        authorTelecommunication.getField().setEnabled(enabled);\r\n        listViewAuthTelecommunications.setEnabled(enabled);\r\n        addInstitutionButton.setEnabled(enabled);\r\n        addRoleButton.setEnabled(enabled);\r\n        addSpecialtyButton.setEnabled(enabled);\r\n        addTelecommunicationButton.setEnabled(enabled);\r\n        if (listViewAuthSpecialties.getSelectionModel().getSelectedItem() != null\r\n                || !listViewAuthSpecialties.getSelectionModel().getSelectedItems().isEmpty()) {\r\n            deleteSpecialtyButton.setEnabled(enabled);\r\n        }\r\n        if (listViewAuthRoles.getSelectionModel().getSelectedItem() != null\r\n                || !listViewAuthRoles.getSelectionModel().getSelectedItems().isEmpty()) {\r\n            deleteRoleButton.setEnabled(enabled);\r\n        }\r\n        if (listViewAuthInstitutions.getSelectionModel().getSelectedItem() != null\r\n                || !listViewAuthInstitutions.getSelectionModel().getSelectedItems().isEmpty()) {\r\n            deleteInstitutionButton.setEnabled(enabled);\r\n        }\r\n        if (listViewAuthTelecommunications.getSelectionModel().getSelectedItem() != null\r\n                || !listViewAuthTelecommunications.getSelectionModel().getSelectedItems().isEmpty()) {\r\n            deleteTelecommunicationButton.setEnabled(enabled);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @return Current editionMode (state of the editor)\r\n     * @see EditionMode\r\n     */\r\n    public EditionMode getEditionMode() {\r\n        return editionMode;\r\n    }\r\n\r\n    /**\r\n     * Method to change the editor layout regarding an edition Mode. It actually\r\n     * enable/disable the various widgets of the editor regarding the state of\r\n     * edition.\r\n     *\r\n     * @param editionMode EditionMode (NODATA,DISPLAY,NEW,EDIT)\r\n     * @see EditionMode\r\n     */\r\n    public void setEditionMode(EditionMode editionMode) {\r\n        this.editionMode = editionMode;\r\n        if (editionMode.equals(EditionMode.DISPLAY) || editionMode.equals(EditionMode.NODATA)) {\r\n            setWidgetEnable(false);\r\n        } else if (editionMode.equals(EditionMode.NEW) || editionMode.equals(EditionMode.EDIT)) {\r\n            setWidgetEnable(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Method to get the edited author. Should be called after save().\r\n     *\r\n     * @return edited Author\r\n     */\r\n    public Author getModel() {\r\n        return model;\r\n    }\r\n\r\n    /**\r\n     * . Simple setter method for AuthorEditorWidget\'s model>\r\n     *\r\n     * @param model author object to be edited.\r\n     */\r\n    private void setModel(Author model) {\r\n        this.model = model;\r\n    }\r\n\r\n    /**\r\n     * The AuthorEditorDriver is the editr driver interface which handle the\r\n     * edition of an Author through AuthorEditorWidget.\r\n     *\r\n     * @see Author\r\n     * @see AuthorEditorWidget\r\n     */\r\n    interface AuthorEditorDriver extends SimpleBeanEditorDriver<Author, AuthorEditorWidget> {\r\n    }\r\n\r\n}\r\n'),(4503,5615,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.AuthorWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.user.client.ui.IsWidget;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.core.client.Style;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.data.client.editor.ListStoreEditor;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.ListView;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.SimpleContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.DialogHideEvent;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.form.FieldSet;\r\nimport com.sencha.gxt.widget.core.client.info.Info;\r\nimport com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.EditionMode;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.AuthorProperties;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.ConfirmDeleteDialog;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.Author;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which can edit a list of Authors</b>\r\n * It uses the AuthorEditorWidget to edit an entry of the list.\r\n * </p>\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.shared.model.Author\r\n * @see gov.nist.hit.ds.docentryeditor.client.editor.EditionMode\r\n * @see gov.nist.hit.ds.docentryeditor.client.editor.widgets.AuthorWidgets.AuthorEditorWidget\r\n */\r\npublic class AuthorsListEditorWidget extends ListStoreEditor<Author> implements IsWidget {\r\n    // instance of the property access for the Author entity attributes (for the GXT Store).\r\n    @Ignore\r\n    private static final AuthorProperties AUTHOR_PROPERTIES = GWT.create(AuthorProperties.class);\r\n    // Widget\'s container.\r\n    @Ignore\r\n    private SimpleContainer authorGridEditorWidget;\r\n\r\n    // Widget that handles the list of Authors.\r\n    @Ignore\r\n    private ListView<Author, String> listViewAuthors;\r\n\r\n    // ///////////////////////////////////////////////////////////////////////\r\n    // ---- AUTHOR WIDGETS\r\n    // ///////////////////////////////////////////////////////////////////////\r\n    // Widget to edit a selected entry of the list of Authors.\r\n    @Ignore\r\n    private AuthorEditorWidget author;\r\n    // Buttons to handle actions on the list of authors.\r\n    @Ignore\r\n    private TextButton newAuthorWidget = new TextButton(\"New entry\");\r\n    @Ignore\r\n    private TextButton editAuthorWidget = new TextButton(\"Edit entry\");\r\n    @Ignore\r\n    private TextButton saveAuthorWidget = new TextButton(\"Save entry\");\r\n    @Ignore\r\n    private TextButton cancelAuthorWidget = new TextButton(\"Cancel\");\r\n    @Ignore\r\n    private TextButton deleteAuthorWidget = new TextButton(\"Delete entry\");\r\n\r\n    /**\r\n     * Widget\'s default constuctor.\r\n     */\r\n    public AuthorsListEditorWidget() {\r\n        super(new ListStore<Author>(AUTHOR_PROPERTIES.key()));\r\n        buildUI();\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Method to build an authors editor widget with author sub-editor\r\n     *\r\n     * @return authors editor widget w/ sub-editor\r\n     */\r\n    private void buildUI() {\r\n        listViewAuthors = new ListView<Author, String>(this.getStore(), AUTHOR_PROPERTIES.authorPerson());\r\n        // set the list selection mode to one single entry selected at a time.\r\n        listViewAuthors.getSelectionModel().setSelectionMode(Style.SelectionMode.SINGLE);\r\n\r\n        FieldSet authorFS = new FieldSet();\r\n        authorFS.setHeadingText(\"Author Entry\");\r\n        author=new AuthorEditorWidget();\r\n        authorFS.add(author);\r\n        author.setEditionMode(EditionMode.NODATA);\r\n\r\n        ContentPanel authorCP = new ContentPanel();\r\n        authorCP.setHeaderVisible(false);\r\n        authorCP.setBorders(false);\r\n        authorCP.setBodyBorder(false);\r\n        enableAuthorButtonWidgets(EditionMode.NODATA);\r\n        authorCP.addButton(newAuthorWidget);\r\n        authorCP.addButton(editAuthorWidget);\r\n        authorCP.addButton(saveAuthorWidget);\r\n        authorCP.addButton(cancelAuthorWidget);\r\n        authorCP.addButton(deleteAuthorWidget);\r\n        authorCP.setButtonAlign(BoxLayoutContainer.BoxLayoutPack.END);\r\n\r\n        VerticalLayoutContainer vcon = new VerticalLayoutContainer();\r\n        vcon.add(listViewAuthors, new VerticalLayoutContainer.VerticalLayoutData(1, 150));\r\n        vcon.add(authorFS, new VerticalLayoutContainer.VerticalLayoutData(0.999, -1, new Margins(10, 0, 0, 0)));\r\n        vcon.add(authorCP, new VerticalLayoutContainer.VerticalLayoutData(-1, 30));\r\n        authorGridEditorWidget = new SimpleContainer();\r\n        authorGridEditorWidget.setHeight(485);\r\n        authorGridEditorWidget.add(vcon);\r\n    }\r\n\r\n    /**\r\n     * Method that binds the widgets composing this AuthorsListEditorWidget\r\n     * to their action handlers.\r\n     */\r\n    private void bindUI() {\r\n        // Author entry select handler for the list of authors.\r\n        listViewAuthors.getSelectionModel().addSelectionChangedHandler(new SelectionChangedEvent.SelectionChangedHandler<Author>() {\r\n\r\n            @Override\r\n            public void onSelectionChanged(SelectionChangedEvent<Author> event) {\r\n                if (listViewAuthors.getSelectionModel().getSelectedItem() != null) {\r\n                    // set the widget into display mode (editable fields disabled).\r\n                    author.setEditionMode(EditionMode.DISPLAY);\r\n                    // set the object (selected entry in the list) that must be handled.\r\n                    // by the AuthorEditorWidget\r\n                    author.edit(listViewAuthors.getSelectionModel().getSelectedItem());\r\n                    // set the widget into edition mode (editable fields enabled).\r\n                    author.setEditionMode(EditionMode.EDIT);\r\n                    // set the list action buttons in edition mode (edit button disabled).\r\n                    enableAuthorButtonWidgets(EditionMode.EDIT);\r\n                } else {\r\n                    // set the widget into NODATA selected mode (editable fields disabled).\r\n                    author.setEditionMode(EditionMode.NODATA);\r\n                    // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                    enableAuthorButtonWidgets(EditionMode.NODATA);\r\n                }\r\n            }\r\n        });\r\n        // action handler for click on new entry button.\r\n        newAuthorWidget.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                // start the edition of a new Author instance.\r\n                editNewAuthor();\r\n            }\r\n        });\r\n        // action handler for the click on the edit button.\r\n        editAuthorWidget.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                // set the widget into edition mode (editable fields enabled).\r\n                author.setEditionMode(EditionMode.EDIT);\r\n                // set the list action buttons in edition mode (edit button disabled).\r\n                enableAuthorButtonWidgets(EditionMode.EDIT);\r\n            }\r\n        });\r\n        // action handler for the click on the cancel button during edition.\r\n        cancelAuthorWidget.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                author.setEditionMode(EditionMode.NODATA);\r\n                // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                enableAuthorButtonWidgets(EditionMode.NODATA);\r\n                // deselect the entity in edition (deselect all)\r\n                listViewAuthors.getSelectionModel().deselectAll();\r\n                // set a new instance of author to the widget to empty the fields.\r\n                author.editNew();\r\n            }\r\n        });\r\n        // action handler for the click on the delete button during edition. (delete select author entry)\r\n        deleteAuthorWidget.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                // Show a confirmation dialog to confirm the object deletion.\r\n                final ConfirmDeleteDialog cdd = new ConfirmDeleteDialog(listViewAuthors.getSelectionModel().getSelectedItem().getAuthorPerson()\r\n                        .getString());\r\n                cdd.show();\r\n                cdd.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        // If YES button is click then deletion is performed.\r\n                        if (event.getHideButton() == Dialog.PredefinedButton.YES) {\r\n                            getStore().remove(listViewAuthors.getSelectionModel().getSelectedItem());\r\n                            author.editNew();\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n        // action handler for the click on the save button.\r\n        saveAuthorWidget.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                // save the author entry in edition.\r\n                author.save();\r\n                // If the author entry edition widget is in NEW edition mode,\r\n                if (author.getEditionMode().equals(EditionMode.NEW)) {\r\n                    // we check if the author created already exists in the list.\r\n                    boolean isAlreadyThere = false;\r\n                    for (Author a : getStore().getAll()) {\r\n                        if (a.getAuthorPerson().getString().equals(author.getModel().getAuthorPerson().getString())) {\r\n                            isAlreadyThere = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    // if it does exists\r\n                    if (isAlreadyThere) {\r\n                        Info.display(\"Impossible to add this value\",\r\n                                \"This author person already exists for this document. You can not add him again.\");\r\n                    // otherwise\r\n                    } else if (author.hasErrors()) {\r\n                        Info.display(\"Impossible to add this value\", \"There still are errors in the editor.\");\r\n                    } else {\r\n                        // add the new entity to the store\r\n                        getStore().add(author.getModel());\r\n                        // set a new instance of Author to the author entity edition widget to clear all fields.\r\n                        author.editNew();\r\n                        // deselect all authors\r\n                        listViewAuthors.getSelectionModel().deselectAll();\r\n                        // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                        author.setEditionMode(EditionMode.NODATA);\r\n                        // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                        enableAuthorButtonWidgets(EditionMode.NODATA);\r\n                    }\r\n                // if the edition mode is in EDITion\r\n                } else if (author.getEditionMode().equals(EditionMode.EDIT)) {\r\n                    // update the selected entity in the store\r\n                    getStore().update(author.getModel());\r\n                    // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                    author.setEditionMode(EditionMode.NODATA);\r\n                    // set the list action buttons in NODATA selected mode (Only the new button is enabled).\r\n                    enableAuthorButtonWidgets(EditionMode.NODATA);\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Method that enables/disables the author list action buttons regarding a EditionMode\r\n     *\r\n     * @see gov.nist.hit.ds.docentryeditor.client.editor.EditionMode\r\n     * @param editionMode\r\n     */\r\n    private void enableAuthorButtonWidgets(EditionMode editionMode) {\r\n        if (editionMode.equals(EditionMode.NODATA) || editionMode.equals(EditionMode.DISPLAY)) {\r\n            newAuthorWidget.setEnabled(true);\r\n            saveAuthorWidget.setEnabled(false);\r\n            cancelAuthorWidget.setEnabled(false);\r\n        }\r\n        if (editionMode.equals(EditionMode.NODATA)) {\r\n            editAuthorWidget.setEnabled(false);\r\n            deleteAuthorWidget.setEnabled(false);\r\n        }\r\n        if (editionMode.equals(EditionMode.DISPLAY)) {\r\n            deleteAuthorWidget.setEnabled(true);\r\n            editAuthorWidget.setEnabled(true);\r\n        }\r\n        if (editionMode.equals(EditionMode.NEW) || editionMode.equals(EditionMode.EDIT)) {\r\n            editAuthorWidget.setEnabled(false);\r\n            saveAuthorWidget.setEnabled(true);\r\n            cancelAuthorWidget.setEnabled(true);\r\n            deleteAuthorWidget.setEnabled(true);\r\n        }\r\n        if (editionMode.equals(EditionMode.NEW)) {\r\n            newAuthorWidget.setEnabled(false);\r\n        }\r\n        if (editionMode.equals(EditionMode.EDIT)) {\r\n            newAuthorWidget.setEnabled(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Method that start the edition of a new instance of Author.\r\n     */\r\n    public void editNewAuthor() {\r\n        listViewAuthors.getSelectionModel().deselectAll();\r\n        author.setEditionMode(EditionMode.NEW);\r\n        author.editNew();\r\n        enableAuthorButtonWidgets(EditionMode.NEW);\r\n    }\r\n\r\n    /**\r\n     * Method that returns the AuthorsListEditor as a Widget.\r\n     * @return AuthorsListEditorWidget\r\n     */\r\n    @Override\r\n    public Widget asWidget() {\r\n        return authorGridEditorWidget;\r\n    }\r\n\r\n    /**\r\n     * Getter that returns the list widget.\r\n     * @return list of authors widget\r\n     */\r\n    @Ignore\r\n    public ListView<Author, String> getListView(){\r\n        return listViewAuthors;\r\n    }\r\n\r\n    /**\r\n     * Getter that returns the author entity editor widget.\r\n     * @see gov.nist.hit.ds.docentryeditor.client.editor.widgets.AuthorWidgets.AuthorEditorWidget\r\n     * @return authorEditorWidget - Widget that edits a selected author entity.\r\n     */\r\n    @Ignore\r\n    public AuthorEditorWidget getAuthorWidget(){\r\n        return author;\r\n    }\r\n}\r\n'),(4504,5617,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\r\nimport com.google.gwt.user.client.ui.Composite;\r\nimport com.google.gwt.user.client.ui.Label;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.EditionMode;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.EditorFieldLabel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodedTerm;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches CodedTerm model type</b>\r\n * </p>\r\n */\r\n// FIXME for resize purpose I think I need to extends AbstractView in every classes that implements Editor to use pathToWidgetMap\r\npublic class CodedTermEditorWidget extends Composite implements Editor<CodedTerm> {\r\n    // instance of the driver for the edition of a coded term\r\n    @Ignore\r\n    private CodedTermEditorDriver codedTermEditorDriver = GWT.create(CodedTermEditorDriver.class);\r\n    /*\r\n     * editionMode is an instance of EditionMode. It is used to know the state\r\n     * of the editor, to know how to display the different fields\r\n     * (enable/disable especially)\r\n     */\r\n    @Ignore\r\n    private EditionMode editionMode = EditionMode.NODATA;\r\n    // the CodedTerm object being edited\r\n    @Ignore\r\n    private CodedTerm model;\r\n    // --- UI Widgets\r\n    private VerticalLayoutContainer codedTermEditorVContainer = new VerticalLayoutContainer();\r\n    // Fields\r\n    String256EditorWidget displayName = new String256EditorWidget();\r\n    String256EditorWidget code = new String256EditorWidget();\r\n    CodingSchemeEditorWidget codingScheme = new CodingSchemeEditorWidget();\r\n\r\n    /**\r\n     * CodedTerm Editor widget default constructor.\r\n     */\r\n    public CodedTermEditorWidget() {\r\n        buildUI();\r\n    }\r\n\r\n    /**\r\n     * Method that builds the UI.\r\n     */\r\n    private void buildUI() {\r\n        initWidget(codedTermEditorVContainer);\r\n\r\n        EditorFieldLabel displayNameLabel = new EditorFieldLabel(displayName, \"Display Name\");\r\n        EditorFieldLabel codeLabel = new EditorFieldLabel(code, \"Code\");\r\n        EditorFieldLabel codingSchemeLabel = new EditorFieldLabel(codingScheme, \"Coding Scheme\");\r\n\r\n        // setAllowBlanks(false, false, false);\r\n        setEmptyTexts(\"ex: General Medicine\", \"ex: Outpatient\", \"ex: urn:uuid:vvvh6285-8b07-6s88-f36d-df545z654jgf\");\r\n        setToolTipConfigs(new ToolTipConfig(\"Display Name is a string\", \"it should contain less than 256 characters\"), new ToolTipConfig(\r\n                \"Code is a string\", \"it should contain less than 256 characters\"), new ToolTipConfig(\"Coding Scheme is a string\",\r\n                \"it should contain less than 256 characters\"));\r\n        codedTermEditorVContainer.add(displayNameLabel, new VerticalLayoutData(1, -1));\r\n        codedTermEditorVContainer.add(codeLabel, new VerticalLayoutData(1, -1));\r\n        codedTermEditorVContainer.add(codingSchemeLabel, new VerticalLayoutData(1, -1));\r\n    }\r\n\r\n    /**\r\n     * Method that initializes the editor driver for CodedCodedTerm (GWT Editor Framework).\r\n     */\r\n    public void initEditorDriver() {\r\n        codedTermEditorDriver.initialize(this);\r\n    }\r\n\r\n    /**\r\n     * Method that starts the edition of a specific codedTerm.\r\n     * @param codedTerm\r\n     */\r\n    public void edit(CodedTerm codedTerm) {\r\n        resetWidgets();\r\n        setModel(codedTerm);\r\n        codedTermEditorDriver.edit(codedTerm);\r\n    }\r\n\r\n    /**\r\n     * Method that starts the edition of a new instance of CodedTerm.\r\n     */\r\n    public void editNew() {\r\n        model = new CodedTerm();\r\n        edit(model);\r\n        resetWidgets();\r\n    }\r\n\r\n    /**\r\n     * Method that clears all editable fields of the widget.\r\n     */\r\n    private void resetWidgets() {\r\n        displayName.getField().clear();\r\n        code.getField().clear();\r\n        codingScheme.codingScheme.getField().clear();\r\n    }\r\n\r\n    /**\r\n     * Method to rollback every changes. Cancel changes.\r\n     */\r\n    public void rollbackChanges() {\r\n        switch (editionMode) {\r\n            case NEW:\r\n                resetEditor();\r\n                break;\r\n            case EDIT:\r\n                resetEditor();\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * This method reset this widget to its initial state\r\n     * w/ no data selected.\r\n     */\r\n    private void resetEditor() {\r\n        setEditionMode(EditionMode.NODATA);\r\n        model = null;\r\n        codedTermEditorDriver.edit(model);\r\n    }\r\n\r\n    /**\r\n     * Method that saves the changes made to a coded term\r\n     * entity in this editor widget.\r\n     * @return saved codedTerm\r\n     */\r\n    public CodedTerm save() {\r\n        model = codedTermEditorDriver.flush();\r\n        if (codedTermEditorDriver.hasErrors()) {\r\n            Dialog d = new Dialog();\r\n            d.setHeadingText(\"Errors dialog\");\r\n            d.setPredefinedButtons(PredefinedButton.YES, PredefinedButton.NO);\r\n            d.setBodyStyleName(\"pad-text\");\r\n            d.add(new Label(codedTermEditorDriver.getErrors().toString()));\r\n            d.getBody().addClassName(\"pad-text\");\r\n            d.setHideOnButtonClick(true);\r\n            d.setWidth(300);\r\n        }\r\n        return model;\r\n    }\r\n\r\n    /**\r\n     * Use this method to enable/disable all editable fields of this widget.\r\n     * @param enabled\r\n     */\r\n    protected void setWidgetEnable(boolean enabled) {\r\n        displayName.getField().setEnabled(enabled);\r\n        code.getField().setEnabled(enabled);\r\n        codingScheme.codingScheme.getField().setEnabled(enabled);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param displayNameEmptytext Default text displayed in an empty name field\r\n     * @param codeEmptyText        Default text displayed in an empty code field\r\n     * @param codingEmptyText      Default text displayed in an empty coding scheme text field\r\n     */\r\n    public void setEmptyTexts(String displayNameEmptytext, String codeEmptyText, String codingEmptyText) {\r\n        displayName.setEmptyText(displayNameEmptytext);\r\n        code.setEmptyText(codeEmptyText);\r\n        codingScheme.setEmptyText(codingEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param configDisplayName\r\n     * @param configCode\r\n     * @param configCodingScheme\r\n     */\r\n    public void setToolTipConfigs(ToolTipConfig configDisplayName, ToolTipConfig configCode, ToolTipConfig configCodingScheme) {\r\n        displayName.setToolTipConfig(configDisplayName);\r\n        code.setToolTipConfig(configCode);\r\n        codingScheme.setToolTipConfig(configCodingScheme);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param b_displayName  true to allow blank to the name field, false otherwise\r\n     * @param b_code         true to allow blank to the code field, false otherwise\r\n     * @param b_codingScheme true to allow blank to the coding scheme field, false\r\n     *                       otherwise\r\n     */\r\n    public void setAllowBlanks(boolean b_displayName, boolean b_code, boolean b_codingScheme) {\r\n        displayName.setAllowBlank(b_displayName);\r\n        code.setAllowBlank(b_code);\r\n        codingScheme.setAllowBlank(b_codingScheme);\r\n    }\r\n\r\n    /**\r\n     * Methods that the current edition mode state of the widget.\r\n     * @return current edition mode state.\r\n     */\r\n    public EditionMode getEditionMode() {\r\n        return editionMode;\r\n    }\r\n\r\n    /**\r\n     * Method that sets an edition mode for the widget.\r\n     * @param editionMode edition mode to set\r\n     */\r\n    public void setEditionMode(EditionMode editionMode) {\r\n        this.editionMode = editionMode;\r\n        if (editionMode.equals(EditionMode.DISPLAY) || editionMode.equals(EditionMode.NODATA)) {\r\n            setWidgetEnable(false);\r\n        } else if (editionMode.equals(EditionMode.NEW) || editionMode.equals(EditionMode.EDIT)) {\r\n            setWidgetEnable(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Getter returning the codedTerm entity in edition in the widget.\r\n     * @return CodedTerm entity in edition.\r\n     */\r\n    public CodedTerm getModel() {\r\n        return save();\r\n    }\r\n\r\n    /**\r\n     * Setter to change the coded term in edition.\r\n     * @param codedTerm coded term to edit.\r\n     */\r\n    public void setModel(CodedTerm codedTerm) {\r\n        this.model = codedTerm;\r\n    }\r\n\r\n    /**\r\n     * This methods set the focus to the first field of the widget (displayName).\r\n     */\r\n    public void setFocus() {\r\n        displayName.focus();\r\n    }\r\n\r\n    /**\r\n     * Definition of the editor driver dedicated to CodedTerm (GWT Editor Framework).\r\n     */\r\n    interface CodedTermEditorDriver extends SimpleBeanEditorDriver<CodedTerm, CodedTermEditorWidget> {\r\n    }\r\n\r\n}\r\n'),(4505,5618,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodedTerm;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodingScheme;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\n/**\r\n * Factory class that creates an instance of CodedTerm for a GridEditor\r\n * (pattern used to solve a problem of java reflection in GWT).\r\n */\r\npublic enum CodedTermFactory implements GridModelFactory<CodedTerm> {\r\n    INSTANCE;\r\n    private int counter=0;\r\n\r\n    /**\r\n     * This methods returns a new instance of CodedTerm in order to avoid reflection in GWT.\r\n     * @return new instance of CodedTerm.\r\n     */\r\n    @Override\r\n    public CodedTerm newInstance() {\r\n        counter++;\r\n        CodedTerm e = GWT.create(CodedTerm.class);\r\n        e.setDisplayName(new String256(\"New Coded Term name\"));\r\n        e.setCodingScheme(new CodingScheme(new String256(\"New Coded Term coding scheme\")));\r\n        e.setCode(new String256(\"New Coded term code \"+counter));\r\n        return e;\r\n    }\r\n}\r\n'),(4506,5619,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.event.logical.shared.SelectionEvent;\r\nimport com.google.gwt.event.logical.shared.SelectionHandler;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.form.FieldLabel;\r\nimport com.sencha.gxt.widget.core.client.form.TextField;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnConfig;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnModel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.CodedTermProperties;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableGrid;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodes;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodedTerm;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * This class represents the widget made for the edition of a list of CodedTerms.\r\n * It creates a editable grid of Coded Term.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableGrid\r\n * @see gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets.CodedTermFactory\r\n */\r\npublic class CodedTermsEditableGridWidget extends GenericEditableGrid<CodedTerm> {\r\n    // instance of the property access for the Author entity attributes (for the GXT Store).\r\n    private final static CodedTermProperties CT_PROPS = GWT.create(CodedTermProperties.class);\r\n\r\n    // --- UI Widgets\r\n    private static ColumnConfig<CodedTerm, String> displayNameColumnConfig;\r\n    private static ColumnConfig<CodedTerm, String> codeColumnConfig;\r\n    private static ColumnConfig<CodedTerm, String> codingSchemeColumnConfig;\r\n\r\n    private PredefinedCodedTermComboBox predefinedCodedTermComboBox;\r\n\r\n    /**\r\n     * CodedTerms editable grid default constructor.\r\n     *\r\n     * @param gridTitle title of the widget (for the grid\'s panel header).\r\n     * @param predefinedCode type of predefined codes used in the widget (enum PedefinedCodes).\r\n     * @see gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodes\r\n     */\r\n    public CodedTermsEditableGridWidget(String gridTitle, PredefinedCodes predefinedCode) {\r\n        // use of the super constructor from GenericEditableGrid\r\n        super(gridTitle, new ListStore<CodedTerm>(CT_PROPS.key())/*, buildColumnModel()*/);\r\n\r\n        // change default tooltip for the toolbar add button.\r\n        ((TextButton) getToolbar().getWidget(0)).setToolTip(\"Add a custom value\");\r\n\r\n        predefinedCodedTermComboBox = new PredefinedCodedTermComboBox(predefinedCode);\r\n        // remove combobox value \"Custom value\"\r\n        predefinedCodedTermComboBox.getStore().remove(0);\r\n\r\n//        setCheckBoxSelectionModel();\r\n\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Method that binds the UI widgets with actions.\r\n     */\r\n    private void bindUI() {\r\n        predefinedCodedTermComboBox.addSelectionHandler(new SelectionHandler<CodedTerm>() {\r\n            @Override\r\n            public void onSelection(SelectionEvent<CodedTerm> event) {\r\n                if (!getStore().getAll().contains(event.getSelectedItem()))\r\n                    getStore().add(event.getSelectedItem());\r\n                predefinedCodedTermComboBox.getStore().remove(event.getSelectedItem());\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that builds the grid\r\n     * column model for CodedTerms.\r\n     */\r\n    @Override\r\n    protected ColumnModel<CodedTerm> buildColumnModel() {\r\n        List<ColumnConfig<CodedTerm, ?>> columnsConfigs = new ArrayList<ColumnConfig<CodedTerm, ?>>();\r\n\r\n        displayNameColumnConfig = new ColumnConfig<CodedTerm, String>(\r\n                CT_PROPS.displayName(), 20, \"Display Name\");\r\n        codeColumnConfig = new ColumnConfig<CodedTerm, String>(\r\n                CT_PROPS.code(), 30, \"Code\");\r\n        codingSchemeColumnConfig = new ColumnConfig<CodedTerm, String>(\r\n                CT_PROPS.codingScheme(), 50, \"CodingScheme\");\r\n\r\n        columnsConfigs.add(displayNameColumnConfig);\r\n        columnsConfigs.add(codeColumnConfig);\r\n        columnsConfigs.add(codingSchemeColumnConfig);\r\n\r\n        return new ColumnModel<CodedTerm>(columnsConfigs);\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that creates the editing\r\n     * fields used when the grid is in edition mode.\r\n     */\r\n    @Override\r\n    protected void buildEditingFields() {\r\n        // Editing widgets\r\n        TextField displayNameTF = new TextField();\r\n        displayNameTF.setAllowBlank(false);\r\n//        displayNameTF.setToolTip(\"This fields is required.\");\r\n        TextField codeTF = new TextField();\r\n        codeTF.setAllowBlank(false);\r\n        codeTF.setToolTip(\"This field is required.\");\r\n        TextField codingSchemeTF = new TextField();\r\n        codingSchemeTF.setAllowBlank(false);\r\n//        codingSchemeTF.setToolTip(\"This is required.\");\r\n        addColumnEditorConfig(displayNameColumnConfig, displayNameTF);\r\n        addColumnEditorConfig(codeColumnConfig, codeTF);\r\n        addColumnEditorConfig(codingSchemeColumnConfig, codingSchemeTF);\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that specifies the ModelFactory\r\n     * for the grid (used to create a new instance of codedterm in the grid w/o using reflection).\r\n     * @return CodedTermGridFactory\r\n     */\r\n    @Override\r\n    protected GridModelFactory<CodedTerm> getModelFactory() {\r\n        return CodedTermFactory.INSTANCE;\r\n    }\r\n\r\n    /**\r\n     * This method returns the CodedTerm editable grid as a widget w/ the combobox to add\r\n     * predefined codedterm to the grid.\r\n     * @return CodedTermEditableGrid as a widget.\r\n     */\r\n    @Override\r\n    public Widget getDisplay() {\r\n        FieldLabel codedTermFL = new FieldLabel(predefinedCodedTermComboBox, \"Select a coded term to add\");\r\n        codedTermFL.setLabelWidth(200);\r\n        addWidget(codedTermFL);\r\n        return super.getDisplay();\r\n    }\r\n\r\n    /**\r\n     * Method that clears the entire grid from all values and add theses values\r\n     * to the list of predefined coded terms in the combobox.\r\n     */\r\n    @Override\r\n    protected void clearStoreAction() {\r\n        for (CodedTerm c : getStore().getAll()) {\r\n            if (!predefinedCodedTermComboBox.getStore().getAll().contains(c)) {\r\n                predefinedCodedTermComboBox.getStore().add(c);\r\n            }\r\n        }\r\n        super.clearStoreAction();\r\n        view.refresh(false);\r\n    }\r\n\r\n    /**\r\n     * Method that removes a codedterm value from the grid and add it to the list\r\n     * of predefined coded terms in the combobox.\r\n     */\r\n    @Override\r\n    protected void deleteSelectedItemAction() {\r\n        for (CodedTerm e : getSelectionModel().getSelectedItems()) {\r\n            getStore().remove(e);\r\n            getStore().commitChanges();\r\n            if (!predefinedCodedTermComboBox.getStore().getAll().contains(e)) {\r\n                predefinedCodedTermComboBox.getStore().add(e);\r\n            }\r\n        }\r\n        view.refresh(false);\r\n    }\r\n\r\n}\r\n'),(4507,5620,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.user.client.ui.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodingScheme;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches CodingScheme model type</b>\r\n * </p>\r\n */\r\npublic class CodingSchemeEditorWidget extends Composite implements Editor<CodingScheme> {\r\n    private VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n    String256EditorWidget codingScheme = new String256EditorWidget();\r\n\r\n    /**\r\n     * Default Constructor.\r\n     */\r\n    public CodingSchemeEditorWidget() {\r\n        initWidget(vcontainer);\r\n        vcontainer.add(codingScheme);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param codingSchemeEmptyText Default text displayed in an empty coding scheme field\r\n     */\r\n    public void setEmptyText(String codingSchemeEmptyText) {\r\n        codingScheme.setEmptyText(codingSchemeEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param config\r\n     */\r\n    public void setToolTipConfig(ToolTipConfig config) {\r\n        codingScheme.setToolTipConfig(config);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param allowBlank true to allow blanks, false otherwise\r\n     */\r\n    public void setAllowBlank(boolean allowBlank) {\r\n        codingScheme.setAllowBlank(allowBlank);\r\n    }\r\n}\r\n'),(4508,5621,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.CodedTermWidgets;\r\n\r\nimport com.google.gwt.event.logical.shared.BeforeSelectionEvent;\r\nimport com.google.gwt.event.logical.shared.BeforeSelectionHandler;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.cell.core.client.form.ComboBoxCell;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.data.shared.LabelProvider;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.data.shared.ModelKeyProvider;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.FramedPanel;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.SimpleContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.form.ComboBox;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.EditionMode;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodes;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodesParser;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodedTerm;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * ComboBox widget that handles predefined coded terms.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodes\r\n */\r\npublic class PredefinedCodedTermComboBox extends ComboBox<CodedTerm> {\r\n\r\n    private TextButton editCustomedValueBtn = new TextButton(\"Edit custom value\");\r\n    private List<Integer> customedValuesIndexes = new ArrayList<Integer>();\r\n    private int selectedIndex = -1;\r\n\r\n    /**\r\n     * Predefined Coded Term Combo Box constructor.\r\n     * @param predefinedCodes type of predefined codes to be handled by the widget (classCode, formatCode...)\r\n     */\r\n    public PredefinedCodedTermComboBox(PredefinedCodes predefinedCodes) {\r\n        super(new ListStore<CodedTerm>(new ModelKeyProvider<CodedTerm>() {\r\n            @Override\r\n            public String getKey(CodedTerm item) {\r\n                if (item == null) {\r\n                    return \"NULL\";\r\n                }\r\n                return item.toString();\r\n            }\r\n        }), new LabelProvider<CodedTerm>() {\r\n            /**\r\n             * Method that builds a label value to be displayed in the combobox for a CodedTerm object.\r\n             * @param codedTerm coded term entity\r\n             * @return label to be display in the combobox\r\n             */\r\n            @Override\r\n            public String getLabel(CodedTerm codedTerm) {\r\n                String s = new String();\r\n                if (codedTerm.getDisplayName() != null && !codedTerm.getDisplayName().toString().equals(\"\")) {\r\n                    s += codedTerm.getDisplayName().toString();\r\n                }\r\n                if (codedTerm.getCode() != null && !codedTerm.getCode().toString().equals(\"\") ) {\r\n                    if (!s.isEmpty()) {\r\n                        s += \"  -  \";\r\n                    }\r\n                    s += codedTerm.getCode().toString();\r\n                }\r\n                if (codedTerm.getCodingScheme() != null && !codedTerm.getCodingScheme().toString().equals(\"\")) {\r\n                    if (!s.isEmpty()) {\r\n                        s += \"  -  \";\r\n                    }\r\n                    s += codedTerm.getCodingScheme().toString();\r\n                }\r\n                return s;\r\n            }\r\n        });\r\n\r\n        // empty the list of values of the combo box.\r\n        getStore().clear();\r\n\r\n        this.setEmptyText(\"Select a code...\");\r\n\r\n        // retrieve required predefined coded terms regarding the predefined code type specified.\r\n        List<CodedTerm> l = PredefinedCodesParser.INSTANCE.getCodes(predefinedCodes);\r\n\r\n        // set the list of value of the combobox.\r\n        getStore().add(new CodedTerm(\"\", \"Custom Value\", \"\"));\r\n        getStore().addAll(l);\r\n\r\n        setTriggerAction(ComboBoxCell.TriggerAction.ALL);\r\n        setForceSelection(true);\r\n        setTypeAhead(true);\r\n\r\n        editCustomedValueBtn.disable();\r\n\r\n        setText(\"\");\r\n        clear();\r\n\r\n        bind();\r\n    }\r\n\r\n    /**\r\n     * This method binds the UI widgets w/ actions.\r\n     */\r\n    private void bind() {\r\n        this.addBeforeSelectionHandler(new BeforeSelectionHandler<CodedTerm>() {\r\n            @Override\r\n            public void onBeforeSelection(BeforeSelectionEvent<CodedTerm> event) {\r\n                if (event.getItem().getDisplayName().toString().equals(\"Custom Value\")) {\r\n                    final CodedTermPopUpEditor codedTermPopUpEditor = new CodedTermPopUpEditor();\r\n\r\n                    codedTermPopUpEditor.getOkButton().addSelectHandler(new SelectEvent.SelectHandler() {\r\n                        @Override\r\n                        public void onSelect(SelectEvent event) {\r\n                            CodedTerm added = codedTermPopUpEditor.getEditor().save();\r\n                            if (!added.isOneFieldEmpty()) {\r\n                                getStore().add(added);\r\n                                select(added);\r\n                                setValue(added);\r\n                                customedValuesIndexes.add(getStore().indexOf(added));\r\n                                redraw(true);\r\n                                editCustomedValueBtn.enable();\r\n                                codedTermPopUpEditor.hide();\r\n                            }\r\n                        }\r\n                    });\r\n                    codedTermPopUpEditor.getCancelButton().addSelectHandler(new SelectEvent.SelectHandler() {\r\n                        @Override\r\n                        public void onSelect(SelectEvent event) {\r\n                            resetSelection();\r\n                        }\r\n                    });\r\n                }\r\n                selectedIndex = getStore().indexOf(event.getItem());\r\n                if (customedValuesIndexes.contains(selectedIndex)) {\r\n                    editCustomedValueBtn.enable();\r\n                } else {\r\n                    editCustomedValueBtn.disable();\r\n                }\r\n            }\r\n        });\r\n        editCustomedValueBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final CodedTermPopUpEditor codedTermPopUpEditor = new CodedTermPopUpEditor();\r\n                codedTermPopUpEditor.getOkButton().setText(\"Save changes\");\r\n                final CodedTerm currentValue = getCurrentValue();\r\n                codedTermPopUpEditor.getEditor().edit(currentValue);\r\n                codedTermPopUpEditor.getOkButton().addSelectHandler(new SelectEvent.SelectHandler() {\r\n                    @Override\r\n                    public void onSelect(SelectEvent event) {\r\n                        CodedTerm updated = codedTermPopUpEditor.getEditor().save();\r\n                        if (!updated.isOneFieldEmpty()) {\r\n                            customedValuesIndexes.remove(customedValuesIndexes.indexOf(getStore().indexOf(currentValue)));\r\n                            getStore().remove(currentValue);\r\n                            getStore().add(updated);\r\n                            select(updated);\r\n                            setValue(updated);\r\n                            customedValuesIndexes.add(getStore().indexOf(updated));\r\n                            redraw(true);\r\n                            editCustomedValueBtn.enable();\r\n                            codedTermPopUpEditor.hide();\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This method renders the PredefinedCodedTermComboBox as a Widget (w/ edit button).\r\n     * @return PredefinedCodedTermComboBox as a Widget.\r\n     */\r\n    public Widget getDisplay() {\r\n        SimpleContainer scon=new SimpleContainer();\r\n        HorizontalLayoutContainer hcon = new HorizontalLayoutContainer();\r\n        hcon.add(super.asWidget(), new HorizontalLayoutContainer.HorizontalLayoutData(1, -1, new Margins(0, 2, 0, 0)));\r\n        hcon.add(editCustomedValueBtn, new HorizontalLayoutContainer.HorizontalLayoutData(-1, -1, new Margins(0, 1, 0, 2)));\r\n        scon.setHeight(22);\r\n        scon.add(hcon);\r\n        return scon;\r\n    }\r\n\r\n    /**\r\n     * this method reset the value selection of the combobox (deselectAll).\r\n     */\r\n    private void resetSelection() {\r\n        setValue(null);\r\n        redraw(true);\r\n    }\r\n\r\n    private class CodedTermPopUpEditor extends Dialog {\r\n\r\n        private final TextButton cancelButton;\r\n        private final TextButton okButton;\r\n        private final CodedTermEditorWidget editor;\r\n\r\n        private final static int POPUP_WIDTH=600;\r\n        private final static int POPUP_HEIGHT=180;\r\n        private final static int BUTTON_WIDTH=80;\r\n        private final static int BUTTON_HEIGHT=30;\r\n\r\n        public CodedTermPopUpEditor() {\r\n            super();\r\n            setBodyBorder(false);\r\n            setHeadingText(\"Custom Coded Term\");\r\n            setHideOnButtonClick(true);\r\n            setWidth(POPUP_WIDTH);\r\n            setHeight(POPUP_HEIGHT);\r\n\r\n            FramedPanel fpanel = new FramedPanel();\r\n            fpanel.setBorders(false);\r\n            fpanel.setHeaderVisible(false);\r\n\r\n            editor = new CodedTermEditorWidget();\r\n            editor.initEditorDriver();\r\n            editor.editNew();\r\n            editor.setAllowBlanks(false, false, false);\r\n\r\n            okButton = new TextButton(\"Add\");\r\n            okButton.setWidth(BUTTON_WIDTH);\r\n            okButton.setHeight(BUTTON_HEIGHT);\r\n            cancelButton = new TextButton(\"Cancel\");\r\n            cancelButton.setWidth(BUTTON_WIDTH);\r\n            cancelButton.setHeight(BUTTON_HEIGHT);\r\n            fpanel.addButton(okButton);\r\n            fpanel.addButton(cancelButton);\r\n            fpanel.setButtonAlign(BoxLayoutContainer.BoxLayoutPack.CENTER);\r\n\r\n            VerticalLayoutContainer vcon = new VerticalLayoutContainer();\r\n            vcon.add(editor, new VerticalLayoutContainer.VerticalLayoutData(1, 1, new Margins(10)));\r\n            fpanel.add(vcon);\r\n\r\n            add(fpanel);\r\n\r\n            // delete the default button\r\n            getButtonBar().remove(0);\r\n            setModal(true);\r\n            show();\r\n\r\n            getEditor().setFocus();\r\n\r\n            bind();\r\n        }\r\n\r\n        private void bind() {\r\n            cancelButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n                @Override\r\n                public void onSelect(SelectEvent event) {\r\n                    editor.setEditionMode(EditionMode.NODATA);\r\n                    hide();\r\n                }\r\n            });\r\n        }\r\n\r\n        public TextButton getCancelButton() {\r\n            return cancelButton;\r\n        }\r\n\r\n        public CodedTermEditorWidget getEditor() {\r\n            return editor;\r\n        }\r\n\r\n        public TextButton getOkButton() {\r\n            return okButton;\r\n        }\r\n    }\r\n\r\n}\r\n'),(4509,5623,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.DTM;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches DTM model type</b>\r\n * </p>\r\n */\r\n@Deprecated\r\npublic class DTMEditorWidget extends Composite implements Editor<DTM> {\r\n    // --- UI Widgets\r\n    private String256EditorWidget dtm = new String256EditorWidget();\r\n\r\n    public DTMEditorWidget() {\r\n        VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n        initWidget(vcontainer);\r\n        dtm.setWidth(\"auto\");\r\n        this.setWidth(\"auto\");\r\n        vcontainer.setWidth(\"auto\");\r\n        vcontainer.add(dtm, new VerticalLayoutData(1, -1));\r\n    }\r\n}\r\n'),(4510,5624,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.google.gwt.user.client.ui.IsWidget;\r\nimport com.sencha.gxt.widget.core.client.form.FieldLabel;\r\n\r\n/**\r\n * Created by onh2 on 3/3/2015.\r\n */\r\npublic class EditorFieldLabel extends FieldLabel {\r\n    private static final int LABEL_WIDTH=135;\r\n\r\n    public EditorFieldLabel(IsWidget widget, String label){\r\n        super(widget,label);\r\n        setLabelWidth(LABEL_WIDTH);\r\n    }\r\n}\r\n'),(4511,5626,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.IdentifierWidgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.form.Validator;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.EditorFieldLabel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.OIDEditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.IdentifierOID;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches LanguageCode model type</b>\r\n * </p>\r\n */\r\npublic class IdentifierOIDEditorWidget extends Composite implements\r\n        Editor<IdentifierOID> {\r\n    private VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n    OIDEditorWidget value = new OIDEditorWidget(false);\r\n    String256EditorWidget idType = new String256EditorWidget();\r\n\r\n    /**\r\n     * Default constructor\r\n     */\r\n    public IdentifierOIDEditorWidget() {\r\n        initWidget(vcontainer);\r\n        EditorFieldLabel valueLabel = new EditorFieldLabel(value, \"Value\");\r\n        EditorFieldLabel idTypeLabel = new EditorFieldLabel(idType, \"ID Type (OID)\");\r\n        idTypeLabel.setVisible(false);\r\n\r\n        vcontainer.add(value, new VerticalLayoutContainer.VerticalLayoutData(1, -1));\r\n    }\r\n\r\n    /**\r\n     * Method that add a validator to the IdentifierOID field.\r\n     * @param validator input identifier oid value validator.\r\n     */\r\n    public void addValueFieldValidator(Validator validator) {\r\n        value.addOIDValidator(validator);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param valueEmptyText  Default text displayed in an empty value field\r\n     * @param idTypeEmptyText Default text displayed in an empty id type field\r\n     */\r\n    public void setEmptyTexts(String valueEmptyText, String idTypeEmptyText) {\r\n        value.setEmptyText(valueEmptyText);\r\n        idType.setEmptyText(idTypeEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param valueConfig\r\n     * @param idTypeConfig\r\n     */\r\n    public void setToolTipConfigs(ToolTipConfig valueConfig,\r\n                                  ToolTipConfig idTypeConfig) {\r\n        value.setToolTipConfig(valueConfig);\r\n        idType.setToolTipConfig(idTypeConfig);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param b_value  true to allow blank to the value field, false otherwise\r\n     * @param b_idType true to allow blank to the idType field, false otherwise\r\n     */\r\n    public void setAllowBlanks(boolean b_value, boolean b_idType) {\r\n        value.setAllowBlank(b_value);\r\n        idType.setAllowBlank(b_idType);\r\n    }\r\n}\r\n'),(4512,5627,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.IdentifierWidgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.form.Validator;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.IdentifierString256;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the editor widget which matches IdentifierString256 model type</b>\r\n * </p>\r\n */\r\npublic class IdentifierString256EditorWidget extends Composite implements Editor<IdentifierString256> {\r\n    private VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n    String256EditorWidget value = new String256EditorWidget();\r\n    String256EditorWidget idType = new String256EditorWidget();\r\n\r\n    /**\r\n     * Default constructor.\r\n     */\r\n    public IdentifierString256EditorWidget() {\r\n        initWidget(vcontainer);\r\n        vcontainer.add(value, new VerticalLayoutData(1, -1));\r\n    }\r\n\r\n    /**\r\n     * Method that add a validator to the IdentifierString256 field.\r\n     * @param validator input identifier String256 value validator.\r\n     */\r\n    public void addValueFieldValidator(Validator<String> validator) {\r\n        value.addValidator(validator);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param valueEmptyText  Default text displayed in an empty value field\r\n     * @param idTypeEmptyText Default text displayed in an empty id type field\r\n     */\r\n    public void setEmptyTexts(String valueEmptyText, String idTypeEmptyText) {\r\n        value.setEmptyText(valueEmptyText);\r\n        idType.setEmptyText(idTypeEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param valueConfig\r\n     * @param idTypeConfig\r\n     */\r\n    public void setToolTipConfigs(ToolTipConfig valueConfig, ToolTipConfig idTypeConfig) {\r\n        value.setToolTipConfig(valueConfig);\r\n        idType.setToolTipConfig(idTypeConfig);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param b_value  true to allow blank to the value field, false otherwise\r\n     * @param b_idType true to allow blank to the idType field, false otherwise\r\n     */\r\n    public void setAllowBlanks(boolean b_value, boolean b_idType) {\r\n        value.setAllowBlank(b_value);\r\n        idType.setAllowBlank(b_idType);\r\n    }\r\n}\r\n'),(4513,5629,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.InternationalStringWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnConfig;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnModel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.InternationalStringProperties;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.LanguageCodeComboBox;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableGrid;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.BoundedTextField;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.InternationalString;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.LanguageCode;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * This class represents the widget made for the edition of a list of InternationalString.\r\n * It creates a editable grid of InternationalString.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableGrid\r\n * @see gov.nist.hit.ds.docentryeditor.client.editor.widgets.InternationalStringWidgets.InternationalStringFactory\r\n */\r\npublic class InternationalStringEditableGrid extends GenericEditableGrid<InternationalString> {\r\n    // instance of the property access for the InternationalString entity attributes (for the GXT Store).\r\n    private final static InternationalStringProperties IS_PROPS = GWT.create(InternationalStringProperties.class);\r\n\r\n    // --- UI Widgets\r\n    private static ColumnConfig<InternationalString, LanguageCode> languageCodeColumnConfig;\r\n    private static ColumnConfig<InternationalString, String> titleColumnConfig;\r\n\r\n    /**\r\n     * InternationalString editable grid default constructor.\r\n     *\r\n     * @param gridTitle title of the widget (for the grid\'s panel header).\r\n     */\r\n    public InternationalStringEditableGrid(String gridTitle) {\r\n        super(gridTitle, new ListStore<InternationalString>(IS_PROPS.key())/*, buildColumnModel()*/);\r\n//        setCheckBoxSelectionModel();\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that builds the grid\r\n     * column model for InternationalString.\r\n     */\r\n    @Override\r\n    protected ColumnModel<InternationalString> buildColumnModel() {\r\n        List<ColumnConfig<InternationalString, ?>> columnsConfigs = new ArrayList<ColumnConfig<InternationalString, ?>>();\r\n\r\n        languageCodeColumnConfig = new ColumnConfig<InternationalString, LanguageCode>(\r\n                IS_PROPS.langCode(), 15, \"Language Code\");\r\n        titleColumnConfig = new ColumnConfig<InternationalString, String>(\r\n                IS_PROPS.value(), 85, \"Title\");\r\n        columnsConfigs.add(languageCodeColumnConfig);\r\n        columnsConfigs.add(titleColumnConfig);\r\n        return new ColumnModel<InternationalString>(\r\n                columnsConfigs);\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that creates the editing\r\n     * fields used when the grid is in edition mode.\r\n     */\r\n    @Override\r\n    protected void buildEditingFields() {\r\n        LanguageCodeComboBox languageCodeComboBox = new LanguageCodeComboBox();\r\n        languageCodeComboBox.setAllowBlank(false);\r\n        languageCodeComboBox.setToolTip(\"The translation language\'s code is required. It can not be null. Please select one or delete the row.\");\r\n        BoundedTextField tf = new BoundedTextField();\r\n        tf.setMaxLength(256);\r\n        tf.setToolTip(\"This is the translation corresponding to the selected language. This field is required. It can not be null.\");\r\n        tf.setAllowBlank(false);\r\n        addColumnEditorConfig(languageCodeColumnConfig, languageCodeComboBox);\r\n        addColumnEditorConfig(titleColumnConfig, tf);\r\n    }\r\n\r\n    /**\r\n     * Implementation of the abstract method that specifies the ModelFactory\r\n     * for the grid (used to create a new instance of codedterm in the grid w/o using reflection).\r\n     * @return InternationalStringGridFactory\r\n     */\r\n    @Override\r\n    protected GridModelFactory<InternationalString> getModelFactory() {\r\n        return InternationalStringFactory.INSTANCE;\r\n    }\r\n}\r\n'),(4514,5630,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.InternationalStringWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\r\nimport com.google.gwt.user.client.ui.Label;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.EditionMode;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.EditorFieldLabel;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.LanguageCodeComboBox;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.String256EditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.InternationalString;\r\n\r\n/**\r\n * This is a widget which enables to edit a single international String. It might be a title or comment for instance.\r\n * To use it you must call for call for it\'s initEditorDriver method at a higher level (in the presenter for example).\r\n */\r\npublic class InternationalStringEditorWidget extends Composite implements Editor<InternationalString> {\r\n\r\n    // instance of the driver for the edition of an international string\r\n    private final InternationalStringEditorDriver internationalStringEditorDriver = GWT.create(InternationalStringEditorDriver.class);\r\n    // --- UI Widgets\r\n    private final VerticalLayoutContainer widgetVContainer = new VerticalLayoutContainer();\r\n    // fields\r\n    private LanguageCodeComboBox langCode = new LanguageCodeComboBox();\r\n    private String256EditorWidget value = new String256EditorWidget();\r\n\r\n    // the InternationalString object being edited\r\n    @Ignore\r\n    private InternationalString model;\r\n    /*\r\n     * editionMode is an instance of EditionMode. It is used to know the state\r\n     * of the editor, to know how to display the different fields\r\n     * (enable/disable especially)\r\n     */\r\n    @Ignore\r\n    private EditionMode editionMode = EditionMode.NODATA;\r\n\r\n    /**\r\n     * InternationalString editor widget default constructor\r\n     */\r\n    public InternationalStringEditorWidget() {\r\n        buildUI();\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Method that builds the UI.\r\n     */\r\n    private void buildUI() {\r\n        initWidget(widgetVContainer);\r\n        EditorFieldLabel langCodeFL = new EditorFieldLabel(langCode, \"Language Code\");\r\n        EditorFieldLabel valueFL = new EditorFieldLabel(value, \"Value\");\r\n        langCode.setWidth(\"auto\");\r\n        value.setWidth(\"auto\");\r\n        widgetVContainer.add(langCodeFL);\r\n        widgetVContainer.add(valueFL);\r\n    }\r\n\r\n    /**\r\n     * Mehtod that binds widgets of the UI with actions.\r\n     */\r\n    private void bindUI() {\r\n\r\n    }\r\n\r\n    /**\r\n     * Method that initializes the editor driver for InternationalString (GWT Editor Framework).\r\n     */\r\n    public void initEditorDriver() {\r\n        internationalStringEditorDriver.initialize(this);\r\n    }\r\n\r\n    /**\r\n     * Method that starts the edition of a specific internationalString.\r\n     * @param internationalString InternationalString object to edit.\r\n     */\r\n    public void edit(InternationalString internationalString) {\r\n        resetWidgets();\r\n        setModel(internationalString);\r\n        internationalStringEditorDriver.edit(internationalString);\r\n    }\r\n\r\n    /**\r\n     * Method that starts the edition of a new instance of InternationalString.\r\n     */\r\n    public void editNew() {\r\n        model = new InternationalString();\r\n        edit(model);\r\n        resetWidgets();\r\n    }\r\n\r\n    /**\r\n     * Method that clears all editable fields of the widget.\r\n     */\r\n    private void resetWidgets() {\r\n        langCode.clear();\r\n        value.getField().clear();\r\n    }\r\n\r\n    /**\r\n     * Method to rollback every changes. Cancel changes.\r\n     */\r\n    public void rollbackChanges() {\r\n        switch (editionMode) {\r\n            case NEW:\r\n                resetEditor();\r\n                break;\r\n            case EDIT:\r\n                resetEditor();\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * This method reset this widget to its initial state\r\n     * w/ no data selected.\r\n     */\r\n    private void resetEditor() {\r\n        setEditionMode(EditionMode.NODATA);\r\n        model = null;\r\n        internationalStringEditorDriver.edit(model);\r\n        // editNew();\r\n    }\r\n\r\n    /**\r\n     * Method that saves the changes made to an international string\r\n     * entity in this editor widget.\r\n     * @return saved codedTerm\r\n     */\r\n    public void save() {\r\n        model = internationalStringEditorDriver.flush();\r\n        if (internationalStringEditorDriver.hasErrors()) {\r\n            Dialog d = new Dialog();\r\n            d.setHeadingText(\"Errors dialog\");\r\n            d.setPredefinedButtons(PredefinedButton.YES, PredefinedButton.NO);\r\n            d.setBodyStyleName(\"pad-text\");\r\n            d.add(new Label(internationalStringEditorDriver.getErrors().toString()));\r\n            d.getBody().addClassName(\"pad-text\");\r\n            d.setHideOnButtonClick(true);\r\n            d.setWidth(300);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Use this method to enable/disable all editable fields of this widget.\r\n     * @param enabled\r\n     */\r\n    protected void setWidgetEnable(boolean enabled) {\r\n        langCode.setEnabled(enabled);\r\n        value.getField().setEnabled(enabled);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param langCodeEmptyText\r\n     * @param valueEmptyText\r\n     */\r\n    public void setEmptyText(String langCodeEmptyText, String valueEmptyText) {\r\n        langCode.setEmptyText(langCodeEmptyText);\r\n        value.setEmptyText(valueEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param langCodeConfig\r\n     * @param valueConfig\r\n     */\r\n    public void setToolTipConfig(ToolTipConfig langCodeConfig, ToolTipConfig valueConfig) {\r\n        langCode.setToolTipConfig(langCodeConfig);\r\n        value.setToolTipConfig(valueConfig);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param langCodeBlankAllowed\r\n     */\r\n    public void setAllowBlank(boolean langCodeBlankAllowed) {\r\n        langCode.setAllowBlank(langCodeBlankAllowed);\r\n    }\r\n\r\n\r\n    /**\r\n     * Methods that the current edition mode state of the widget.\r\n     * @return current edition mode state.\r\n     */\r\n    public EditionMode getEditionMode() {\r\n        return editionMode;\r\n    }\r\n\r\n    /**\r\n     * Method that sets an edition mode for the widget.\r\n     * @param editionMode edition mode to set\r\n     */\r\n    public void setEditionMode(EditionMode editionMode) {\r\n        this.editionMode = editionMode;\r\n        if (editionMode.equals(EditionMode.DISPLAY) || editionMode.equals(EditionMode.NODATA)) {\r\n            setWidgetEnable(false);\r\n        } else if (editionMode.equals(EditionMode.NEW) || editionMode.equals(EditionMode.EDIT)) {\r\n            setWidgetEnable(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Getter returning the InternationalString entity in edition in the widget.\r\n     * @return InternationalString entity in edition.\r\n     */\r\n    public InternationalString getModel() {\r\n        return model;\r\n    }\r\n\r\n    /**\r\n     * Setter to change the InternationalString in edition.\r\n     * @param internationalString InternationalString to edit.\r\n     */\r\n    private void setModel(InternationalString internationalString) {\r\n        this.model = internationalString;\r\n    }\r\n\r\n    @Override\r\n    public boolean isAttached() {\r\n        return super.isAttached();\r\n    }\r\n\r\n    /**\r\n     * Definition of the editor driver dedicated to InternationalString (GWT Editor Framework).\r\n     */\r\n    interface InternationalStringEditorDriver extends SimpleBeanEditorDriver<InternationalString, InternationalStringEditorWidget> {\r\n    }\r\n}\r\n'),(4515,5631,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.InternationalStringWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.InternationalString;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.LanguageCode;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\n/**\r\n * Factory class that creates an instance of InternationalString for a GridEditor\r\n * (pattern used to solve a problem of java reflection in GWT).\r\n */\r\npublic enum InternationalStringFactory implements GridModelFactory<InternationalString> {\r\n    INSTANCE;\r\n    private int counter = 1;\r\n\r\n    /**\r\n     * This methods returns a new instance of InternationalString in order to avoid reflection in GWT.\r\n     * @return new instance of InternationalString.\r\n     */\r\n    @Override\r\n    public InternationalString newInstance() {\r\n        InternationalString is = GWT.create(InternationalString.class);\r\n        is.setLangCode(LanguageCode.ENGLISH_UNITED_STATES);\r\n        is.setValue(new String256(\"New translation \"+counter));\r\n        counter++;\r\n        return is;\r\n    }\r\n}\r\n'),(4516,5632,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;\r\nimport com.sencha.gxt.data.shared.LabelProvider;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.data.shared.ModelKeyProvider;\r\nimport com.sencha.gxt.widget.core.client.form.ComboBox;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.LanguageCode;\r\n\r\nimport java.util.*;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches LanguageCode model type.</b>\r\n * It enables the edition of language by selecting an existing language.\r\n * <br/>\r\n * </p>\r\n * @see gov.nist.hit.ds.docentryeditor.shared.model.LanguageCode\r\n */\r\npublic class LanguageCodeComboBox extends ComboBox<LanguageCode> {\r\n\r\n    // --- UI Widgets\r\n	static ListStore<LanguageCode> languages = new ListStore<LanguageCode>(new ModelKeyProvider<LanguageCode>() {\r\n\r\n		@Override\r\n		public String getKey(LanguageCode item) {\r\n			if (item == null) {\r\n				return \"NULL\";\r\n			}\r\n			return item.toString();\r\n		}\r\n	});\r\n\r\n    /**\r\n     * Widget default constructor.\r\n     */\r\n	public LanguageCodeComboBox() {\r\n		super(languages, new LabelProvider<LanguageCode>() {\r\n\r\n			@Override\r\n			public String getLabel(LanguageCode item) {\r\n				return item.toString() + \" (\" + item.name() + \")\";\r\n			}\r\n		});\r\n\r\n		getStore().clear();\r\n\r\n        // create the list of value for the widget.\r\n		List<LanguageCode> l = new ArrayList<LanguageCode>(Arrays.asList(LanguageCode.values()));\r\n\r\n        // sort alphabetically the list of languages for the widget.\r\n		Collections.sort(l, new Comparator<LanguageCode>() {\r\n\r\n			@Override\r\n			public int compare(LanguageCode o1, LanguageCode o2) {\r\n				return o1.toString().compareTo(o2.toString());\r\n			}\r\n		});\r\n\r\n        // init the widget with the sorted list of languages.\r\n		getStore().addAll(l);\r\n\r\n		setTriggerAction(TriggerAction.ALL);\r\n		setForceSelection(true);\r\n		setTypeAhead(true);\r\n	}\r\n\r\n}\r\n'),(4517,5633,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.sencha.gxt.cell.core.client.form.ComboBoxCell;\r\nimport com.sencha.gxt.data.shared.LabelProvider;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.data.shared.ModelKeyProvider;\r\nimport com.sencha.gxt.widget.core.client.form.ComboBox;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodesParser;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget to edit a document mime type\r\n * using a list of existing values (mime types).</b>\r\n * It enables to edit a mime type by selecting an value in a list existing mime types.\r\n * <br/>\r\n * </p>\r\n */\r\npublic class MimeTypeComboBox extends ComboBox<String256> {\r\n    /**\r\n     * Widget default constructor.\r\n     */\r\n    public MimeTypeComboBox(){\r\n        super(new ListStore<String256>(\r\n                new ModelKeyProvider<String256>() {\r\n\r\n                    @Override\r\n                    public String getKey(String256 item) {\r\n                        if (item == null) {\r\n                            return \"NULL\";\r\n                        }\r\n                        return item.toString();\r\n                    }\r\n                }), new LabelProvider<String256>() {\r\n\r\n            @Override\r\n            public String getLabel(String256 item) {\r\n                return item.toString();\r\n            }\r\n        });\r\n        getStore().clear();\r\n\r\n        // retrieve the list of existing mime types\r\n        List<String256> l = PredefinedCodesParser.INSTANCE\r\n                .getMimeTypes();\r\n\r\n        // init the widget with the list of mime types.\r\n        getStore().addAll(l);\r\n\r\n        setTriggerAction(ComboBoxCell.TriggerAction.ALL);\r\n        setForceSelection(true);\r\n        setTypeAhead(true);\r\n    }\r\n}\r\n'),(4518,5635,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.DTM;\r\n\r\n/**\r\n * Factory class that creates an instance of DTM for a GridEditor\r\n * (pattern used to solve a problem of java reflection in GWT).\r\n */\r\npublic enum DTMFactory implements GridModelFactory<DTM> {\r\n    INSTANCE;\r\n\r\n    /**\r\n     * This methods returns a new instance of DTM in order to avoid reflection in GWT.\r\n     * @return new instance of DTM.\r\n     */\r\n    @Override\r\n    public DTM newInstance() {\r\n        return GWT.create(DTM.class);\r\n    }\r\n}\r\n'),(4519,5636,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\n\r\n/**\r\n * Factory class that creates an instance of Integer for a GridEditor\r\n * (pattern used to solve a problem of java reflection in GWT).\r\n */\r\npublic enum IntegerFactory implements GridModelFactory<Integer> {\r\n    INSTANCE;\r\n\r\n    /**\r\n     * This methods returns a new instance of Integer in order to avoid reflection in GWT.\r\n     * @return new instance of Integer.\r\n     */\r\n    @Override\r\n    public Integer newInstance() {\r\n        return new Integer(0);\r\n    }\r\n}\r\n'),(4520,5637,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\nimport com.google.gwt.cell.client.Cell;\r\nimport com.google.gwt.cell.client.DateCell;\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.i18n.client.DateTimeFormat;\r\nimport com.sencha.gxt.core.client.ValueProvider;\r\nimport com.sencha.gxt.data.client.editor.ListStoreEditor;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.form.DateField;\r\nimport com.sencha.gxt.widget.core.client.form.DateTimePropertyEditor;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.DTMProperties;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.DTM;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.NameValueDTM;\r\n\r\nimport java.util.Date;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches the NameValueDTM model type</b> <br>\r\n * </p>\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView\r\n */\r\npublic class NameValueDTMEditorWidget extends GenericEditableListView<DTM, Date> implements Editor<NameValueDTM> {\r\n    // instance of the property access for the DTM entity attributes (for the GXT Store).\r\n    private final static DTMProperties PROPS = GWT.create(DTMProperties.class);\r\n\r\n    // --- UI Widgets\r\n    ListStoreEditor<DTM> values;\r\n    @Ignore\r\n    private DateField df;\r\n\r\n\r\n    /**\r\n     * NameValueDTM editable list constructor.\r\n     * @param widgetTitle title of the widget (for the grid\'s panel header).\r\n     */\r\n    public NameValueDTMEditorWidget(String widgetTitle) {\r\n        super(widgetTitle, new ListStore<DTM>(PROPS.key()), PROPS.dtm());\r\n        // init list store that will handle the list of DTM objects\r\n        values = new ListStoreEditor<DTM>(getStore());\r\n        bind();\r\n    }\r\n\r\n    /**\r\n     * NameValueDTM editable list constructor.\r\n     * @param widgetTitle title of the widget (for the grid\'s panel header).\r\n     * @param listSize number of DTM objects that can be stored in the widget (list).\r\n     */\r\n    public NameValueDTMEditorWidget(String widgetTitle,int listSize) {\r\n        this(widgetTitle);\r\n        setStoreMaxLength(listSize);\r\n    }\r\n\r\n    public NameValueDTMEditorWidget(String widgetTitle, boolean isToolbarVisible, int listSize) {\r\n        this(widgetTitle);\r\n        if(!isToolbarVisible){\r\n            disableToolbar();\r\n        }\r\n        setStoreMaxLength(listSize);\r\n    }\r\n\r\n    /**\r\n     * Method that constructs the widget itself.\r\n     */\r\n    private void buildUI() {\r\n\r\n    }\r\n\r\n    /**\r\n     * Method binding the view with actions.\r\n     */\r\n    private void bind() {\r\n        // FIXME not working asked a question on stackoverflow waiting for answers\r\n//        editing.addCompleteEditHandler(new CompleteEditEvent.CompleteEditHandler<DTM>() {\r\n//            @Override\r\n//            public void onCompleteEdit(CompleteEditEvent<DTM> event) {\r\n//                df.clearInvalid();\r\n//                df.validate();\r\n//                if (df.getValue() == null || !df.isValid()) {\r\n//                    getStore().clear();\r\n//                    DTM e = GWT.create(DTM.class);\r\n//                    getStore().add(e);\r\n//                    editing.startEditing(event.getEditCell());\r\n//                    df.forceInvalid(\"This date does not respect the expeted format\");\r\n//                } else {\r\n////                    editing.cancelEditing();\r\n////                    editing.completeEditing();\r\n//                }\r\n//            }\r\n//        });\r\n    }\r\n\r\n\r\n    /**\r\n     * This method assigns a specific field editor to the editable list widget for its edition mode.\r\n     */\r\n    @Override\r\n    protected void buildEditingFields() {\r\n        DateTimeFormat dtf = DateTimeFormat.getFormat(\"yyyyMMddHHmmss\");\r\n\r\n        df = new DateField();\r\n        df.setPropertyEditor(new DateTimePropertyEditor(dtf));\r\n        df.setToolTip(\"This value is required. The format of these values is defined as following: YYYY[MM[DD[hh[mm[ss]]]]]; YYYY is the four digit year (ex: 2014); MM is the two digit month 01-12, where January is 01, December is 12; DD is the two digit day of the month 01-31; HH is the two digit hour, 00-23, where 00 is midnight, 01 is 1 am, 12 is noon, 13 is 1 pm; mm is the two digit minute, 00-59; ss is the two digit seconds, 00-59\");\r\n        df.setEmptyText(\"YYYY[MM[DD[hh[mm[ss]]]]] (ex: 201103160830)\");\r\n\r\n        addEditorConfig(df);\r\n\r\n        // Modifying grid cell render for a Date\r\n        Cell c = new DateCell(DateTimeFormat.getFormat(\"yyyy-MM-dd HH:mm:ss\"));\r\n        getColumnModel().getColumn(0).setCell(c);\r\n    }\r\n\r\n    /**\r\n     * This method return the Model factory that must be used for this list editor.\r\n     * @return DTM factory.\r\n     */\r\n    @Override\r\n    protected GridModelFactory<DTM> getModelFactory() {\r\n        return DTMFactory.INSTANCE;\r\n    }\r\n\r\n    /**\r\n     * Defines the maximum number of element that can be stored in the widget.\r\n     * @param maxSize maximum number of element.\r\n     */\r\n    public void setListMaxSize(int maxSize) {\r\n        setStoreMaxLength(maxSize);\r\n    }\r\n\r\n    /**\r\n     * This method returns the list value provider.\r\n     * @return DTM value provider.\r\n     */\r\n    @Override\r\n    protected ValueProvider<DTM, Date> getValueProvider() {\r\n        return PROPS.dtm();\r\n    }\r\n}\r\n'),(4521,5638,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.core.client.ValueProvider;\r\nimport com.sencha.gxt.data.client.editor.ListStoreEditor;\r\nimport com.sencha.gxt.data.shared.Converter;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.data.shared.ModelKeyProvider;\r\nimport com.sencha.gxt.widget.core.client.form.NumberPropertyEditor;\r\nimport com.sencha.gxt.widget.core.client.form.SpinnerField;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.NameValueInteger;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches NameValueInteger model\r\n * type</b> <br>\r\n * </p>\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView\r\n */\r\npublic class NameValueIntegerEditorWidget extends GenericEditableListView<Integer, String> implements Editor<NameValueInteger> {\r\n    ListStoreEditor<Integer> values;\r\n\r\n    @Ignore\r\n    private SpinnerField<Integer> value;\r\n\r\n    /**\r\n     * NameValueInteger editable list default constructor.\r\n     * @param widgetTitle title of the widget (for the grid\'s panel header).\r\n     */\r\n    public NameValueIntegerEditorWidget(String widgetTitle) {\r\n        super(widgetTitle, new ListStore<Integer>(new IntegerKeyProvider()), new IntegerValueProvider());\r\n        values = new ListStoreEditor<Integer>(getStore());\r\n    }\r\n\r\n    /**\r\n     * This method assigns a specific field editor to the editable list widget for its edition mode.\r\n     */\r\n    @Override\r\n    protected void buildEditingFields() {\r\n        value = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());\r\n        value.setAllowBlank(false);\r\n        value.setWidth(\"auto\");\r\n//        this.setHeight(75);\r\n        value.setMinValue(1);\r\n        value.setIncrement(5);\r\n\r\n        Converter<String, Integer> converter = new Converter<String, Integer>() {\r\n            @Override\r\n            public String convertFieldValue(Integer object) {\r\n                String value = \"\";\r\n                if (object != null) {\r\n                    value = object.toString();\r\n                }\r\n                return value;\r\n            }\r\n\r\n            @Override\r\n            public Integer convertModelValue(String object) {\r\n                Integer value = 0;\r\n                if (object != null && object.trim().length() > 0) {\r\n                    value = Integer.parseInt(object);\r\n                }\r\n                return value;\r\n            }\r\n        };\r\n\r\n        addEditorConfig(converter, value);\r\n    }\r\n\r\n    /**\r\n     * This method return the Model factory that must be used for this list editor.\r\n     * @return Integer factory.\r\n     */\r\n    @Override\r\n    protected GridModelFactory<Integer> getModelFactory() {\r\n        return IntegerFactory.INSTANCE;\r\n    }\r\n\r\n    /**\r\n     * Defines the maximum number of element that can be stored in the widget.\r\n     * @param listMaxSize maximum number of element.\r\n     */\r\n    public void setListMaxSize(int listMaxSize) {\r\n        this.setStoreMaxLength(listMaxSize);\r\n    }\r\n\r\n    /**\r\n     * This method returns the list value provider.\r\n     * @return Integer ValueProvider.\r\n     */\r\n    @Override\r\n    protected ValueProvider<? super Integer, String> getValueProvider() {\r\n        return new IntegerValueProvider();\r\n    }\r\n\r\n    // Custom KeyProvider to deal with Integer\r\n    public static class IntegerKeyProvider implements ModelKeyProvider<Integer> {\r\n        @Override\r\n        public String getKey(Integer item) {\r\n            return item.toString();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Class that defines an Integer ValueProvider.\r\n     * It is a custom ValueProvider to deal with Integer.\r\n     */\r\n    public static class IntegerValueProvider implements ValueProvider<Integer, String> {\r\n\r\n        @Override\r\n        public String getValue(Integer object) {\r\n            return object.toString();\r\n        }\r\n\r\n        @Override\r\n        public void setValue(Integer object, String value) {\r\n            object = Integer.parseInt(value);\r\n        }\r\n\r\n        @Override\r\n        public String getPath() {\r\n            return null;\r\n        }\r\n\r\n    }\r\n}\r\n'),(4522,5639,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.core.client.ValueProvider;\r\nimport com.sencha.gxt.data.client.editor.ListStoreEditor;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.form.Validator;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.properties.String256Properties;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.BoundedTextField;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.NameValueString256;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches NameValueString256 model type</b>\r\n * </p>\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.GenericEditableListView\r\n */\r\npublic class NameValueString256EditorWidget extends GenericEditableListView<String256, String> implements Editor<NameValueString256> {\r\n    // instance of the property access for the String256 entity attributes (for the GXT Store).\r\n    private final static String256Properties PROPS = GWT.create(String256Properties.class);\r\n\r\n    // --- UI Widgets\r\n    ListStoreEditor<String256> values;\r\n    @Ignore\r\n    private BoundedTextField tf;\r\n\r\n    /**\r\n     * NameValueString256 editable list widget default constructor.\r\n     * @param widgetTitle title of the widget (for the grid\'s panel header).\r\n     */\r\n    public NameValueString256EditorWidget(String widgetTitle) {\r\n        super(widgetTitle, new ListStore<String256>(PROPS.key()), PROPS.string());\r\n        buildUI();\r\n    }\r\n\r\n    /**\r\n     * NameValueString256 editable list constructor.\r\n     * @param widgetTitle title of the widget (for the grid\'s panel header).\r\n     * @param listSize number of String256 objects that can be stored in the widget (list).\r\n     */\r\n    public NameValueString256EditorWidget(String widgetTitle,int listSize) {\r\n        super(widgetTitle, new ListStore<String256>(PROPS.key()), PROPS.string());\r\n        buildUI();\r\n        setStoreMaxLength(listSize);\r\n    }\r\n\r\n    /**\r\n     * Method that builds the widgets itself\r\n     */\r\n    private void buildUI() {\r\n        values = new ListStoreEditor<String256>(getStore());\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Method binding the UI with actions.\r\n     */\r\n    private void bindUI() {\r\n//        editing.addCompleteEditHandler(new CompleteEditEvent.CompleteEditHandler<String256>() {\r\n//            @Override\r\n//            public void onCompleteEdit(CompleteEditEvent<String256> event) {\r\n//                tf.validate();\r\n//                if (tf.getValue() == null || !tf.isValid()) {\r\n//                    tf.clear();\r\n//                    editing.startEditing(event.getEditCell());\r\n////                    editing.cancelEditing();\r\n////                    view.refresh(false);\r\n//                }\r\n//            }\r\n//        });\r\n    }\r\n\r\n    /**\r\n     * This method assigns a specific field editor to the editable list widget for its edition mode.\r\n     */\r\n    @Override\r\n    protected void buildEditingFields() {\r\n        tf = new BoundedTextField();\r\n        tf.setAllowBlank(false);\r\n        tf.setToolTip(\"This value is required and must unique.\");\r\n        tf.setEmptyText(\"ex: 58642j65s^^^5.8.4\");\r\n        addEditorConfig(tf);\r\n    }\r\n\r\n    @Override\r\n    protected GridModelFactory<String256> getModelFactory() {\r\n        return String256Factory.INSTANCE;\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     * @param toolTip tips about the tool.\r\n     */\r\n    public void setEditingFieldToolTip(String toolTip) {\r\n        tf.setToolTip(toolTip);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     * @param emptyText Default text displayed in an empty value field when editing\r\n     */\r\n    public void setEmptyTexts(String emptyText) {\r\n        tf.setEmptyText(emptyText);\r\n    }\r\n\r\n    /**\r\n     * Defines the maximum number of element that can be stored in the widget.\r\n     * @param maxSize maximum number of element.\r\n     */\r\n    public void setListMaxSize(int maxSize) {\r\n        setStoreMaxLength(maxSize);\r\n    }\r\n\r\n    /**\r\n     * This method add a Validator to the editable list entry editing widget.\r\n     * @param validator\r\n     */\r\n    public void addFieldValidator(Validator<String> validator) {\r\n        tf.addValidator(validator);\r\n    }\r\n\r\n    /**\r\n     * This method returns the list value provider.\r\n     * @return String256 ValueProvider.\r\n     */\r\n    @Override\r\n    protected ValueProvider<? super String256, String> getValueProvider() {\r\n        return PROPS.string();\r\n    }\r\n    //	/**\r\n//	 * Sets whether a field is valid when its value length = 0 (default to\r\n//	 * true). This will warn the user through the editor widget if he didn\'t\r\n//	 * input anything in field which does not allow blank.\r\n//	 *\r\n//	 * @param nameAllowsBlank\r\n//	 *            true to allow blank to the name field, false otherwise\r\n//	 * @param valueAllowsBlank\r\n//	 *            true to allow blank to the value field, false otherwise\r\n//	 *\r\n//	 */\r\n//	public void setAllowBlanks(boolean nameAllowsBlank, boolean valueAllowsBlank) {\r\n//		name.setAllowBlank(nameAllowsBlank);\r\n//		value.setAllowBlank(valueAllowsBlank);\r\n//	}\r\n}\r\n'),(4523,5640,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets.NameValueWidgets;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GridModelFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\n/**\r\n * Factory class that creates an instance of String256 for a GridEditor\r\n * (pattern used to solve a problem of java reflection in GWT).\r\n */\r\npublic enum String256Factory implements GridModelFactory<String256> {\r\n    INSTANCE;\r\n    private int counter=0;\r\n\r\n    /**\r\n     * This methods returns a new instance of String256 in order to avoid reflection in GWT.\r\n     * @return new instance of String256.\r\n     */\r\n    @Override\r\n    public String256 newInstance() {\r\n        counter++;\r\n        String256 value=GWT.create(String256.class);\r\n        value.setString(\"new value \"+counter);\r\n        return value;\r\n    }\r\n}\r\n'),(4524,5641,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.form.Validator;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.OID;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches OID model type</b> <br>\r\n * </p>\r\n */\r\npublic class OIDEditorWidget extends Composite implements Editor<OID> {\r\n    private final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n    String256EditorWidget oid = new String256EditorWidget();\r\n\r\n    public OIDEditorWidget(boolean displayLabel) {\r\n        initWidget(vcontainer);\r\n\r\n        if (displayLabel) {\r\n            EditorFieldLabel oidLabel = new EditorFieldLabel(oid, \"OID\");\r\n            vcontainer.add(oidLabel, new VerticalLayoutData(1, -1));\r\n        } else {\r\n            vcontainer.add(oid, new VerticalLayoutData(1, -1));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Adds a field validator that is meants to check the input oid.\r\n     * @param validator\r\n     */\r\n    public void addOIDValidator(Validator<String> validator) {\r\n        oid.addValidator(validator);\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param oidEmptyText Default text displayed in an empty field\r\n     */\r\n    public void setEmptyText(String oidEmptyText) {\r\n        oid.setEmptyText(oidEmptyText);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param config\r\n     */\r\n    public void setToolTipConfig(ToolTipConfig config) {\r\n        oid.setToolTipConfig(config);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param allowBlank true to allow blanks, false otherwise\r\n     */\r\n    public void setAllowBlank(boolean allowBlank) {\r\n        oid.setAllowBlank(allowBlank);\r\n    }\r\n}\r\n'),(4525,5642,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.widget.core.client.Composite;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.form.Validator;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.BoundedTextField;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents the widget which matches String256 model type</b>\r\n * </p>\r\n */\r\npublic class String256EditorWidget extends Composite implements Editor<String256> {\r\n    // --- UI Widgets\r\n    BoundedTextField string = new BoundedTextField();\r\n\r\n    /**\r\n     * Widget default constructor.\r\n     */\r\n    public String256EditorWidget() {\r\n        VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n        initWidget(vcontainer);\r\n        string.setMaxLength(256);\r\n        vcontainer.add(string, new VerticalLayoutData(1, -1));\r\n    }\r\n\r\n    /**\r\n     * This method sets the default text to display in an empty field (defaults\r\n     * to null). It is done to help and guide the user during his input.\r\n     *\r\n     * @param str Default text displayed in an empty field\r\n     */\r\n    public void setEmptyText(String str) {\r\n        string.setEmptyText(str);\r\n    }\r\n\r\n    /**\r\n     * Sets the widget\'s tool tip with the given config\r\n     *\r\n     * @param config\r\n     */\r\n    public void setToolTipConfig(ToolTipConfig config) {\r\n        string.setToolTipConfig(config);\r\n    }\r\n\r\n    /**\r\n     * Sets whether a field is valid when its value length = 0 (default to\r\n     * true). This will warn the user through the editor widget if he didn\'t\r\n     * input anything in field which does not allow blank.\r\n     *\r\n     * @param allowBlank true to allow blanks, false otherwise\r\n     */\r\n    public void setAllowBlank(boolean allowBlank) {\r\n        string.setAllowBlank(allowBlank);\r\n    }\r\n\r\n    /**\r\n     * Adds a fields validator that will verify the input value\r\n     * during the edition (client side validation).\r\n     * @param fieldValidator\r\n     */\r\n    public void addValidator(Validator<String> fieldValidator) {\r\n        string.addValidator(fieldValidator);\r\n    }\r\n\r\n    @Ignore\r\n    public BoundedTextField getField() {\r\n        return string;\r\n    }\r\n}\r\n'),(4526,5643,'package gov.nist.hit.ds.docentryeditor.client.editor.widgets;\r\n\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.google.gwt.editor.client.EditorError;\r\nimport com.sencha.gxt.widget.core.client.form.validator.AbstractValidator;\r\n\r\nimport java.util.List;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * Bill\'s UUID format validator adapted for client side validation in the editor.\r\n * Created by onh2 on 8/28/2014.\r\n */\r\npublic class UuidFormatClientValidator extends AbstractValidator<String> {\r\n    private final static Logger LOGGER = Logger.getLogger(UuidFormatClientValidator.class.getName());\r\n\r\n    static private boolean isLCHexString(String value) {\r\n        for (int i = 0; i < value.length(); i++) {\r\n            char c = value.charAt(i);\r\n            switch (c) {\r\n                case \'1\':\r\n                case \'2\':\r\n                case \'3\':\r\n                case \'4\':\r\n                case \'5\':\r\n                case \'6\':\r\n                case \'7\':\r\n                case \'8\':\r\n                case \'9\':\r\n                case \'0\':\r\n                case \'a\':\r\n                case \'b\':\r\n                case \'c\':\r\n                case \'d\':\r\n                case \'e\':\r\n                case \'f\':\r\n                    continue;\r\n                default:\r\n                    return false;\r\n            }\r\n        }\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public List<EditorError> validate(Editor<String> editor, String value) {\r\n        if (value == null)\r\n            return createError(editor, \"Can not be null\", value);\r\n        else if (!value.startsWith(\"urn:uuid:\")) {\r\n            if (value.length() == 36) {\r\n                String tmp = value;\r\n                tmp.replaceAll(\"-\", \"\");\r\n                if (isLCHexString(tmp)) {\r\n                    return createError(editor, \"Value is not a correct UUID. It does not have the right number of characters. It should be 45 and start with \'urn:uuid:\'.\", value);\r\n                }\r\n            }\r\n//            return createError(editor, \"Value does not start with \'urn:uuid:\'. It should.\", value);\r\n        } else {\r\n            if (value.length() != 45) {\r\n                String tmp = value;\r\n                if (isLCHexString(tmp.replaceAll(\"-\", \"\"))) {\r\n                    return createError(editor, \"Value is not a correct UUID. It does not have the right number of characters. It should be 45 and start with \'urn:uuid:\'.\", value);\r\n                }\r\n            } else {\r\n                LOGGER.info(\"else\");\r\n                String rest;\r\n                rest = value.substring(9);\r\n\r\n                if (!isLCHexString(rest.substring(0, 8)))\r\n                    return createError(editor, \"Value should be Hexadecimal.\", value);\r\n                rest = rest.substring(8);\r\n\r\n                if (!(rest.charAt(0) == \'-\'))\r\n                    return createError(editor, \"Value\'s 10th character should be a dash (-).\", value);\r\n                rest = rest.substring(1);\r\n\r\n                if (!isLCHexString(rest.substring(0, 4)))\r\n                    return createError(editor, \"Value should be Hexadecimal.\", value);\r\n                rest = rest.substring(4);\r\n\r\n                if (!(rest.charAt(0) == \'-\'))\r\n                    return createError(editor, \"Value\'s 15th character should be a dash (-).\", value);\r\n\r\n                rest = rest.substring(1);\r\n                if (!isLCHexString(rest.substring(0, 4)))\r\n                    return createError(editor, \"Value should be Hexadecimal.\", value);\r\n                rest = rest.substring(4);\r\n\r\n                if (!(rest.charAt(0) == \'-\'))\r\n                    return createError(editor, \"Value\'s 20th character should be a dash (-).\", value);\r\n\r\n                rest = rest.substring(1);\r\n                if (!isLCHexString(rest.substring(0, 4)))\r\n                    return createError(editor, \"Value should be Hexadecimal.\", value);\r\n                rest = rest.substring(4);\r\n\r\n                if (!(rest.charAt(0) == \'-\'))\r\n                    return createError(editor, \"Value\'s 25th character should be a dash (-).\", value);\r\n\r\n                rest = rest.substring(1);\r\n                if (!isLCHexString(rest.substring(0, 12)))\r\n                    return createError(editor, \"Value should be Hexadecimal.\", value);\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n\r\n}\r\n'),(4527,5645,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\n/**\r\n * GWT Event to request to move back to the application Home page.\r\n * Created by onh2 on 1/20/2015.\r\n */\r\npublic class BackToHomePageEvent extends GwtEvent<BackToHomePageEvent.BackToHomePageEventHandler> {\r\n    public static Type<BackToHomePageEventHandler> TYPE = new Type<BackToHomePageEventHandler>();\r\n\r\n    public BackToHomePageEvent(){\r\n    }\r\n\r\n    @Override\r\n    public Type<BackToHomePageEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(BackToHomePageEventHandler handler) {\r\n        handler.onBackToHomePage(this);\r\n    }\r\n\r\n    public interface BackToHomePageEventHandler extends EventHandler {\r\n        public void onBackToHomePage(BackToHomePageEvent event);\r\n    }\r\n}\r\n'),(4528,5646,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\n/**\r\n * Created by onh2 on 4/2/2015.\r\n */\r\npublic class ChangePlaceEvent extends GwtEvent<ChangePlaceEvent.ChangePlaceEventHandler> {\r\n    public static Type<ChangePlaceEventHandler> TYPE = new Type<ChangePlaceEventHandler>();\r\n\r\n    public ChangePlaceEvent(){\r\n    }\r\n\r\n    @Override\r\n    public Type<ChangePlaceEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(ChangePlaceEventHandler handler) {\r\n        handler.onPlaceChange(this);\r\n    }\r\n\r\n    public interface ChangePlaceEventHandler extends EventHandler {\r\n        public void onPlaceChange(ChangePlaceEvent event);\r\n    }\r\n}\r\n'),(4529,5647,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\n\r\n/**\r\n * This is a GwtEvent to request the creation of a new empty document entry.\r\n * Created by onh2 on 3/9/2015.\r\n */\r\npublic class CreateNewDocEntryEvent extends GwtEvent<CreateNewDocEntryEvent.CreateNewDocEntryEventHandler> {\r\n    public static GwtEvent.Type<CreateNewDocEntryEventHandler> TYPE = new Type<CreateNewDocEntryEventHandler>();\r\n    private XdsDocumentEntry documentEntry;\r\n\r\n    public CreateNewDocEntryEvent(XdsDocumentEntry documentEntry) {\r\n        this.documentEntry = documentEntry;\r\n    }\r\n\r\n    public XdsDocumentEntry getDocument() {\r\n        return documentEntry;\r\n    }\r\n\r\n    @Override\r\n    public Type<CreateNewDocEntryEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(CreateNewDocEntryEventHandler handler) {\r\n        handler.onCreateNewDocumentEntry(this);\r\n    }\r\n\r\n    public interface CreateNewDocEntryEventHandler extends EventHandler {\r\n        public void onCreateNewDocumentEntry(CreateNewDocEntryEvent event);\r\n    }\r\n}\r\n'),(4530,5648,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.LoadPrefilledDocEntryEvent.LoadPrefilledDocEntryEventHandler;\r\n/**\r\n * Gwt Event to request a pre-filled document entry to be loaded.\r\n * Created by onh2 on 1/16/2015.\r\n */\r\npublic class LoadPrefilledDocEntryEvent extends GwtEvent<LoadPrefilledDocEntryEventHandler>{\r\n    public static Type<LoadPrefilledDocEntryEventHandler> TYPE = new Type<LoadPrefilledDocEntryEventHandler>();\r\n\r\n    public LoadPrefilledDocEntryEvent(){\r\n    }\r\n\r\n    @Override\r\n    public Type<LoadPrefilledDocEntryEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(LoadPrefilledDocEntryEventHandler handler) {\r\n        handler.onLoadPrefilledDocEntryHandler(this);\r\n    }\r\n\r\n    public interface LoadPrefilledDocEntryEventHandler extends EventHandler {\r\n        public void onLoadPrefilledDocEntryHandler(LoadPrefilledDocEntryEvent event);\r\n    }\r\n}\r\n'),(4531,5649,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.web.bindery.event.shared.HandlerRegistration;\r\nimport com.google.web.bindery.event.shared.SimpleEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent.NewFileLoadedHandler;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.SaveFileEvent.SaveFileEventHandler;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsModelElement;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsSubmissionSet;\r\n\r\n/**\r\n * This is the application event bus. It is used through the entire application.\r\n * It has its own personalized handlers.\r\n */\r\npublic class MetadataEditorEventBus extends SimpleEventBus {\r\n    // TODO personalized handlers\r\n\r\n    /**\r\n     * Method that handle actions that must be triggered when a new file is loaded.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addNewFileLoadedHandler(NewFileLoadedHandler handler) {\r\n        return addHandler(NewFileLoadedEvent.TYPE, handler);\r\n    }\r\n\r\n    /**\r\n     * Method that signals to the event bus to the application that a new file has been loaded into the system.\r\n     * @param xdsMetadata\r\n     */\r\n    public void fireNewFileLoadedEvent(XdsMetadata xdsMetadata) {\r\n        fireEvent(new NewFileLoadedEvent(xdsMetadata));\r\n    }\r\n\r\n    /**\r\n     * Method that adds an handler for when a request to save a file is made.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addSaveFileEventHandler(SaveFileEventHandler handler) {\r\n        return addHandler(SaveFileEvent.TYPE, handler);\r\n    }\r\n\r\n    /**\r\n     * This method signals to the event bus to the entire application that request to save a file has been made.\r\n     */\r\n    public void fireSaveFileEvent() {\r\n        fireEvent(new SaveFileEvent());\r\n    }\r\n\r\n    /**\r\n     * This method adds an handler that will enable to trigger actions when a Document Entry starts to be edited.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addStartEditXdsDocumentHandler(StartEditXdsDocumentEvent.StartEditXdsDocumentHandler handler) {\r\n        return addHandler(StartEditXdsDocumentEvent.TYPE,handler);\r\n    }\r\n\r\n    /**\r\n     * This methods signals to the event bus a request to start editing a specific document entry.\r\n     * @param documentEntry\r\n     */\r\n    public void fireStartEditXdsDocumentEvent(XdsDocumentEntry documentEntry) {\r\n        fireEvent(new StartEditXdsDocumentEvent(documentEntry));\r\n    }\r\n\r\n    /**\r\n     * This method adds an handler that will enable to trigger actions when the Submission set starts to be edited.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addStartEditXdsSubmissionSetHandler(StartEditXdsSubmissionSetEvent.StartEditXdsSubmissionSetHandler handler) {\r\n        return addHandler(StartEditXdsSubmissionSetEvent.TYPE,handler);\r\n    }\r\n\r\n    /**\r\n     * This methods signals to the event bus a request to start editing a specific submission set.\r\n     * @param submissionSet\r\n     */\r\n    public void fireStartEditXdsSubmissionSetEvent(XdsSubmissionSet submissionSet) {\r\n        fireEvent(new StartEditXdsSubmissionSetEvent(submissionSet));\r\n    }\r\n\r\n    public HandlerRegistration addSaveCurrentlyEditedMetadataHandler(SaveCurrentlyEditedMetadataEvent.SaveCurrentlyEditedMetadataEventHandler handler) {\r\n        return addHandler(SaveCurrentlyEditedMetadataEvent.TYPE, handler);\r\n    }\r\n\r\n    public void fireSaveCurrentlyEditedMetadataEvent(XdsModelElement documentEntry) {\r\n        fireEvent(new SaveCurrentlyEditedMetadataEvent(documentEntry));\r\n    }\r\n\r\n    /**\r\n     * This method adds an handler that will take of the actions that must be triggered\r\n     * when the document entry editor is loaded.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addXdsEditorLoadedEventtHandler(XdsEditorLoadedEvent.XdsEditorLoadedEventHandler handler) {\r\n        return addHandler(XdsEditorLoadedEvent.TYPE, handler);\r\n    }\r\n\r\n    /**\r\n     * This methods signals to the event bus that the Xds Document Entry Editor has loaded.\r\n     */\r\n    public void fireXdsEditorLoadedEvent() {\r\n        fireEvent(new XdsEditorLoadedEvent());\r\n    }\r\n\r\n    public HandlerRegistration addLoadPreFilledDocEntryEventHandler(LoadPrefilledDocEntryEvent.LoadPrefilledDocEntryEventHandler handler) {\r\n        return addHandler(LoadPrefilledDocEntryEvent.TYPE, handler);\r\n    }\r\n    public void fireLoadPreFilledDocEntryEvent() {\r\n        fireEvent(new LoadPrefilledDocEntryEvent());\r\n    }\r\n\r\n    /**\r\n     * This method adds an event handler that will do the navigation to the home page.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addBackToHomePageEventHandler(BackToHomePageEvent.BackToHomePageEventHandler handler) {\r\n        return addHandler(BackToHomePageEvent.TYPE, handler);\r\n    }\r\n\r\n    /**\r\n     * This method signals to the event bus a request to navigate back to the home page of the application.\r\n     */\r\n    public void fireBackToHomePageEvent() {\r\n        fireEvent(new BackToHomePageEvent());\r\n    }\r\n\r\n    /**\r\n     * This method adds an event handler that will add the new document entry to the submission set tree.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addCreateNewDocEntryEventHandler(CreateNewDocEntryEvent.CreateNewDocEntryEventHandler handler){\r\n        return addHandler(CreateNewDocEntryEvent.TYPE,handler);\r\n    }\r\n\r\n    /**\r\n     * This method signals to the event bus a request to create a new empty document entry.\r\n     */\r\n    public void fireCreateNewDocEntryEvent(XdsDocumentEntry documentEntry) {\r\n        fireEvent(new CreateNewDocEntryEvent(documentEntry));\r\n    }\r\n\r\n    /**\r\n     * Notify the view is about to change Place.\r\n     */\r\n    public void firePlaceChangeEvent() {\r\n        fireEvent(new ChangePlaceEvent());\r\n    }\r\n\r\n    /**\r\n     * This method adds an handler that will handle actions required before a Place Change.\r\n     * @param handler\r\n     * @return\r\n     */\r\n    public HandlerRegistration addPlaceChangeEventHandler(ChangePlaceEvent.ChangePlaceEventHandler handler){\r\n        return addHandler(ChangePlaceEvent.TYPE,handler);\r\n    }\r\n\r\n    public void fireSelectSubmissionSetEvent() {\r\n        fireEvent(new SelectSubmissionSetEvent());\r\n    }\r\n}\r\n'),(4532,5650,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent.NewFileLoadedHandler;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\n\r\n/**\r\n * This is a GwtEvent to signal that a new ebRim file has been uploaded to the application.\r\n */\r\npublic class NewFileLoadedEvent extends GwtEvent<NewFileLoadedHandler> {\r\n\r\n    public static Type<NewFileLoadedHandler> TYPE = new Type<NewFileLoadedHandler>();\r\n    private final XdsMetadata metadata;\r\n\r\n    public NewFileLoadedEvent(XdsMetadata metadata) {\r\n        this.metadata = metadata;\r\n    }\r\n\r\n    public XdsMetadata getMetadata() {\r\n        return metadata;\r\n    }\r\n\r\n    @Override\r\n    public Type<NewFileLoadedHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(NewFileLoadedHandler handler) {\r\n        handler.onNewFileLoaded(this);\r\n    }\r\n\r\n    public interface NewFileLoadedHandler extends EventHandler {\r\n        public void onNewFileLoaded(NewFileLoadedEvent event);\r\n    }\r\n\r\n}\r\n'),(4533,5651,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsModelElement;\r\n\r\npublic class SaveCurrentlyEditedMetadataEvent extends GwtEvent<SaveCurrentlyEditedMetadataEvent.SaveCurrentlyEditedMetadataEventHandler> {\r\n\r\n	public interface SaveCurrentlyEditedMetadataEventHandler extends EventHandler {\r\n		public void onSaveCurrentlyEditedDocumentEvent(SaveCurrentlyEditedMetadataEvent event);\r\n	}\r\n\r\n    private XdsModelElement documentEntry;\r\n\r\n	public static Type<SaveCurrentlyEditedMetadataEventHandler> TYPE = new Type<SaveCurrentlyEditedMetadataEventHandler>();\r\n\r\n	public SaveCurrentlyEditedMetadataEvent(XdsModelElement documentEntry) {\r\n        this.documentEntry=documentEntry;\r\n	}\r\n\r\n	@Override\r\n	public Type<SaveCurrentlyEditedMetadataEventHandler> getAssociatedType() {\r\n		return TYPE;\r\n	}\r\n\r\n	@Override\r\n	protected void dispatch(SaveCurrentlyEditedMetadataEventHandler handler) {\r\n		handler.onSaveCurrentlyEditedDocumentEvent(this);\r\n	}\r\n\r\n    public XdsModelElement getMetadataModel(){\r\n        return documentEntry;\r\n    }\r\n}\r\n'),(4534,5652,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.SaveFileEvent.SaveFileEventHandler;\r\n\r\npublic class SaveFileEvent extends GwtEvent<SaveFileEventHandler> {\r\n\r\n	public interface SaveFileEventHandler extends EventHandler {\r\n		public void onFileSave(SaveFileEvent event);\r\n	}\r\n\r\n	public static Type<SaveFileEventHandler> TYPE = new Type<SaveFileEventHandler>();\r\n\r\n	public SaveFileEvent() {\r\n	}\r\n\r\n	@Override\r\n	public Type<SaveFileEventHandler> getAssociatedType() {\r\n		return TYPE;\r\n	}\r\n\r\n	@Override\r\n	protected void dispatch(SaveFileEventHandler handler) {\r\n		handler.onFileSave(this);\r\n	}\r\n\r\n}\r\n'),(4535,5653,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\n/**\r\n * Created by onh2 on 4/7/2015.\r\n */\r\npublic class SelectSubmissionSetEvent extends GwtEvent<SelectSubmissionSetEvent.SelectSubmissionSetEventHandler> {\r\n\r\n    public static Type<SelectSubmissionSetEventHandler> TYPE = new Type<SelectSubmissionSetEventHandler>();\r\n\r\n    @Override\r\n    public Type<SelectSubmissionSetEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(SelectSubmissionSetEventHandler handler) {\r\n        handler.onSelectSubmissionSet(this);\r\n    }\r\n\r\n    public interface SelectSubmissionSetEventHandler extends EventHandler {\r\n        public void onSelectSubmissionSet(SelectSubmissionSetEvent event);\r\n    }\r\n\r\n}\r\n'),(4536,5654,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\n\r\n/**\r\n * This is a GwtEvent to request a Document entry to be edited in the Xds Document Entry editor.\r\n */\r\npublic class StartEditXdsDocumentEvent extends GwtEvent<StartEditXdsDocumentEvent.StartEditXdsDocumentHandler> {\r\n\r\n    public static Type<StartEditXdsDocumentHandler> TYPE = new Type<StartEditXdsDocumentHandler>();\r\n    private XdsDocumentEntry fileContent;\r\n\r\n    public StartEditXdsDocumentEvent(XdsDocumentEntry fileContent) {\r\n        this.fileContent = fileContent;\r\n    }\r\n\r\n    @Override\r\n    public Type<StartEditXdsDocumentHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(StartEditXdsDocumentHandler handler) {\r\n        handler.onStartEditXdsDocument(this);\r\n    }\r\n\r\n    public XdsDocumentEntry getDocument() {\r\n        return fileContent;\r\n    }\r\n\r\n    public interface StartEditXdsDocumentHandler extends EventHandler {\r\n        public void onStartEditXdsDocument(StartEditXdsDocumentEvent event);\r\n    }\r\n}\r\n'),(4537,5655,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsSubmissionSet;\r\n\r\n/**\r\n * This is a GwtEvent to request a Xds Submission set to be edited in the Submission Set editor.\r\n * Created by onh2 on 7/18/2014.\r\n */\r\npublic class StartEditXdsSubmissionSetEvent extends GwtEvent<StartEditXdsSubmissionSetEvent.StartEditXdsSubmissionSetHandler> {\r\n\r\n    public static Type<StartEditXdsSubmissionSetHandler> TYPE = new Type<StartEditXdsSubmissionSetHandler>();\r\n    private XdsSubmissionSet submissionSet;\r\n\r\n    public StartEditXdsSubmissionSetEvent(XdsSubmissionSet submissionSet) {\r\n        this.submissionSet = submissionSet;\r\n    }\r\n\r\n    @Override\r\n    public Type<StartEditXdsSubmissionSetHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(StartEditXdsSubmissionSetHandler handler) {\r\n        handler.onStartEdit(this);\r\n    }\r\n\r\n    public XdsSubmissionSet getSumissionSet() {\r\n        return submissionSet;\r\n    }\r\n\r\n    public interface StartEditXdsSubmissionSetHandler extends EventHandler {\r\n        public void onStartEdit(StartEditXdsSubmissionSetEvent event);\r\n    }\r\n}\r\n'),(4538,5656,'package gov.nist.hit.ds.docentryeditor.client.event;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\n/**\r\n * This is a GwtEvent to signal that the Xds Document Entry editor has been loaded.\r\n */\r\npublic class XdsEditorLoadedEvent extends GwtEvent<XdsEditorLoadedEvent.XdsEditorLoadedEventHandler> {\r\n\r\n    public static Type<XdsEditorLoadedEventHandler> TYPE = new Type<XdsEditorLoadedEventHandler>();\r\n\r\n    public XdsEditorLoadedEvent() {\r\n    }\r\n\r\n    @Override\r\n    public Type<XdsEditorLoadedEventHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(XdsEditorLoadedEventHandler handler) {\r\n        handler.onXdsEditorLoaded(this);\r\n    }\r\n\r\n    public interface XdsEditorLoadedEventHandler extends EventHandler {\r\n        public void onXdsEditorLoaded(XdsEditorLoadedEvent event);\r\n    }\r\n\r\n}\r\n'),(4539,5658,'package gov.nist.hit.ds.docentryeditor.client.generics;\r\n\r\nimport com.google.gwt.user.client.ui.AcceptsOneWidget;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.google.web.bindery.event.shared.EventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.MetadataEditorAppView;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * Interface to declare a displayer pattern for gwt for activity place design.\r\n */\r\npublic interface ActivityDisplayer {\r\n	public void display(Widget w, AcceptsOneWidget p, EventBus b);\r\n\r\n    /**\r\n     * This is the displayer of the Metadata editor application. It enables to make the application more flexible\r\n     * and reduce the amount of code. This way there is only one part of the application that changes through the\r\n     * browser navigation while the rest of the application stays the same and keeps working.\r\n     */\r\n	public class MetadataEditorAppDisplayer implements ActivityDisplayer {\r\n		@Inject\r\n        private MetadataEditorAppView appView;\r\n\r\n		@Override\r\n		public void display(Widget w, AcceptsOneWidget p, EventBus b) {\r\n			appView.setCenterDisplay(w);\r\n		}\r\n	}\r\n}\r\n'),(4540,5659,'package gov.nist.hit.ds.docentryeditor.client.generics;\r\n\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.core.client.IdentityValueProvider;\r\nimport com.sencha.gxt.core.client.Style;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.fx.client.Draggable;\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;\r\nimport com.sencha.gxt.widget.core.client.box.MessageBox;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.*;\r\nimport com.sencha.gxt.widget.core.client.form.Field;\r\nimport com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnConfig;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnModel;\r\nimport com.sencha.gxt.widget.core.client.grid.Grid;\r\nimport com.sencha.gxt.widget.core.client.grid.editing.ClicksToEdit;\r\nimport com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;\r\nimport com.sencha.gxt.widget.core.client.tips.ToolTipConfig;\r\nimport com.sencha.gxt.widget.core.client.toolbar.ToolBar;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.ToolTipResources;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * Generic widget for Row Grid editing on double click. For each editable\r\n * field of the grid the method\r\n * {@link #addColumnEditorConfig(ColumnConfig, Field) addColumnEditorConfig}\r\n * should be called.\r\n * <p/>\r\n * Example:\r\n * <p/>\r\n * <pre>\r\n * <code>\r\n *      InternationalStringProperties isprops = GWT.create(InternationalStringProperties.class);\r\n *\r\n *      List<ColumnConfig<InternationalString, ?>> columnsConfigs = new ArrayList<ColumnConfig<InternationalString, ?>>();\r\n *      ColumnConfig<InternationalString, LanguageCode> cc1 = new ColumnConfig<InternationalString, LanguageCode>(isprops.langCode(), 15, \"Language Code\");\r\n *      ColumnConfig<InternationalString, String> cc2 = new ColumnConfig<InternationalString, String>(isprops.value(), 85, \"Title\");\r\n *      columnsConfigs.add(cc1);\r\n *      columnsConfigs.add(cc2);\r\n *      ColumnModel<InternationalString> columnModel = new ColumnModel<InternationalString>(columnsConfigs);\r\n *\r\n *      GenericEditableGrid<InternationalString> grid=new GenericEditableGrid<InternationalString>(InternationalString.class,\"Title\",new ListStore<InternationalString>(isprops.key()), columnModel);\r\n *      // grid.setCheckBoxSelectionModel();\r\n *\r\n *      LanguageCodeComboBox languageCodeComboBox = new LanguageCodeComboBox();\r\n *      languageCodeComboBox.setAllowBlank(false);\r\n *      // languageCodeComboBox.setToolTip(\"...\");\r\n *      TextField tf = new TextField();\r\n *      tf.setAllowBlank(false);\r\n *      // tf.setToolTip(\"...\");\r\n *\r\n *      grid.addColumnEditorConfig(cc1,languageCodeComboBox);\r\n *      grid.addColumnEditorConfig(cc2,tf);\r\n * </code>\r\n * </pre>\r\n *\r\n * @see Grid\r\n * Created by onh2 on 6/10/2014.\r\n */\r\npublic abstract class GenericEditableGrid<M> extends Grid<M> {\r\n    private final Logger logger = Logger.getLogger(this.getClass().getName());\r\n    // private Class<M> clazzM;\r\n\r\n    // --- UI Widgets.\r\n    private final VerticalLayoutContainer gridContainer = new VerticalLayoutContainer();\r\n    // Toolbar elements.\r\n    private final ToolBar toolBar = new ToolBar();\r\n    private final TextButton newItemButton = new TextButton();\r\n    private final TextButton deleteItemsButton = new TextButton();\r\n    private final TextButton clearButton = new TextButton();\r\n    private final TextButton helpButton = new TextButton();\r\n    private final ContentPanel pane = new ContentPanel();\r\n    private final ToolTipConfig helpTooltipConfig = new ToolTipConfig();\r\n    // grid editing.\r\n    protected GridRowEditing<M> editing;\r\n\r\n    // widget configuration variables.\r\n    private int storeMaxLength = 0;\r\n    private boolean checkBoxEnabled = false;\r\n    private boolean hasExtraWidget = false;\r\n    // toolbar configuration variables.\r\n    private boolean hasToolbar = true;\r\n    private boolean hasHelpButtonEnabled = false;\r\n    private boolean toolTipAutoShow = true;\r\n    private int extraWidgetCount=0;\r\n\r\n    // constants\r\n    private static final int DEFAULT_GRID_HEIGHT = 250;\r\n    private static final int DEFAULT_TOOLBAR_HEIGHT = 35;\r\n    private static final int ENTRY_HEIGHT = 30;\r\n    private static final int ESTIMATED_EXTRA_WIDGET_HEIGHT = 30;\r\n    private static final int DEFAULT_SINGLE_ENTRY_GRID_HEIGHT = 85;\r\n\r\n\r\n    /**\r\n     * Generic editable grid (abstract class) constructor.\r\n     * @param gridTitle the title of the widget (for the grid\'s panel header).\r\n     * @param listStore the store that will handle the list a values (object) manipulated by the grid.\r\n     */\r\n    public GenericEditableGrid(/* Class<M> parametrizedClass, */String gridTitle, ListStore<M> listStore) {\r\n        super(listStore, new ColumnModel<M>(new ArrayList<ColumnConfig<M, ?>>()));\r\n\r\n        this.cm = buildColumnModel();\r\n\r\n        // clazzM = parametrizedClass;\r\n        pane.setHeadingText(gridTitle);\r\n        pane.setBorders(false);\r\n        pane.setCollapsible(true);\r\n\r\n        this.getSelectionModel().setSelectionMode(Style.SelectionMode.SINGLE);\r\n\r\n        this.getView().setAutoFill(true);\r\n        this.setBorders(false);\r\n\r\n        this.addStyleName(\"grid-minheight\");\r\n        this.setHeight(DEFAULT_GRID_HEIGHT);\r\n\r\n        // toolbar configuration.\r\n        newItemButton.setIcon(AppImages.INSTANCE.add());\r\n        newItemButton.setToolTip(ToolTipResources.INSTANCE.getGridAddToolTip());\r\n        toolBar.add(newItemButton);\r\n        deleteItemsButton.setIcon(AppImages.INSTANCE.delete());\r\n        deleteItemsButton.setToolTip(ToolTipResources.INSTANCE.getGridDeleteToolTip());\r\n        toolBar.add(deleteItemsButton);\r\n        clearButton.setIcon(AppImages.INSTANCE.clear());\r\n        clearButton.setToolTip(ToolTipResources.INSTANCE.getGridClearTooltip());\r\n        toolBar.add(clearButton);\r\n        helpButton.setIcon(AppImages.INSTANCE.help());\r\n        helpButton.setTitle(ToolTipResources.INSTANCE.getHelpButtonToolTip());\r\n\r\n        // widget information help panel configuration.\r\n        helpTooltipConfig.setTitleText(\"Widget help\");\r\n        helpTooltipConfig.setAnchor(Style.Side.LEFT);\r\n        helpTooltipConfig.setCloseable(true);\r\n        helpTooltipConfig.setMouseOffsetX(0);\r\n        helpTooltipConfig.setMouseOffsetY(0);\r\n\r\n        gridContainer.add(toolBar);\r\n        gridContainer.add(super.asWidget(), new VerticalLayoutContainer.VerticalLayoutData(1, 1)); // VerticalLayoutData does not work here why?\r\n        pane.setWidget(gridContainer);\r\n\r\n        // makes the grid editable.\r\n        setEditable();\r\n        buildEditingFields();\r\n\r\n        // some tries to make grid fit panel\'s height.\r\n        this.getView().setAdjustForHScroll(false);\r\n        this.getView().setForceFit(true);\r\n        pane.forceLayout();\r\n        gridContainer.forceLayout();\r\n\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Abstract method meant to build the model that will define the different columns of the grid.\r\n     * @return grid column model.\r\n     */\r\n    protected abstract ColumnModel<M> buildColumnModel();\r\n\r\n    /**\r\n     * Abstract method meant to set a field widget for each column of the grid in edition mode.\r\n     */\r\n    protected abstract void buildEditingFields();\r\n\r\n    /**\r\n     * This method adds an extra widget to the widget just after the grid.\r\n     * @param widget widget to add to the widget.\r\n     */\r\n    protected void addWidget(Widget widget) {\r\n        hasExtraWidget = true;\r\n        extraWidgetCount++;\r\n        widget.addStyleName(\"topBorder\");\r\n        gridContainer.add(widget, new VerticalLayoutContainer.VerticalLayoutData(1, -1, new Margins(0, 4, 1, 4)));\r\n    }\r\n\r\n    /**\r\n     * This method adds extra widgets to the widget just after the grid.\r\n     * @param widgets multiple widgets to add to the widget.\r\n     */\r\n    protected void addWidgets(Widget... widgets) {\r\n        hasExtraWidget = true;\r\n        boolean firstDone = false;\r\n        for (Widget w : widgets) {\r\n            extraWidgetCount++;\r\n            if (firstDone == false) {\r\n                w.addStyleName(\"topBorder\");\r\n                firstDone = true;\r\n            }\r\n            gridContainer.add(w, new VerticalLayoutContainer.VerticalLayoutData(1, -1, new Margins(0, 4, 1, 4)));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Abstract method meant to return the desired ModelFactory for the editable grid.\r\n     * It is used for the create of a new \"Model\" instance.\r\n     * @return specific GridModelFactory\r\n     */\r\n    protected abstract GridModelFactory<M> getModelFactory();\r\n\r\n    /**\r\n     * Needs to be used to get the Grid Editable. It configures how the columns\r\n     * will be edited.\r\n     *\r\n     * @param columnConfig Grid\'s Column Configuration which will be associated to a type\r\n     *                     of editable field\r\n     * @param field        Editable field which will be used to edit the grid\'s Column\r\n     */\r\n    public <N> void addColumnEditorConfig(ColumnConfig<M, N> columnConfig, Field<N> field) {\r\n        editing.addEditor(columnConfig, field);\r\n    }\r\n\r\n    /**\r\n     * This method renders the widget.\r\n     * @return Editable grid widget.\r\n     */\r\n    public Widget getDisplay() {\r\n        pane.setResize(true);\r\n        return pane.asWidget();\r\n    }\r\n\r\n    /**\r\n     * Method that binds the actions related to the help panel and the tooltip button of the widget.\r\n     */\r\n    private void bindToolTips() {\r\n        helpButton.getToolTip().addShowHandler(new ShowEvent.ShowHandler() {\r\n            @Override\r\n            public void onShow(ShowEvent event) {\r\n                if (toolTipAutoShow)\r\n                    helpButton.getToolTip().hide();\r\n            }\r\n        });\r\n        helpButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                if (toolTipAutoShow) {\r\n                    toolTipAutoShow = false;\r\n                    helpButton.getToolTip().show();\r\n                } else {\r\n                    helpButton.getToolTip().hide();\r\n                }\r\n            }\r\n        });\r\n        helpButton.getToolTip().addHideHandler(new HideEvent.HideHandler() {\r\n            @Override\r\n            public void onHide(HideEvent event) {\r\n                toolTipAutoShow = true;\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Method that binds the widgets of the UI with actions.\r\n     */\r\n    private void bindUI() {\r\n        newItemButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                // try to fire an event\r\n                if (getStore().size() < storeMaxLength || storeMaxLength == 0) {\r\n                    editing.cancelEditing();\r\n                    // this method should work I don\'t understand why there is a problem.\r\n                    // M element = GWT.create(clazzM);\r\n                    M element = getModelFactory().newInstance();\r\n                    getStore().add(0, element);\r\n                    int index = 0;\r\n                    if (isCheckBoxEnabled()) {\r\n                        index = 1;\r\n                    }\r\n                    editing.startEditing(new Grid.GridCell(getStore().indexOf(element), index));\r\n                    if (getStore().size() >= storeMaxLength && storeMaxLength != 0) {\r\n                        disableNewButton();\r\n                    }\r\n                } else {\r\n                    MessageBox mb = new MessageBox(\"Error: list size limit reached\",\r\n                            \"You can not add more items to that list. This list can contain only \" + storeMaxLength\r\n                                    + \" items.\");\r\n                    mb.show();\r\n                }\r\n            }\r\n        });\r\n        deleteItemsButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmMessageBox d = new ConfirmMessageBox(\"Confirm delete action\",\r\n                        \"Are you sure you want to delete these values?\");\r\n                d.show();\r\n                d.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == Dialog.PredefinedButton.YES) {\r\n                            deleteSelectedItemAction();\r\n                            if (getStore().size() < storeMaxLength && storeMaxLength != 0) {\r\n                                enableNewButton();\r\n                            }\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n        clearButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                final ConfirmMessageBox d = new ConfirmMessageBox(\"Confirm clear action\",\r\n                        \"Are you sure you want to delete all values from this grid?\");\r\n                d.show();\r\n                d.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {\r\n                    @Override\r\n                    public void onDialogHide(DialogHideEvent event) {\r\n                        if (event.getHideButton() == Dialog.PredefinedButton.YES) {\r\n                            clearStoreAction();\r\n                            enableNewButton();\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Method that clears the grid store.\r\n     */\r\n    protected void clearStoreAction() {\r\n        getStore().clear();\r\n        getStore().commitChanges();\r\n    }\r\n\r\n    /**\r\n     * Method that delete the selected item from the grid.\r\n     */\r\n    protected void deleteSelectedItemAction() {\r\n        for (M e : getSelectionModel().getSelectedItems()) {\r\n            getStore().remove(e);\r\n            getStore().commitChanges();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method disable the editing option of the grid, which will not be editable anymore.\r\n     */\r\n    public void disableEditing() {\r\n        disableToolbar();\r\n        editing.clearEditors();\r\n    }\r\n\r\n    /**\r\n     * This method disables the new button of the widget (toolbar).\r\n     */\r\n    public void disableNewButton() {\r\n        newItemButton.disable();\r\n    }\r\n\r\n    /**\r\n     * This method enables the new button of the widget (toolbar).\r\n     */\r\n    public void enableNewButton() {\r\n        newItemButton.enable();\r\n    }\r\n\r\n    /**\r\n     * This method \"removes\" the toolbar of the grid widget.\r\n     */\r\n    public void disableToolbar() {\r\n        hasToolbar = false;\r\n        toolBar.disable();\r\n        toolBar.setVisible(false);\r\n    }\r\n\r\n    /**\r\n     * This method returns the toolbar of the widget.\r\n     * @return grid\'s toolbar.\r\n     */\r\n    public ToolBar getToolbar() {\r\n        return toolBar;\r\n    }\r\n\r\n    public boolean isCheckBoxEnabled() {\r\n        return checkBoxEnabled;\r\n    }\r\n\r\n    /**\r\n     * This method makes the grid editable on double click on an entry of the grid (Default behavior).\r\n     */\r\n    protected void setEditable() {\r\n        setEditable(ClicksToEdit.TWO);\r\n    }\r\n\r\n    /**\r\n     * This method makes the grid editable on the specified number of click on an entry of the grid (ONE or TWO).\r\n     * @param clicksToEdit number of clicks on value to enter the grid edition mode.\r\n     */\r\n    protected void setEditable(ClicksToEdit clicksToEdit) {\r\n        // EDITING //\r\n        editing = new GridRowEditing<M>(this);\r\n        editing.setClicksToEdit(clicksToEdit);\r\n        editing.addCompleteEditHandler(new CompleteEditEvent.CompleteEditHandler<M>() {\r\n            @Override\r\n            public void onCompleteEdit(CompleteEditEvent<M> completeEditEvent) {\r\n                getStore().commitChanges();\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This method enables to show or hide the widget header.\r\n     * @param visible\r\n     */\r\n    public void setHeaderVisible(boolean visible) {\r\n        pane.setHeaderVisible(visible);\r\n    }\r\n\r\n    /**\r\n     * This method enables to change the height of the widget.\r\n     * @param height\r\n     */\r\n    public void setHeight(int height) {\r\n        gridContainer.setHeight(height);\r\n        pane.setHeight(height);\r\n    }\r\n\r\n    /**\r\n     * This method calculates approximately the height of the grid widget based on the number of elements\r\n     * supposed to be registered in the grid.\r\n     * @param storeMaxLength estimated number of elements supposed to be stored in the grid.\r\n     */\r\n    protected void setStoreMaxLength(int storeMaxLength) {\r\n        this.storeMaxLength = storeMaxLength;\r\n        if (storeMaxLength == 1) {\r\n            this.setHeight(DEFAULT_SINGLE_ENTRY_GRID_HEIGHT + (hasToolbar == true ? DEFAULT_TOOLBAR_HEIGHT : 0) + (hasExtraWidget == true ? ESTIMATED_EXTRA_WIDGET_HEIGHT*extraWidgetCount : 0));\r\n        } else {\r\n            if (storeMaxLength < 11) {\r\n                this.setHeight((ENTRY_HEIGHT * storeMaxLength) + (hasToolbar == true ? DEFAULT_TOOLBAR_HEIGHT : 0) + (hasExtraWidget == true ? ESTIMATED_EXTRA_WIDGET_HEIGHT*extraWidgetCount : 0));\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method sets the content of the widget help panel.\r\n     * @param helpContent\r\n     */\r\n    public void setWidgetHelpContent(String helpContent) {\r\n        helpTooltipConfig.setBodyHtml(helpContent);\r\n        if (!hasHelpButtonEnabled) {\r\n            toolBar.add(helpButton);\r\n            hasHelpButtonEnabled = true;\r\n        }\r\n        helpButton.setToolTipConfig(helpTooltipConfig);\r\n        Draggable d = new Draggable(helpButton.getToolTip());\r\n        d.setUseProxy(false);\r\n        bindToolTips();\r\n    }\r\n\r\n    /**\r\n     * This method sets the widget help panel.\r\n     * @param helpContent\r\n     */\r\n    public void setToolbarHelpButtonTooltip(ToolTipConfig helpContent) {\r\n        helpTooltipConfig.setBodyHtml(helpContent.getBodyHtml());\r\n        helpTooltipConfig.setTitleHtml(helpContent.getTitleHtml());\r\n        if (!hasHelpButtonEnabled) {\r\n            toolBar.add(helpButton);\r\n            hasHelpButtonEnabled = true;\r\n        }\r\n        helpButton.setToolTipConfig(helpTooltipConfig);\r\n        Draggable d = new Draggable(helpButton.getToolTip());\r\n        d.setUseProxy(false);\r\n        bindToolTips();\r\n    }\r\n\r\n    /**\r\n     * This method return the maximum number of elements that can be stored in the grid.\r\n     * @return number of elements that can be stored in the grid.\r\n     */\r\n    public int getStoreMaxSize() {\r\n        return storeMaxLength;\r\n    }\r\n\r\n    public void refreshNewButton(){\r\n        if (getStoreMaxSize() != 0 && getStore().size() >= getStoreMaxSize()) {\r\n            disableNewButton();\r\n        } else {\r\n            enableNewButton();\r\n        }\r\n    }\r\n\r\n    //--------------------------------------------------------------------------------------------------------\r\n    //----  SHOULD NOT BE USED WITH GIRD ROW EDITING, ONLY WITH GRID INLINE EDITING\r\n    /**\r\n     * This Method enables the grid\'s selection checkbox column (for\r\n     * multiselection).\r\n     */\r\n    public void setCheckBoxSelectionModel() {\r\n        checkBoxEnabled = true;\r\n        List<ColumnConfig<M, ?>> columnsConfigs = new ArrayList<ColumnConfig<M, ?>>();\r\n        IdentityValueProvider<M> identityValueProvider = new IdentityValueProvider<M>();\r\n        CheckBoxSelectionModel<M> selectColumn = new CheckBoxSelectionModel<M>(identityValueProvider);\r\n        selectColumn.setSelectionMode(Style.SelectionMode.MULTI);\r\n        columnsConfigs.add(selectColumn.getColumn());\r\n        columnsConfigs.addAll(cm.getColumns());\r\n\r\n        this.cm = new ColumnModel<M>(columnsConfigs);\r\n\r\n        this.setSelectionModel(selectColumn);\r\n\r\n        setEditable();\r\n    }\r\n    //--------------------------------------------------------------------------------------------------------\r\n}\r\n'),(4541,5660,'package gov.nist.hit.ds.docentryeditor.client.generics;\r\n\r\nimport com.sencha.gxt.core.client.ValueProvider;\r\nimport com.sencha.gxt.data.shared.Converter;\r\nimport com.sencha.gxt.data.shared.ListStore;\r\nimport com.sencha.gxt.widget.core.client.form.Field;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnConfig;\r\nimport com.sencha.gxt.widget.core.client.grid.ColumnModel;\r\nimport com.sencha.gxt.widget.core.client.grid.editing.ClicksToEdit;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * Generic widget for Row list grid editing on double click.\r\n * Created by onh2 on 6/11/2014.\r\n */\r\npublic abstract class GenericEditableListView<M, N> extends GenericEditableGrid<M> {\r\n    protected ColumnConfig<M, N> cc1;\r\n    // - constants\r\n    private static final int COLUMN_WIDTH = 1000;\r\n\r\n    /**\r\n     * Abstract constructor\r\n     * @param listTitle header for the editable list widget\r\n     * @param listStore\r\n     * @param valueProvider\r\n     */\r\n    public GenericEditableListView(/*Class<M> parametrizedClass,*/ String listTitle, ListStore<M> listStore, ValueProvider<? super M, N> valueProvider) {\r\n        super(/*parametrizedClass,*/ listTitle, listStore);\r\n        this.setHideHeaders(true);\r\n    }\r\n\r\n    protected abstract ValueProvider<? super M, N> getValueProvider();\r\n\r\n    @Override\r\n    protected ColumnModel<M> buildColumnModel() {\r\n        List<ColumnConfig<M, ?>> columnsConfigs = new ArrayList<ColumnConfig<M, ?>>();\r\n        cc1 = new ColumnConfig<M, N>(getValueProvider(), COLUMN_WIDTH);\r\n        columnsConfigs.add(cc1);\r\n\r\n        return new ColumnModel<M>(columnsConfigs);\r\n    }\r\n\r\n    public void addEditorConfig(Field<N> field) {\r\n        // TODO consider exit edition on ENTER key press\r\n        editing.addEditor(cc1, field);\r\n    }\r\n\r\n    public <O> void addEditorConfig(Converter<N, O> converter, final Field<O> field) {\r\n        // TODO consider exit edition on ENTER key press\r\n        editing.addEditor(cc1, converter, field);\r\n    }\r\n\r\n    /**\r\n     * Should not be used, use addEditorConfig(Field<N> field) instead.\r\n     *\r\n     * @param columnConfig Grid\'s Column Configuration which will be associated to a type of editable field\r\n     * @param field        Editable field which will be used to edit the grid\'s Column\r\n     */\r\n    @Deprecated\r\n    @Override\r\n    public <N> void addColumnEditorConfig(ColumnConfig<M, N> columnConfig, final Field<N> field) {\r\n        super.addColumnEditorConfig(columnConfig, field);\r\n    }\r\n\r\n    public void setOneClickToEdit() {\r\n        setEditable(ClicksToEdit.ONE);\r\n    }\r\n}\r\n'),(4542,5661,'package gov.nist.hit.ds.docentryeditor.client.generics;\r\n\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractView;\r\n\r\n\r\npublic class GenericMVP<M, V extends AbstractView<P>, P extends AbstractPresenter<V>> //\r\n		extends AbstractMVP<M, V, P> {\r\n\r\n	private final V view;\r\n	private final P presenter;\r\n\r\n	// instance\r\n	public GenericMVP(V view, P presenter) {\r\n		this.view = view;\r\n		this.presenter = presenter;\r\n	}\r\n\r\n	@Override\r\n	public P buildPresenter() {\r\n		return presenter;\r\n	}\r\n\r\n	@Override\r\n	public V buildView() {\r\n		return view;\r\n	}\r\n\r\n}\r\n'),(4543,5662,'package gov.nist.hit.ds.docentryeditor.client.generics;\r\n\r\n/**\r\n * Factory to handle model related action for a grid.\r\n * Created by onh2 on 7/17/2014.\r\n */\r\npublic interface GridModelFactory<M> {\r\n    /**\r\n     * Factory method to return a new instance of grid element.\r\n     * This method must return GWT.create(\"M class\".class)\r\n     *\r\n     * @return M instance using GWT.create()\r\n     */\r\n    public M newInstance();\r\n}\r\n'),(4544,5664,'package gov.nist.hit.ds.docentryeditor.client.generics.abstracts;\r\n\r\nimport com.google.gwt.user.client.ui.Widget;\r\n\r\n/**\r\n * Generic class that handles the Model View Presenter design.\r\n * Used to build a set of View and Presenter handling a specific Model.\r\n *\r\n * @param <M> Model class\r\n * @param <V> Class that handles the View\r\n * @param <P> Class that handles the Presenter\r\n */\r\npublic abstract class AbstractMVP<M, V extends AbstractView<P>, P extends AbstractPresenter<V>> {\r\n\r\n	// Variable for the instance of the View of the instantiated MVP\r\n	private V view;\r\n	// Variable for the instance of the Presenter of the instantiated MVP\r\n	private P presenter;\r\n\r\n	/**\r\n	 * Default \"constructor\".\r\n 	 */\r\n	public AbstractMVP() {\r\n	}\r\n\r\n	/**\r\n	 * Abstract method whose implementation must build the view for this MVP.\r\n	 * @return View\r\n	 */\r\n	public abstract V buildView();\r\n\r\n	/**\r\n	 * Abstract method whose implementation must build the presenter for this MVP.\r\n	 * @return Presenter\r\n	 */\r\n	public abstract P buildPresenter();\r\n\r\n	/**\r\n	 * Method that initialize the MVP, instancing the view and the presenter (using abstract methods).\r\n	 */\r\n	public void init() {\r\n		// build\r\n		view = buildView();\r\n		presenter = buildPresenter();\r\n\r\n		// init\r\n		presenter.setView(view);\r\n		view.setPresenter(presenter);\r\n\r\n		presenter.init();\r\n		view.init();\r\n\r\n		// start\r\n		start();\r\n	}\r\n\r\n	/**\r\n	 * Method to start the view and the presenter.\r\n	 * It calls for initialization method from both the presenter and the view.\r\n	 */\r\n	public void start() {\r\n		presenter.start();\r\n		view.start();\r\n	}\r\n\r\n	/**\r\n	 * Method that return the view as a Widget\r\n	 * @return View as a Widget\r\n	 */\r\n	public Widget getDisplay() {\r\n		return view.asWidget();\r\n	}\r\n\r\n	/**\r\n	 * Getter that returns the View object of the MVP.\r\n	 * @return View\r\n	 */\r\n	public V getView() {\r\n		return view;\r\n	}\r\n\r\n	/**\r\n	 * Setter that changes the view object of the MVP.\r\n	 * @param view\r\n	 */\r\n	public void setView(V view) {\r\n		this.view = view;\r\n	}\r\n\r\n	/**\r\n	 * Getter that returns the Presenter object of the MVP.\r\n	 * @return Presenter\r\n	 */\r\n	public P getPresenter() {\r\n		return presenter;\r\n	}\r\n\r\n	/**\r\n	 * Setter that changes the Presenter object of the MVP.\r\n	 * @param presenter\r\n	 */\r\n	public void setPresenter(P presenter) {\r\n		this.presenter = presenter;\r\n	}\r\n\r\n}\r\n'),(4545,5665,'package gov.nist.hit.ds.docentryeditor.client.generics.abstracts;\r\n\r\nimport com.google.web.bindery.event.shared.EventBus;\r\n\r\nimport javax.inject.Inject;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * Generic class that handles the Presenter of the MVP design.\r\n * Used to build a Presenter for a given view.\r\n *\r\n * @param <V> Class that handles the View binded to this presenter\r\n */\r\npublic abstract class AbstractPresenter<V extends AbstractView<?>> {\r\n    // Logger\r\n    protected final Logger logger = Logger.getLogger(this.getClass().getName());\r\n\r\n    // EventBus to catch and fire events\r\n    @Inject\r\n    protected EventBus eventBus;\r\n\r\n    // Variable that handles the instance of the view binded to this presenter\r\n    protected V view;\r\n\r\n    /**\r\n     * Default \"constructor\"\r\n     */\r\n    @Inject\r\n    public AbstractPresenter() {\r\n    }\r\n\r\n    /**\r\n     * Constructor.\r\n     * @param eventBus Application event bus.\r\n     */\r\n    @Inject\r\n    public AbstractPresenter(EventBus eventBus) {\r\n        this.eventBus = eventBus;\r\n    }\r\n\r\n    /**\r\n     * Abstract method called by mvp before view.init() does not necessarily need to do something.\r\n     */\r\n    public abstract void init();\r\n\r\n    /**\r\n     * Abstract method called by mvp just before view.getDisplay()\r\n     */\r\n    public void start() {\r\n    }\r\n\r\n    /**\r\n     * Getter that returns the view object binded to this presenter.\r\n     * @return View\r\n     */\r\n    public V getView() {\r\n        return view;\r\n    }\r\n\r\n    /**\r\n     * Setter to change the view object binded to this presenter.\r\n     * @param view\r\n     */\r\n    public void setView(V view) {\r\n        this.view = view;\r\n    }\r\n\r\n    /**\r\n     * Getter that return the event bus of the presenter.\r\n     * @return Event bus of the Presenter (same than the one of the Application)\r\n     */\r\n    public EventBus getEventBus() {\r\n        return eventBus;\r\n    }\r\n\r\n    /**\r\n     * Method that sets the event bus of the presenter (should be the same than the one of the Application)\r\n     * @param eventBus\r\n     */\r\n    public void setEventBus(EventBus eventBus) {\r\n        this.eventBus = eventBus;\r\n    }\r\n\r\n}\r\n'),(4546,5666,'package gov.nist.hit.ds.docentryeditor.client.generics.abstracts;\r\n\r\nimport com.google.gwt.user.client.ui.IsWidget;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\n\r\nimport java.util.Map;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * Generic class that handles the View of the MVP design.\r\n * Used to build a View that work with a given type of presenter.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractPresenter\r\n * @param <P> Class that handles the Presenter binded to this View.\r\n */\r\npublic abstract class AbstractView<P extends AbstractPresenter<?>> implements IsWidget {\r\n    // class logger\r\n    protected final Logger logger = Logger.getLogger(this.getClass().getName());\r\n\r\n    protected P presenter;\r\n    protected Widget ui;\r\n    private ContentPanel cp;\r\n\r\n    protected Map<String, Widget> pathToWidgetsMap;\r\n\r\n    // instance\r\n    public AbstractView() {\r\n    }\r\n\r\n    /**\r\n     * This method initialize the view by building the view.\r\n     * (it calls the abstract method {@link #buildUI()} and {@link #bindUI()} ).\r\n     */\r\n    public void init() {\r\n        cp = new ContentPanel();\r\n        cp.setHeaderVisible(false);\r\n        cp.setBorders(false);\r\n        pathToWidgetsMap = getPathToWidgetsMap();\r\n        ui = buildUI();\r\n        cp.setWidget(ui);\r\n        bindUI();\r\n\r\n        // FIXME find a way to resolve resizing issues with fields Map solution is supposed to work but I don\'t know how...\r\n        /*\r\n        ResizeHandler resizeHandler=new ResizeHandler() {\r\n            @Override\r\n            public void onResize(ResizeEvent event) {\r\n                for(Widget w : pathToWidgetsMap.values()){\r\n                    //  w.setWidth(\"200\");\r\n                    cp.forceLayout();\r\n                    cp.setResize(true);\r\n                }\r\n            }\r\n        };\r\n        cp.addResizeHandler(resizeHandler);\r\n        Window.addResizeHandler(resizeHandler);\r\n        */\r\n    }\r\n\r\n    /**\r\n     * This is an abstract method supposed to build a collection of objects mapping a String key\r\n     * to a Widget.\r\n     * @return Map of widgets.\r\n     */\r\n    protected abstract Map<String, Widget> getPathToWidgetsMap();\r\n\r\n\r\n    public void start() {\r\n    }\r\n\r\n    /**\r\n     * This is an abstract method supposed to construct the view as a widget.\r\n     * @return view as a Widget.\r\n     */\r\n    abstract protected Widget buildUI();\r\n\r\n    /**\r\n     * This is an abstract method supposed to bind the different widgets of the view\r\n     * with action defined in the presenter.\r\n     */\r\n    abstract protected void bindUI();\r\n\r\n\r\n    // impl\r\n    @Override\r\n    public Widget asWidget() {\r\n        if (ui == null || cp == null)\r\n            init();\r\n        return cp;\r\n    }\r\n\r\n    // getter / setter\r\n    public P getPresenter() {\r\n        return presenter;\r\n    }\r\n\r\n    public void setPresenter(P presenter) {\r\n        this.presenter = presenter;\r\n    }\r\n}\r\n'),(4547,5668,'package gov.nist.hit.ds.docentryeditor.client.home;\r\n\r\nimport com.google.gwt.resources.client.ImageResource;\r\nimport com.sencha.gxt.cell.core.client.ButtonCell;\r\nimport com.sencha.gxt.widget.core.client.button.ToggleButton;\r\n\r\n/**\r\n * Class that create a button with icon and text for the home page.\r\n * Created by onh2 on 4/7/2015.\r\n */\r\npublic class HomeIconButton extends ToggleButton {\r\n    private final static int BUTTON_HEIGHT=50;\r\n    private final static int BUTTON_MIN_WIDTH=50;\r\n\r\n    public HomeIconButton(String title, ImageResource icon){\r\n        super(title);\r\n        setIcon(icon);\r\n        setIconAlign(ButtonCell.IconAlign.TOP);\r\n        setHeight(BUTTON_HEIGHT);\r\n        setMinWidth(BUTTON_MIN_WIDTH);\r\n    }\r\n}\r\n'),(4548,5669,'package gov.nist.hit.ds.docentryeditor.client.home;\r\n\r\nimport com.google.gwt.activity.shared.AbstractActivity;\r\nimport com.google.gwt.event.shared.EventBus;\r\nimport com.google.gwt.user.client.ui.AcceptsOneWidget;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.ActivityDisplayer;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class WelcomeActivity extends AbstractActivity {\r\n\r\n    @Inject\r\n    ActivityDisplayer displayer;\r\n	@Inject\r\n	WelcomePanel welcomePanel;\r\n\r\n	@Override\r\n	public void start(AcceptsOneWidget panel, EventBus eventBus) {\r\n		displayer.display(welcomePanel.asWidget(),panel,eventBus);\r\n	}\r\n\r\n	@Override\r\n	public String mayStop() {\r\n		return null;\r\n	}\r\n\r\n}\r\n'),(4549,5670,'package gov.nist.hit.ds.docentryeditor.client.home;\r\n\r\nimport com.google.gwt.place.shared.PlaceController;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.google.web.bindery.event.shared.EventBus;\r\nimport com.sencha.gxt.core.client.dom.ScrollSupport;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.ToolTipResources;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.PageWarningPanel;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.uploader.FileUploadDialog;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class WelcomePanel extends VerticalLayoutContainer {\r\n\r\n    @Inject\r\n    protected EventBus eventBus;\r\n\r\n    @Inject\r\n    FileUploadDialog fileUploadDialog;\r\n\r\n    @Inject\r\n    PlaceController placeController;\r\n\r\n    private HomeIconButton newFolderBtn;\r\n    private HomeIconButton newDocEntryBtn;\r\n    private HomeIconButton loadPreFilledDocEntryBtn;\r\n    private HomeIconButton uploadFileBtn;\r\n    private HomeIconButton editSubSetBtn;\r\n\r\n    /**\r\n     * Default constructor.\r\n     */\r\n    public WelcomePanel() {\r\n        buildUI();\r\n        bindUI();\r\n    }\r\n\r\n    /**\r\n     * Method that builds the widget.\r\n     */\r\n    private void buildUI() {\r\n        // set container\'s parameters\r\n        this.setStyleName(\"padding-10\");\r\n        setBorders(false);\r\n\r\n        // set html welcome explanation panel\r\n        HtmlLayoutContainer htmlExplanationTitle=new HtmlLayoutContainer(\"<br/><h2>Welcome to the XDS Document Entry Editor</h2>\");\r\n        HtmlLayoutContainer htmlExplanation=new HtmlLayoutContainer(\"<br/>This application was developed by the National Institute of Standards and Technology \" +\r\n                \"to generate custom XDS metadata for testing purposes. This software is based on the specification \" +\r\n                \"<a href=\'http://www.ihe.net/uploadedFiles/Documents/ITI/IHE_ITI_TF_Rev10.0_Vol3_FT_2013-09-27.pdf\' target=\'_blank\'>IHE IT Infrastructure Technical Framework Volume 3 (ITI TF-3)</a>.<br/>\" +\r\n                \"To start, use the buttons below or the left panel to create Document Entry objects. <br/><br/>\");\r\n\r\n        // set home buttons to create xds elements\r\n        newFolderBtn = new HomeIconButton(\"New folder\",AppImages.INSTANCE.newFolder());\r\n        // temporary disable new folder btn until it s implemented.\r\n        newFolderBtn.disable();\r\n        editSubSetBtn=new HomeIconButton(\"Edit Submission set\",AppImages.INSTANCE.editSubSet());\r\n        editSubSetBtn.setToolTip(ToolTipResources.INSTANCE.getEditSubSetTooltip());\r\n        newDocEntryBtn = new HomeIconButton(\"New doc. entry\",AppImages.INSTANCE.filePlus());\r\n        newDocEntryBtn.setToolTip(ToolTipResources.INSTANCE.getNewDocEntryTooltip());\r\n        loadPreFilledDocEntryBtn = new HomeIconButton(\"New pre-filled doc. entry\",AppImages.INSTANCE.preFilled());\r\n        loadPreFilledDocEntryBtn.setToolTip(ToolTipResources.INSTANCE.getNewPrefilledDocEntryTooltip());\r\n        uploadFileBtn = new HomeIconButton(\"Upload Submission set\",AppImages.INSTANCE.loadFile());\r\n        uploadFileBtn.setToolTip(ToolTipResources.INSTANCE.getUploadFileTooltip());\r\n\r\n        // - organize buttons layout\r\n        VerticalLayoutContainer submissionSetButtonsContainer = new VerticalLayoutContainer();\r\n        submissionSetButtonsContainer.add(uploadFileBtn,new VerticalLayoutData(1,-1,new Margins(0,0,50,0)));\r\n        submissionSetButtonsContainer.add(editSubSetBtn,new VerticalLayoutData(1,-1,new Margins(50,0,0,0)));\r\n        VerticalLayoutContainer folderButtonsContainer=new VerticalLayoutContainer();\r\n        folderButtonsContainer.add(newFolderBtn,new VerticalLayoutData(1,-1,new Margins(0,0,50,0)));\r\n        VerticalLayoutContainer docEntryButtonsContainer=new VerticalLayoutContainer();\r\n        docEntryButtonsContainer.add(newDocEntryBtn,new VerticalLayoutData(1,-1,new Margins(0,0,50,0)));\r\n        docEntryButtonsContainer.add(loadPreFilledDocEntryBtn,new VerticalLayoutData(1,-1,new Margins(50,0,0,0)));\r\n\r\n		// add home buttons to a Horizontal container\r\n		HorizontalLayoutContainer buttonsHContainer= new HorizontalLayoutContainer();\r\n        buttonsHContainer.add(submissionSetButtonsContainer,new HorizontalLayoutContainer.HorizontalLayoutData(0.33,-1,new Margins(5,50,5,0)));\r\n        buttonsHContainer.add(folderButtonsContainer,new HorizontalLayoutContainer.HorizontalLayoutData(0.33,-1,new Margins(5,50,5,50)));\r\n        buttonsHContainer.add(docEntryButtonsContainer,new HorizontalLayoutContainer.HorizontalLayoutData(0.33,-1,new Margins(5,0,5,50)));\r\n\r\n		// Set home page warning panel\r\n		PageWarningPanel warningPanel = new PageWarningPanel(\"<strong style=\'font-size:1.15em\'>Warning:</strong> This software is still under development.<br/>\" +\r\n				\"<ul><li>The functionalities Folder and Association are not implemented yet.</li>\" +\r\n				\"</ul>\");\r\n\r\n		this.add(htmlExplanationTitle);\r\n		this.add(htmlExplanation);\r\n		this.add(buttonsHContainer, new VerticalLayoutData(1, 120));\r\n		this.add(warningPanel, new VerticalLayoutData(1, -1));\r\n        this.setScrollMode(ScrollSupport.ScrollMode.AUTO);\r\n	}\r\n\r\n    /**\r\n     * Method that ties actions with the view.\r\n     */\r\n	private void bindUI() {\r\n		newDocEntryBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n			@Override\r\n			public void onSelect(SelectEvent selectEvent) {\r\n                ((MetadataEditorEventBus) eventBus).fireCreateNewDocEntryEvent(new XdsDocumentEntry());\r\n			}\r\n		});\r\n		loadPreFilledDocEntryBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n			@Override\r\n			public void onSelect(SelectEvent selectEvent) {\r\n                ((MetadataEditorEventBus) eventBus).fireLoadPreFilledDocEntryEvent();\r\n			}\r\n		});\r\n		uploadFileBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                fileUploadDialog.init();\r\n                fileUploadDialog.show();\r\n            }\r\n        });\r\n        editSubSetBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                ((MetadataEditorEventBus) eventBus).fireSelectSubmissionSetEvent();\r\n            }\r\n        });\r\n	}\r\n\r\n	@Override\r\n	public Widget asWidget() {\r\n		return this;\r\n	}\r\n\r\n}\r\n'),(4550,5671,'package gov.nist.hit.ds.docentryeditor.client.home;\r\n\r\nimport com.google.gwt.place.shared.Place;\r\nimport com.google.gwt.place.shared.PlaceTokenizer;\r\n\r\npublic class WelcomePlace extends Place {\r\n\r\n	private String welcomeName;\r\n\r\n	public WelcomePlace(String token) {\r\n		this.welcomeName = token;\r\n	}\r\n\r\n	public WelcomePlace() {\r\n		super();\r\n	}\r\n\r\n	public String getWelcomeName() {\r\n		return this.welcomeName;\r\n	}\r\n\r\n	public static class Tokenizer implements PlaceTokenizer<WelcomePlace> {\r\n		@Override\r\n		public String getToken(WelcomePlace place) {\r\n			return place.getWelcomeName();\r\n		}\r\n\r\n		@Override\r\n		public WelcomePlace getPlace(String token) {\r\n			return new WelcomePlace(token);\r\n		}\r\n	}\r\n\r\n}\r\n'),(4551,5673,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nimport com.google.gwt.user.client.Window;\r\nimport com.google.gwt.xml.client.DOMException;\r\n\r\n/**\r\n *\r\n * <b>This class prepares a XML file to be parsed</b>\r\n *\r\n * <p>\r\n * To do it, here are the following variables required\r\n * </p>\r\n * <ul>\r\n * <li>{@link #PRE_PARSE} : The PreParse object, this class is a singleton\r\n * (PreParse) ;</li>\r\n * <li>{@link #documentXml} : The String which contains the XML data (String).</li>\r\n * </ul>\r\n * </p>\r\n *\r\n * <p>\r\n * This class also contains getters/setters.<br>\r\n * In addition, it contains several methods such as cleanEscape to delete\r\n * unexpected space or allowUTF8 to enable UTF8 character in\r\n * {@link #documentXml}.\r\n * </p>\r\n *\r\n * <p>\r\n * <b>How it works ?</b><br>\r\n * This class is a singleton which the only instance is called by a\r\n * {@link gov.nist.hit.ds.docentryeditor.client.parser.XdsParser} object, then it enables to prepare the String thanks to\r\n * cleanEscape and allowUTF called in the doPreParse method as follows:\r\n * {@link #doPreParseUTF8(String)}.</br>\r\n * </p>\r\n *\r\n *\r\n * <p>\r\n * <b>See below each method mentioned above or come back to an other class.</b>\r\n * <br>\r\n * {@link #cleanEscape()}</br> {@link #allowUTF8()} <br>\r\n * {@link #doPreParseUTF8(String)} </br>\r\n * </p>\r\n *\r\n *\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.parser.XdsParser\r\n *\r\n */\r\npublic class PreParse {\r\n\r\n	/**\r\n	 * <p>\r\n	 *\r\n	 * documentXml - The data taken from the XML document and send by the\r\n	 * server, this is the String to parser.<br>\r\n	 * Type : String</br>\r\n	 * </p>\r\n	 *\r\n	 * @see gov.nist.hit.ds.docentryeditor.client.parser.PreParse\r\n	 * @see gov.nist.hit.ds.docentryeditor.client.parser.XdsParser\r\n	 */\r\n	private static String documentXml;\r\n\r\n	/**\r\n	 * <p>\r\n	 *\r\n	 * PRE_PARSE - The instance of PreParse class (it\'s a singleton class).<br>\r\n	 * Type : PreParse</br>\r\n	 * </p>\r\n	 *\r\n	 *\r\n	 * @see gov.nist.hit.ds.docentryeditor.client.parser.PreParse\r\n	 */\r\n	private final static PreParse PRE_PARSE = new PreParse();\r\n\r\n	public static PreParse getInstance() {\r\n		return PRE_PARSE;\r\n	}\r\n\r\n	public String doPreParseUTF8(String msg) {\r\n		documentXml = msg;\r\n		cleanEscape();\r\n		allowUTF8();\r\n		return documentXml;\r\n	}\r\n\r\n	public String doPreParse(String msg) {\r\n		documentXml = msg;\r\n		cleanEscape();\r\n		return documentXml;\r\n	}\r\n\r\n	/**\r\n	 * <p>\r\n	 * <b>Method cleanEscape</b> <br>\r\n	 * It uses a {@link StringBuilder} to copy the data\'s XML without unexpected\r\n	 * space.</br>It analysis char by char whether there are too much space.<br>\r\n	 * This method is called by {@link #doPreParseUTF8(String)}.\r\n	 * </p>\r\n	 *\r\n	 *\r\n	 * @see gov.nist.hit.ds.docentryeditor.client.parser.PreParse\r\n	 *\r\n	 */\r\n	private void cleanEscape() {\r\n		StringBuilder xmlWithoutEscape = new StringBuilder();\r\n		try {\r\n			// Delete escape between > <\r\n\r\n			for (int i = 0; i < documentXml.length(); i++) {\r\n				char c = documentXml.charAt(i);\r\n				// c == 32 <=> c = \' \'\r\n				if (c == 32) {\r\n					// Delete escape after an escape or after > (==62) or before\r\n					// < (==60)\r\n					if (!(documentXml.charAt(i - 1) == 62\r\n							|| documentXml.charAt(i - 1) == 32\r\n							|| documentXml.charAt(i + 1) == 60)) {\r\n						xmlWithoutEscape.append(c);\r\n					}\r\n				} else {\r\n					xmlWithoutEscape.append(c);\r\n				}\r\n			}\r\n		} catch (DOMException e) {\r\n			Window.alert(\"Could not parse XML document.\");\r\n		}\r\n		documentXml = xmlWithoutEscape.toString();\r\n	}\r\n\r\n	/**\r\n	 * <p>\r\n	 * <b>Method allowUTF8</b> <br>\r\n	 * It uses a {@link StringBuilder} to copy the data\'s XML with available\r\n	 * UTF8 characters.</br>It analysis char by char whether there are UTF8\r\n	 * characters.<br>\r\n	 * This method is called by {@link #doPreParseUTF8(String)}.\r\n	 * </p>\r\n	 *\r\n	 *\r\n	 * @see gov.nist.hit.ds.docentryeditor.client.parser.PreParse\r\n	 *\r\n	 */\r\n	private void allowUTF8() {\r\n		// For the UTF-8 caracters : replace by their ASCII number\r\n		StringBuilder xmlEscaped = new StringBuilder();\r\n		for (int i = 0; i < documentXml.toString().length(); i++) {\r\n			char c = documentXml.toString().charAt(i);\r\n			if (c < 127) {\r\n				if (c == 38) {\r\n					// caracter &\r\n					xmlEscaped.append(\"&#\" + ((int) c) + \";\");\r\n				} else {\r\n					// to avoid \\n \\t \\s, warning : pb if \\\\n \\\\t \\\\s\r\n					if (c == 92\r\n							&& (documentXml.charAt(i + 1) == \'t\'\r\n									|| documentXml.charAt(i + 1) == \'n\' || documentXml\r\n									.charAt(i + 1) == \'s\')) {\r\n						i = i + 1;\r\n					} else {\r\n						// character TAB LF VT\r\n						if (!(c == 9 || c == 10 || c == 11)){\r\n							xmlEscaped.append(c);\r\n						}\r\n					}\r\n				}\r\n			} else {\r\n				xmlEscaped.append(\"&#\" + ((int) c) + \";\");\r\n			}\r\n		}\r\n		// replace &lt and &gt\r\n		String xmlEscapedString = xmlEscaped.toString().replaceAll(\"&lt;\", \"<\");\r\n		xmlEscapedString = xmlEscapedString.replaceAll(\"&gt;\", \">\");\r\n		documentXml = xmlEscapedString;\r\n\r\n	}\r\n}\r\n'),(4552,5674,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\n/**\r\n * Enumeration of the different types of existing codes.\r\n */\r\npublic enum PredefinedCodes {\r\n    CLASS_CODES, CONFIDENTIALITY_CODES, FORMAT_CODES, HEALTHCARE_FACILITY_TYPE_CODES, PRACTICE_SETTING_CODES, EVENT_CODES, TYPE_CODES,CONTENT_TYPE_CODE;\r\n}\r\n'),(4553,5675,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nimport com.google.gwt.xml.client.Document;\r\nimport com.google.gwt.xml.client.Element;\r\nimport com.google.gwt.xml.client.NodeList;\r\nimport com.google.gwt.xml.client.XMLParser;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppResources;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodedTerm;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.CodingScheme;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Collections;\r\nimport java.util.Comparator;\r\nimport java.util.List;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * This class is the service that parses and enables to retrieve existing codes\r\n * from an application file.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.parser.PredefinedCodes\r\n */\r\npublic enum PredefinedCodesParser {\r\n    // this class is a singleton.\r\n    INSTANCE;\r\n\r\n    // Class logger.\r\n    @SuppressWarnings(\"GwtInconsistentSerializableClass\")\r\n    private final Logger logger = Logger.getLogger(this.getClass().getName());\r\n\r\n    // name of the root node of the file containing the existing codes.\r\n    private final static String CONFIG_FILE_ROOT_NODE = \"CodeType\";\r\n\r\n    // XML Parsed document.\r\n    @SuppressWarnings(\"GwtInconsistentSerializableClass\")\r\n    private final static Document DOM = XMLParser.parse(PreParse.getInstance().doPreParse(\r\n            AppResources.INSTANCE.codes().getText()));\r\n\r\n    // list of nodes corresponding to each type of codes\r\n    @SuppressWarnings(\"GwtInconsistentSerializableClass\")\r\n    private static final NodeList NODES = DOM.getElementsByTagName(CONFIG_FILE_ROOT_NODE);\r\n\r\n    // list of existing content type codes.\r\n    private final List<CodedTerm> contentTypeCodes = new ArrayList<CodedTerm>();\r\n    // list of existing class codes.\r\n    private final List<CodedTerm> classCodes = new ArrayList<CodedTerm>();\r\n    // list of existing format codes.\r\n    private final List<CodedTerm> formatCodes = new ArrayList<CodedTerm>();\r\n    // list of existing healthcare facility type codes.\r\n    private final List<CodedTerm> healthcareFacilityTypeCodes = new ArrayList<CodedTerm>();\r\n    // list of existing practice setting codes.\r\n    private final List<CodedTerm> practiceSettingCodes = new ArrayList<CodedTerm>();\r\n    // list of existing type codes.\r\n    private final List<CodedTerm> typeCodes = new ArrayList<CodedTerm>();\r\n    // list of existing confidentiality codes.\r\n    private final List<CodedTerm> confidentialityCodes = new ArrayList<CodedTerm>();\r\n    // list of existing event codes.\r\n    private final List<CodedTerm> eventCodes = new ArrayList<CodedTerm>();\r\n    // list of existing mime types.\r\n    private final List<String256> mimeTypes = new ArrayList<String256>();\r\n\r\n    /**\r\n     * Method that retrieves a required list of codes.\r\n     * @param predefinedCodes type of codes required.\r\n     * @return list of codes\r\n     */\r\n    public List<CodedTerm> getCodes(PredefinedCodes predefinedCodes) {\r\n        List<CodedTerm> result=null;\r\n        if (predefinedCodes.equals(PredefinedCodes.CLASS_CODES)) {\r\n            if (classCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for class codes...\");\r\n                classCodes.addAll(parseNode(ConfigCodeNodes.classCode.toString()));\r\n                logger.info(\"... class codes retrieved from file.\");\r\n            }\r\n            result= classCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.FORMAT_CODES)) {\r\n            if (formatCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for format codes...\");\r\n                formatCodes.addAll(parseNode(ConfigCodeNodes.formatCode.toString()));\r\n                logger.info(\"... format codes retrieved from file.\");\r\n            }\r\n            result=formatCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.HEALTHCARE_FACILITY_TYPE_CODES)) {\r\n            if (healthcareFacilityTypeCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for healthcare facility type codes...\");\r\n                healthcareFacilityTypeCodes.addAll(parseNode(ConfigCodeNodes.healthcareFacilityTypeCode.toString()));\r\n                logger.info(\"... healthcare facility type codes retrieved from file.\");\r\n            }\r\n            result = healthcareFacilityTypeCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.PRACTICE_SETTING_CODES)) {\r\n            if (practiceSettingCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for practice setting codes...\");\r\n                practiceSettingCodes.addAll(parseNode(ConfigCodeNodes.practiceSettingCode.toString()));\r\n                logger.info(\"... practice setting codes retrieved from file.\");\r\n            }\r\n            result = practiceSettingCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.TYPE_CODES)) {\r\n            if (typeCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for type codes...\");\r\n                typeCodes.addAll(parseNode(ConfigCodeNodes.typeCode.toString()));\r\n                logger.info(\"... type codes retrieved from file.\");\r\n            }\r\n            result = typeCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.CONTENT_TYPE_CODE)) {\r\n            if (contentTypeCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for content type codes...\");\r\n                contentTypeCodes.addAll(parseNode(ConfigCodeNodes.contentTypeCode.toString()));\r\n                logger.info(\"... content type codes retrieved from file.\");\r\n            }\r\n            result = contentTypeCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.CONFIDENTIALITY_CODES)) {\r\n            if (confidentialityCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for confidentiality codes...\");\r\n                confidentialityCodes.addAll(parseNode(ConfigCodeNodes.confidentialityCode.toString()));\r\n                logger.info(\"... confidentiality codes retrieved from file.\");\r\n            }\r\n            result= confidentialityCodes;\r\n        } else if (predefinedCodes.equals(PredefinedCodes.EVENT_CODES)) {\r\n            if (eventCodes.size() == 0) {\r\n                logger.info(\"Parsing codes file for event codes...\");\r\n                eventCodes.addAll(parseNode(ConfigCodeNodes.eventCodeList.toString()));\r\n                logger.info(\"... event codes retrieved from file.\");\r\n            }\r\n            result = eventCodes;\r\n        }\r\n        return result;\r\n    }\r\n\r\n    /**\r\n     * Method that parses, sorts and returns a list of codes from a node\r\n     * regardless of the type of code being parsed.\r\n     * @param nodeName name of the nome to parser.\r\n     * @return list of parsed and sorted codes.\r\n     */\r\n    private List<CodedTerm> parseNode(String nodeName) {\r\n        int index = 0;\r\n        List<CodedTerm> temp = new ArrayList<CodedTerm>();\r\n        while (!(((Element) NODES.item(index)).getAttribute(ConfigCodeNodes.CodeAttributes.name.toString()).equals(nodeName))) {\r\n            index++;\r\n        }\r\n        NodeList n = ((Element) NODES.item(index)).getElementsByTagName(\"Code\");\r\n        for (int i = 0; i < n.getLength(); i++) {\r\n            CodedTerm code = new CodedTerm();\r\n            code.setCode(new String256().setString(((Element) n.item(i)).getAttribute(ConfigCodeNodes.CodeAttributes.code\r\n                    .toString())));\r\n            code.setDisplayName(new String256().setString(((Element) n.item(i))\r\n                    .getAttribute(ConfigCodeNodes.CodeAttributes.display.toString())));\r\n            code.setCodingScheme(new CodingScheme().setCodingScheme(new String256().setString(((Element) n.item(i))\r\n                    .getAttribute(ConfigCodeNodes.CodeAttributes.codingScheme.toString()))));\r\n            if (!temp.contains(code))\r\n                temp.add(code);\r\n        }\r\n        Collections.sort(temp, new Comparator<CodedTerm>() {\r\n            @Override\r\n            public int compare(CodedTerm o1, CodedTerm o2) {\r\n                return o1.getDisplayName().toString().compareTo(o2.getDisplayName().toString());\r\n            }\r\n        });\r\n        return temp;\r\n    }\r\n\r\n    /**\r\n     * This method parses, sorts and returns a list of existing mime types from an application file.\r\n     * @return sorted mime types.\r\n     */\r\n    public List<String256> getMimeTypes() {\r\n        if (mimeTypes.size() == 0) {\r\n            int index = 0;\r\n            while (!(((Element) NODES.item(index)).getAttribute(\"name\").equals(\"mimeType\"))) {\r\n                index++;\r\n            }\r\n            NodeList n = ((Element) NODES.item(index)).getElementsByTagName(\"Code\");\r\n            for (int i = 0; i < n.getLength(); i++) {\r\n                String256 code = new String256().setString(((Element) n.item(i)).getAttribute(\"code\"));\r\n\r\n                if (!mimeTypes.contains(code))\r\n                    mimeTypes.add(code);\r\n            }\r\n            Collections.sort(mimeTypes, new Comparator<String256>() {\r\n                @Override\r\n                public int compare(String256 o1, String256 o2) {\r\n                    return o1.toString().compareTo(o2.toString());\r\n                }\r\n            });\r\n        }\r\n        return mimeTypes;\r\n    }\r\n\r\n    /**\r\n     * Enumeration of existing nodes for the codes parser.\r\n     */\r\n    private static enum ConfigCodeNodes {\r\n        classCode, formatCode, healthcareFacilityTypeCode, practiceSettingCode, typeCode, confidentialityCode, eventCodeList, mimeType, contentTypeCode;\r\n\r\n        /**\r\n         * Enumeration of existing nodes attributes for the codes parser.\r\n         */\r\n        private static enum CodeAttributes {\r\n            name, code, display, codingScheme;\r\n        }\r\n    }\r\n}\r\n'),(4554,5676,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nenum RootNodesEnum {\r\n    titles, comments, authors, mimetype, hash, id, classcode, confidentialitycode, creationtime, eventcode, formatcode, healthcarefacilitytype, languagecode, legalauthenticator, patientid, practicesettingcode, repositoryuniqueid, servicestarttime, servicestoptime, size, sourcepatientid, sourcepatientinfo, typecode, uniqueid, uri;\r\n\r\n    enum SubNodesEnum {\r\n        authorperson, authorinstitution, authorrole, authorspecialty, authortelecommunication, value, idtype, language, information, codedterm, displayname, code, codingscheme, name;\r\n    }\r\n}\r\n'),(4555,5677,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nimport com.google.gwt.i18n.client.DateTimeFormat;\r\nimport com.google.gwt.xml.client.Document;\r\nimport com.google.gwt.xml.client.Element;\r\nimport com.google.gwt.xml.client.NodeList;\r\nimport com.google.gwt.xml.client.XMLParser;\r\nimport com.sencha.gxt.widget.core.client.box.MessageBox;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.*;\r\n\r\nimport javax.inject.Inject;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * <b>This class parses a XML file to build the model</b>\r\n * <p/>\r\n * <p>\r\n * To do it, here are the following variables required\r\n * </p>\r\n * <ul>\r\n * <li>{@link #INSTANCE}: The parser object, this class is a singleton (Parse) ;</li>\r\n * <li>{@link #documentXml}: The String which contains the XML data (String) ;</li>\r\n * <li>{@link #xdsDocumentEntry}: The document model which will be completed.</li>\r\n * </ul>\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * This class also contains getters/setters.<br>\r\n * In addition, it contains several methods such as buildMyModel, findElements,\r\n * getDocumentParsed, generalMethod and finally one method per element\'s\r\n * document.</br>\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>How it works ?</b><br>\r\n * The method {@link #parse(String)} return the completed model, indeed it calls\r\n * {@link #findElements()} whose aim is to call the appropriate method parseType\r\n * where Type correspond to a specific type describe in the\r\n * {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry} (InternationalString, Author ...).</br>All this method\r\n * throws String256Exception if there is a String256 which is larger than 256\r\n * characters.<br>\r\n * The method entitled getDocumentParsed instantiates a Preparse object from the\r\n * singleton Preparse class to delete unexpected escape and to make it UTF-8\r\n * compatible.</br>\r\n * </p>\r\n * <p/>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #parse(String)}</br> {@link #findElements()} <br>\r\n * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n * </br> {@link #getDocumentParsed()}\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See also the parseType methods:</b><br>\r\n * {@link #parseArrayInternationalString(String)}<br>\r\n * {@link #methodParseAuthors()}<br>\r\n * {@link #parseCodedTerm(String)}<br>\r\n * {@link #parseArrayCodedTerm(String)}<br>\r\n * {@link #parseIdentifierString256(String)}<br>\r\n * {@link #parseIdentifierOID(String)}<br>\r\n * {@link #parseNameValueString256(String)}<br>\r\n * {@link #parseNameValueInteger(String)}<br>\r\n * {@link #parseNameValueDTM(String)}<br>\r\n * {@link #parseString256(String)}\r\n * </p>\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry\r\n * @see PreParse\r\n * @see String256\r\n */\r\npublic class XdsParser {\r\n    /**\r\n     * <b>Parse myParse</b> - The instance of Parse class (it\'s a singleton\r\n     * class).<br>\r\n     * Type: {@link XdsParser}</br>\r\n     *\r\n     * @see XdsParser\r\n     */\r\n    private static final XdsParser INSTANCE = new XdsParser();\r\n    private static final Logger LOGGER = Logger.getLogger(XdsParser.class.getName());\r\n    /**\r\n     * <b>DocumentModel xdsDocumentEntry</b> - The model which will be completed\r\n     * by buildMyModel using the data\'s XML file.<br>\r\n     * Type: {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry}</br> </p>\r\n     *\r\n     * @see gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry\r\n     * @see XdsParser\r\n     */\r\n    private final XdsDocumentEntry xdsDocumentEntry = new XdsDocumentEntry();\r\n    /**\r\n     * <b>String documentXml</b> - The data taken from the XML document and send\r\n     * by the server, this is the String to parser.<br>\r\n     * Type: String</br>\r\n     *\r\n     * @see XdsParser\r\n     */\r\n    private String documentXml;\r\n    /**\r\n     * <b>Document document</b> - The XML file which is contained in a Document\r\n     * so as to be parsed.<br>\r\n     * Type: {@link Document}</br>\r\n     *\r\n     * @see XdsParser\r\n     */\r\n    private Document document;\r\n\r\n    @Inject\r\n    private PreParse preParse;\r\n\r\n    public static XdsParser getInstance() {\r\n        return INSTANCE;\r\n    }\r\n\r\n    /**\r\n     * <b>Method parser</b> <br>\r\n     * Firstly, it calls {@link #getDocumentParsed()} method to parser the String\r\n     * {@link #documentXml} and to complete the {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry}\r\n     * {@link #xdsDocumentEntry} thanks to the {@link #findElements()} method.\r\n     * </br>\r\n     *\r\n     * @param newDocumentXml - The String which contains the XML content\r\n     * @return xdsDocumentEntry - The {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry}\r\n     * @see XdsParser\r\n     */\r\n    public XdsDocumentEntry parse(String newDocumentXml) {\r\n        documentXml = preParse.doPreParse(newDocumentXml);\r\n        getDocumentParsed();\r\n        try {\r\n            findElements();\r\n        } catch (String256Exception e) {\r\n            LOGGER.warning(e.getMessage());\r\n        }\r\n        return xdsDocumentEntry;\r\n    }\r\n\r\n    /**\r\n     * <b>Method getDocumentParsed</b> <br>\r\n     * Get the instance of PreParse object to prepare the String parsing. </br>\r\n     *\r\n     * @see PreParse\r\n     * @see XdsParser\r\n     */\r\n    private void getDocumentParsed() {\r\n        documentXml = documentXml.replaceAll(\"&lt;\", \"<\");\r\n        documentXml = documentXml.replaceAll(\"&gt;\", \">\");\r\n        documentXml = documentXml.replaceAll(\"&amp;\", \"&\");\r\n        documentXml = preParse.doPreParseUTF8(documentXml);\r\n\r\n        // parser the XML document into a DOM\r\n        document = XMLParser.parse(documentXml);\r\n    }\r\n\r\n    /**\r\n     * <b>Method findElements</b> <br>\r\n     * It calls all parseType methods on each element from {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry}\r\n     * through\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * . </br>\r\n     *\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private void findElements() throws String256Exception {\r\n        // generalMethod(\"titles\"); ...\r\n        for (RootNodesEnum node : RootNodesEnum.values()) {\r\n            generalMethod(node);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method generalMethod</b> <br>\r\n     * It calls all parseMethod on each element from {@link gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry}.\r\n     *\r\n     * @param node (String): The first node to match.\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private void generalMethod(RootNodesEnum node) throws String256Exception {\r\n        String nodeName = node.toString();\r\n        switch (node) {\r\n            case authors:\r\n                // FIXME Why does this case not have the same code pattern as all others?\r\n                methodParseAuthors();\r\n                break;\r\n            case classcode:\r\n                xdsDocumentEntry.setClassCode(parseCodedTerm(nodeName));\r\n                break;\r\n            case comments:\r\n                xdsDocumentEntry.setComments(parseArrayInternationalString(nodeName));\r\n                break;\r\n            case confidentialitycode:\r\n                xdsDocumentEntry.setConfidentialityCodes(parseArrayCodedTerm(nodeName));\r\n                break;\r\n            case creationtime:\r\n                xdsDocumentEntry.setCreationTime(parseNameValueDTM(nodeName));\r\n                break;\r\n            case eventcode:\r\n                xdsDocumentEntry.setEventCode(parseArrayCodedTerm(nodeName));\r\n                break;\r\n            case formatcode:\r\n                xdsDocumentEntry.setFormatCode(parseCodedTerm(nodeName));\r\n                break;\r\n            case hash:\r\n                xdsDocumentEntry.setHash(parseString256(nodeName));\r\n                break;\r\n            case healthcarefacilitytype:\r\n                xdsDocumentEntry.setHealthcareFacilityType(parseCodedTerm(nodeName));\r\n                break;\r\n            case id:\r\n                xdsDocumentEntry.setId(parseString256(nodeName));\r\n                break;\r\n            case mimetype:\r\n                xdsDocumentEntry.setMimeType(parseString256(nodeName));\r\n                break;\r\n            case languagecode:\r\n                xdsDocumentEntry.setLanguageCode(LanguageCode.getValueOf(parseString256(nodeName).getString()));\r\n                break;\r\n            case legalauthenticator:\r\n                xdsDocumentEntry.setLegalAuthenticator(parseNameValueString256(nodeName));\r\n                break;\r\n            case patientid:\r\n                xdsDocumentEntry.setPatientID(parseIdentifierString256(nodeName));\r\n                break;\r\n            case practicesettingcode:\r\n                xdsDocumentEntry.setPracticeSettingCode(parseCodedTerm(nodeName));\r\n                break;\r\n            case repositoryuniqueid:\r\n                xdsDocumentEntry.setRepoUId(parseOID(nodeName));\r\n                break;\r\n            case servicestarttime:\r\n                xdsDocumentEntry.setServiceStartTime(parseNameValueDTM(nodeName));\r\n                break;\r\n            case servicestoptime:\r\n                xdsDocumentEntry.setServiceStopTime(parseNameValueDTM(nodeName));\r\n                break;\r\n            case size:\r\n                xdsDocumentEntry.setSize(parseNameValueInteger(nodeName));\r\n                break;\r\n            case sourcepatientid:\r\n                xdsDocumentEntry.setSourcePatientId(parseNameValueString256(nodeName));\r\n                break;\r\n            case sourcepatientinfo:\r\n                xdsDocumentEntry.setSourcePatientInfo(parseNameValueString256(nodeName));\r\n                break;\r\n            case titles:\r\n                xdsDocumentEntry.setTitles(parseArrayInternationalString(nodeName));\r\n                break;\r\n            case typecode:\r\n                xdsDocumentEntry.setTypeCode(parseCodedTerm(nodeName));\r\n                break;\r\n            case uniqueid:\r\n                xdsDocumentEntry.setUniqueId(parseIdentifierOID(nodeName));\r\n                break;\r\n            case uri:\r\n                xdsDocumentEntry.setUri(parseString256(nodeName));\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * <b>Method methodParseAuthors</b> <br>\r\n     * To obtain the author(s) of the XML file (ArrayList of {@link Author}\r\n     * ).</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * .\r\n     *\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    // TODO This methods should handle exceptions and/or fire events which could be handled in GUI.\r\n    private void methodParseAuthors() throws String256Exception {\r\n        NodeList authorsNode = document.getElementsByTagName(RootNodesEnum.authors.toString());\r\n        List<Author> authors = new ArrayList<Author>();\r\n\r\n        if (authorsNode != null && !authorsNode.toString().isEmpty()) {\r\n            for (int a = 0; a < authorsNode.getLength(); a++) {\r\n                NodeList authorNodes = ((Element) authorsNode.item(a)).getElementsByTagName(\"author\");\r\n                for (int i = 0; i < authorNodes.getLength(); i++) {\r\n                    Author intern_temp = new Author();\r\n\r\n                    List<String256> authorInstitutions_temp = new ArrayList<String256>();\r\n                    List<String256> authorRoles_temp = new ArrayList<String256>();\r\n                    List<String256> authorSpecialities_temp = new ArrayList<String256>();\r\n                    List<String256> authorTelecommunications_temp = new ArrayList<String256>();\r\n\r\n                    // Set authorPerson\r\n                    String256 authorPerson256 = new String256();\r\n                    NodeList authorPersonNodes = ((Element) authorNodes.item(i))\r\n                            .getElementsByTagName(RootNodesEnum.SubNodesEnum.authorperson.toString());\r\n                    if (authorPersonNodes != null) {\r\n                        for (int p = 0; p < authorPersonNodes.getLength(); p++) {\r\n                            authorPerson256.setString(authorPersonNodes.item(p).getFirstChild().getNodeValue());\r\n                            intern_temp.setAuthorPerson(authorPerson256);\r\n                        }\r\n                    } else {\r\n                        LOGGER.warning(\"This author lacks an author person node. \\nCheck your XML Document!\");\r\n                    }\r\n                    // Set authorInstitutions\r\n                    NodeList institutionNodes = ((Element) authorNodes.item(i))\r\n                            .getElementsByTagName(RootNodesEnum.SubNodesEnum.authorinstitution.toString());\r\n                    if (institutionNodes != null) {\r\n                        for (int j = 0; j < institutionNodes.getLength(); j++) {\r\n                            String256 str = new String256();\r\n                            str.setString(institutionNodes.item(j).getFirstChild().getNodeValue());\r\n                            if (str.verify()) {\r\n                                authorInstitutions_temp.add(str);\r\n                            }\r\n                        }\r\n                        intern_temp.setAuthorInstitutions(authorInstitutions_temp);\r\n                    } else {\r\n                        LOGGER.warning(\"AuthorInstitutions node is empty for author named \" + authorPerson256\r\n                                + \".\\nCheck your XML Document!\");\r\n                    }\r\n                    // Set authorRoles\r\n                    NodeList roleNodes = ((Element) authorNodes.item(i))\r\n                            .getElementsByTagName(RootNodesEnum.SubNodesEnum.authorrole.toString());\r\n                    if (roleNodes != null) {\r\n                        for (int j = 0; j < roleNodes.getLength(); j++) {\r\n                            String256 str = new String256();\r\n                            str.setString(roleNodes.item(j).getFirstChild().getNodeValue());\r\n                            if (str.verify()) {\r\n                                authorRoles_temp.add(str);\r\n                            }\r\n                        }\r\n                        intern_temp.setAuthorRoles(authorRoles_temp);\r\n                    } else {\r\n                        LOGGER.warning(\"AuthorRoles node is empty for author named \" + authorPerson256\r\n                                + \".\\nCheck your XML Document!\");\r\n                        // TODO Fire an event for this error that could be handled in the view\r\n                    }\r\n                    // Set authorSpecialities\r\n                    NodeList specialtyNodes = ((Element) authorNodes.item(i))\r\n                            .getElementsByTagName(RootNodesEnum.SubNodesEnum.authorspecialty.toString());\r\n                    if (specialtyNodes != null) {\r\n                        for (int j = 0; j < specialtyNodes.getLength(); j++) {\r\n                            String256 str = new String256();\r\n                            str.setString(specialtyNodes.item(j).getFirstChild().getNodeValue());\r\n                            if (str.verify()) {\r\n                                authorSpecialities_temp.add(str);\r\n                            }\r\n                        }\r\n                        intern_temp.setAuthorSpecialties(authorSpecialities_temp);\r\n                    } else {\r\n                        LOGGER.warning(\"AuthorSpecialities node is empty for author named \" + authorPerson256\r\n                                + \"!\\nCheck your XML Document\");\r\n                        // TODO fire an event to handle the issue in the view\r\n                    }\r\n                    // Set authorTelecommunications\r\n                    NodeList telecommunicationNodes = ((Element) authorNodes.item(i))\r\n                            .getElementsByTagName(RootNodesEnum.SubNodesEnum.authortelecommunication.toString());\r\n                    if (telecommunicationNodes != null) {\r\n                        for (int j = 0; j < telecommunicationNodes.getLength(); j++) {\r\n                            String256 str = new String256();\r\n                            str.setString(telecommunicationNodes.item(j).getFirstChild().getNodeValue());\r\n                            if (str.verify()) {\r\n                                authorTelecommunications_temp.add(str);\r\n                            }\r\n                        }\r\n                        intern_temp.setAuthorTelecommunications(authorTelecommunications_temp);\r\n                    } else {\r\n                        LOGGER.warning(\"AuthorTelecommunications node is empty for author named \" + authorPerson256\r\n                                + \".\\nCheck your XML Document!\");\r\n                        // TODO fire an event to handle the issue in the view\r\n                    }\r\n                    // Add this Element to the model\r\n                    authors.add(intern_temp);\r\n                }\r\n                // Set title to xdsDocumentEntry\r\n                xdsDocumentEntry.setAuthors(authors);\r\n            }\r\n        } else {\r\n            xdsDocumentEntry.setAuthors(null);\r\n            LOGGER.warning(\"Authors node is empty.\\nCheck your XML Document!\");\r\n            // TODO Fire an event for this error that could be handled in the view\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseString256</b> <br>\r\n     * To obtain the element of type {@link String256}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link String256} element.\r\n     *\r\n     * @param node (String): The name of the root node.\r\n     * @return {@link String256}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private String256 parseString256(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        if (!nodeList.toString().isEmpty()) {\r\n            String256 string256 = new String256();\r\n            string256.setString(nodeList.item(0).getFirstChild().getNodeValue());\r\n            if (string256.verify()) {\r\n                return string256;\r\n            } else {\r\n                // FIXME Not sure it should be done here but maybe within the verify method which may return something\r\n                LOGGER.warning(node + \" node is larger than 256 characters.\");\r\n                return null;\r\n            }\r\n        } else {\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseOID</b> <br>\r\n     * To obtain the element of type {@link OID}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each OID element.\r\n     *\r\n     * @param node (String): The name of the root node.\r\n     * @return {@link OID}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private OID parseOID(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        if (!nodeList.toString().isEmpty()) {\r\n            OID oid = new OID();\r\n            oid.setOid(new String256().setString(nodeList.item(0).getFirstChild().getNodeValue()));\r\n            if (oid.verify()) {\r\n                return oid;\r\n            } else {\r\n                // FIXME Not sure it should be done that way (abstraction issue, string256 validation check)\r\n                LOGGER.warning(node + \" node is larger than 256 characters.\");\r\n                return null;\r\n            }\r\n        } else {\r\n            // TODO Fire an event for this error that could be handled in the view\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method parseIdentifierString256</b> <br>\r\n     * To obtain the element of type {@link IdentifierString256}.</br>Called by\r\n     * {@link #generalMethod generalMethod} on each {@link IdentifierString256}\r\n     * element.\r\n     * </p>\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link IdentifierString256}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser class Parse\r\n     */\r\n    private IdentifierString256 parseIdentifierString256(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n\r\n        if (!nodeList.toString().isEmpty()) {\r\n            IdentifierString256 identifier = new IdentifierString256();\r\n\r\n            // Set value\r\n            String256 identifier256_value = new String256();\r\n            for (int i = 0; i < nodeList.getLength(); i++) {\r\n                NodeList valueNodes = ((Element) nodeList.item(i)).getElementsByTagName(RootNodesEnum.SubNodesEnum.value\r\n                        .toString());\r\n                for (int j = 0; j < valueNodes.getLength(); j++) {\r\n                    identifier256_value.setString(valueNodes.item(j).getFirstChild().getNodeValue());\r\n                }\r\n            }\r\n            if (identifier256_value.verify()) {\r\n                identifier.setValue(identifier256_value);\r\n            } else {\r\n                // FIXME should do something to raise an exception or fire event\r\n                return null;\r\n            }\r\n\r\n            // Set type\r\n            String256 identifier256_type = new String256();\r\n            for (int i = 0; i < nodeList.getLength(); i++) {\r\n                NodeList valueNodes = ((Element) nodeList.item(i)).getElementsByTagName(RootNodesEnum.SubNodesEnum.idtype\r\n                        .toString());\r\n                for (int j = 0; j < valueNodes.getLength(); j++) {\r\n                    identifier256_type.setString(valueNodes.item(j).getFirstChild().getNodeValue());\r\n                }\r\n            }\r\n            if (identifier256_type.verify()) {\r\n                identifier.setIdType(identifier256_type);\r\n            } else {\r\n                // FIXME should do something to raise an exception or fire event\r\n                return null;\r\n            }\r\n\r\n            // Set IDPatient element to xdsDocumentEntry\r\n            return identifier;\r\n        } else {\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseIdentifierOID</b> <br>\r\n     * To obtain the element of type {@link IdentifierOID}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link IdentifierOID} element. </p>\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link IdentifierOID}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private IdentifierOID parseIdentifierOID(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n\r\n        if (!nodeList.toString().isEmpty()) {\r\n            IdentifierOID identifier = new IdentifierOID();\r\n\r\n            // Set value\r\n            OID identifier256_value = new OID();\r\n            for (int i = 0; i < nodeList.getLength(); i++) {\r\n                NodeList valueNodes = ((Element) nodeList.item(i)).getElementsByTagName(RootNodesEnum.SubNodesEnum.value\r\n                        .toString());\r\n                for (int j = 0; j < valueNodes.getLength(); j++) {\r\n                    identifier256_value.setOid(new String256().setString(valueNodes.item(j).getFirstChild().getNodeValue()));\r\n                }\r\n            }\r\n            if (identifier256_value.verify()) {\r\n                identifier.setValue(identifier256_value);\r\n            } else {\r\n                // FIXME should do something to raise an exception or fire event\r\n                return null;\r\n            }\r\n\r\n            // Set type\r\n            String256 identifier256_type = new String256();\r\n            for (int i = 0; i < nodeList.getLength(); i++) {\r\n                NodeList valueNodes = ((Element) nodeList.item(i)).getElementsByTagName(RootNodesEnum.SubNodesEnum.idtype\r\n                        .toString());\r\n                for (int j = 0; j < valueNodes.getLength(); j++) {\r\n                    identifier256_type.setString(valueNodes.item(j).getFirstChild().getNodeValue());\r\n                }\r\n            }\r\n            if (identifier256_type.verify()) {\r\n                identifier.setIdType(identifier256_type);\r\n            } else {\r\n                // FIXME should do something to raise an exception or fire event\r\n                return null;\r\n            }\r\n\r\n            // Set IDPatient element to xdsDocumentEntry\r\n            return identifier;\r\n        } else {\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseArrayInternationalString</b> <br>\r\n     * To obtain the element of type ArrayList(InternationalString) .</br>Called\r\n     * by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each ArrayList(InternationalString) element.\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return ArrayList(InternationalString)\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private List<InternationalString> parseArrayInternationalString(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        List<InternationalString> array = new ArrayList<InternationalString>();\r\n\r\n        if (!nodeList.toString().isEmpty()) {\r\n            int nodeLength = nodeList.item(0).getChildNodes().getLength();\r\n            for (int i = 0; i < nodeLength; i++) {\r\n                InternationalString internationalString = new InternationalString();\r\n\r\n                // Set languageCode\r\n                LanguageCode international256_langCode = LanguageCode.getValueOf(((Element) nodeList.item(0).getChildNodes()\r\n                        .item(i)).getElementsByTagName(RootNodesEnum.SubNodesEnum.language.toString()).item(0)\r\n                        .getFirstChild().getNodeValue());\r\n                internationalString.setLangCode(international256_langCode);\r\n\r\n                // Set information\r\n                String256 international256_value = new String256();\r\n                international256_value.setString(((Element) nodeList.item(0).getChildNodes().item(i))\r\n                        .getElementsByTagName(RootNodesEnum.SubNodesEnum.information.toString()).item(0).getFirstChild()\r\n                        .getNodeValue());\r\n                if (international256_value.verify()) {\r\n                    internationalString.setValue(international256_value);\r\n                }\r\n                // TODO else w/ exception and/or fire event\r\n\r\n                // Add this Element to the model\r\n                array.add(internationalString);\r\n            }\r\n            // Set title to xdsDocumentEntry\r\n            return array;\r\n        } else {\r\n            LOGGER.warning(node + \" node is empty!\\nCheck your XML Document\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseCodedTerm</b> <br>\r\n     * To obtain the element of type CodedTerm.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link CodedTerm} element. </p>\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link CodedTerm}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private CodedTerm parseCodedTerm(String node) throws String256Exception {\r\n        return parseArrayCodedTerm(node).get(0);\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method parseArrayCodedTerm</b> <br>\r\n     * To obtain the element of type ArrayList(CodedTerm).</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each ArrayList(CodedTerm) element.\r\n     * </p>\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return ArrayList(CodedTerm)\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private List<CodedTerm> parseArrayCodedTerm(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        if (!nodeList.toString().isEmpty()) {\r\n            List<CodedTerm> arrayCodedTerm = new ArrayList<CodedTerm>();\r\n            NodeList codedTermNodes = ((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.codedterm\r\n                    .toString());\r\n            for (int i = 0; i < codedTermNodes.getLength(); i++) {\r\n                CodedTerm codedTerm = new CodedTerm();\r\n                CodingScheme codingScheme = new CodingScheme();\r\n                String256 codedTerm256_name = new String256();\r\n                String256 codedTerm256_code = new String256();\r\n\r\n                // Set displayName\r\n                codedTerm256_name.setString(((Element) codedTermNodes.item(i))\r\n                        .getElementsByTagName(RootNodesEnum.SubNodesEnum.displayname.toString()).item(0).getFirstChild()\r\n                        .getNodeValue());\r\n\r\n                if (codedTerm256_name.verify()) {\r\n                    codedTerm.setDisplayName(codedTerm256_name);\r\n                } else {\r\n                    // TODO return problem to client view\r\n                }\r\n                // Set code\r\n                codedTerm256_code.setString(((Element) codedTermNodes.item(i))\r\n                        .getElementsByTagName(RootNodesEnum.SubNodesEnum.code.toString()).item(0).getFirstChild()\r\n                        .getNodeValue());\r\n                if (codedTerm256_code.verify()) {\r\n                    codedTerm.setCode(codedTerm256_code);\r\n                } else {\r\n                    // TODO return problem to client view\r\n                }\r\n                // Set codingScheme\r\n                String test = ((Element) codedTermNodes.item(i))\r\n                        .getElementsByTagName(RootNodesEnum.SubNodesEnum.codingscheme.toString()).item(0).getFirstChild()\r\n                        .getNodeValue();\r\n                codingScheme.setCodingScheme(new String256().setString(test));\r\n                if (codingScheme.verify()) {\r\n                    codedTerm.setCodingScheme(codingScheme);\r\n                } else {\r\n                    // TODO fire there is a problem\r\n                }\r\n                // Add this CodedTerm\r\n                if (codedTerm.verify()) {\r\n                    arrayCodedTerm.add(codedTerm);\r\n                } else {\r\n                    // TODO return problem to client view\r\n                }\r\n            }\r\n            return arrayCodedTerm;\r\n        } else {\r\n            LOGGER.warning(node + \" node is empty!\\nCheck your XML Document\");\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseNameValueString256</b> <br>\r\n     * To obtain the element of type {@link NameValueString256}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link NameValueString256} element.\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link NameValueString256}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private NameValueString256 parseNameValueString256(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n\r\n        if (nodeList.toString().isEmpty()) {\r\n            LOGGER.warning(node + \" node is empty!\\nCheck your XML Document\");\r\n            return null;\r\n        } else {\r\n            // NameValue<String256>\r\n            NameValueString256 nameValue = new NameValueString256();\r\n            List<String256> values = new ArrayList<String256>();\r\n            // Set name\r\n            String256 name256 = new String256();\r\n            name256.setString(((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.name.toString())\r\n                    .item(0).getFirstChild().getNodeValue());\r\n            if (name256.verify()) {\r\n                nameValue.setName(name256);\r\n            }\r\n            // Set values\r\n            NodeList valueNodes = ((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.value\r\n                    .toString());\r\n            for (int i = 0; i < valueNodes.getLength(); i++) {\r\n                String256 value256 = new String256();\r\n                value256.setString(valueNodes.item(i).getFirstChild().getNodeValue());\r\n                values.add(value256);\r\n            }\r\n            nameValue.setValues(values);\r\n            return nameValue;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseNameValueInteger</b> <br>\r\n     * To obtain the element of type {@link NameValueInteger}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link NameValueInteger} element.\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link NameValueInteger}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private NameValueInteger parseNameValueInteger(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        if (nodeList.toString().isEmpty()) {\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        } else {\r\n            // NameValue<String256>\r\n            NameValueInteger nameValue = new NameValueInteger();\r\n            List<Integer> values = new ArrayList<Integer>();\r\n            // Set name\r\n            String256 name256 = new String256();\r\n            name256.setString(((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.name.toString())\r\n                    .item(0).getFirstChild().getNodeValue());\r\n            if (name256.verify()) {\r\n                nameValue.setName(name256);\r\n            }\r\n            // Set values\r\n            NodeList valueNodes = ((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.value\r\n                    .toString());\r\n            for (int i = 0; i < valueNodes.getLength(); i++) {\r\n                String value = valueNodes.item(i).getFirstChild().getNodeValue();\r\n                values.add(Integer.parseInt(value));\r\n            }\r\n            nameValue.setValues(values);\r\n            return nameValue;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <b>Method parseNameValueDTM</b> <br>\r\n     * To obtain the element of type {@link NameValueDTM}.</br>Called by\r\n     * {@link #generalMethod(gov.nist.hit.ds.docentryeditor.client.parser.RootNodesEnum)}\r\n     * on each {@link NameValueDTM} element.\r\n     *\r\n     * @param node (String) : The name of the root node.\r\n     * @return {@link NameValueDTM}\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see XdsParser\r\n     */\r\n    private NameValueDTM parseNameValueDTM(String node) throws String256Exception {\r\n        NodeList nodeList = document.getElementsByTagName(node);\r\n        if (nodeList.toString().isEmpty()) {\r\n            LOGGER.warning(node + \" node is empty.\\nCheck your XML Document!\");\r\n            return null;\r\n        } else {\r\n            NameValueDTM nameValue = new NameValueDTM();\r\n            List<DTM> values = new ArrayList<DTM>();\r\n            // Set name\r\n            String256 name256 = new String256();\r\n            name256.setString(((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.name.toString())\r\n                    .item(0).getFirstChild().getNodeValue());\r\n            if (name256.verify()) {\r\n                nameValue.setName(name256);\r\n            } else {\r\n                // TODO fire problem to view\r\n            }\r\n            // Set values\r\n            NodeList valueNodes = ((Element) nodeList.item(0)).getElementsByTagName(RootNodesEnum.SubNodesEnum.value\r\n                    .toString());\r\n            // FIXME this should be done elsewhere\r\n            for (int i = 0; i < valueNodes.getLength(); i++) {\r\n                String256 value256 = new String256();\r\n                DTM dtm = new DTM();\r\n                value256.setString(valueNodes.item(i).getFirstChild().getNodeValue());\r\n                String df = null;\r\n                int dateLength = value256.getString().length();\r\n                switch (dateLength) {\r\n                    case 4:\r\n                        df = \"yyyy\";\r\n                        break;\r\n                    case 6:\r\n                        df = \"yyyyMM\";\r\n                        break;\r\n                    case 8:\r\n                        df = \"yyyyMMdd\";\r\n                        break;\r\n                    case 10:\r\n                        df = \"yyyyMMddhh\";\r\n                        break;\r\n                    case 12:\r\n                        df = \"yyyyMMddhhmm\";\r\n                        break;\r\n                    case 14:\r\n                        df = \"yyyyMMddhhmmss\";\r\n                        break;\r\n                    default:\r\n                        // TODO change this\r\n                        MessageBox mb = new MessageBox(\"Date parsing error\", \"Your \" + nameValue.getName()\r\n                                + \" date is not well formatted, this value can not be treated.\");\r\n                        mb.show();\r\n                        break;\r\n                }\r\n                if (df != null) {\r\n                    dtm.setDtm(DateTimeFormat.getFormat(df).parse(value256.getString()));\r\n                } else {\r\n                    return null;\r\n                }\r\n                values.add(dtm);\r\n            }\r\n            nameValue.setValues(values);\r\n            return nameValue;\r\n        }\r\n    }\r\n}\r\n'),(4556,5678,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nimport com.google.gwt.user.client.rpc.RemoteService;\r\nimport com.google.gwt.user.client.rpc.RemoteServiceRelativePath;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\n\r\n/**\r\n * RPC Services interface to parse an XDS document (ebRim XML File).\r\n */\r\n@RemoteServiceRelativePath(\"xdsparser\")\r\npublic interface XdsParserServices extends RemoteService{\r\n    public XdsMetadata parseXdsMetadata(String fileContent);\r\n\r\n    public String toEbRim(XdsMetadata xdsDocumentEntry);\r\n}\r\n'),(4557,5679,'package gov.nist.hit.ds.docentryeditor.client.parser;\r\n\r\nimport com.google.gwt.user.client.rpc.AsyncCallback;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\n\r\n/**\r\n * Asynchronous RPC Services interface to parse an XDS document (ebRim XML File).\r\n */\r\npublic interface XdsParserServicesAsync {\r\n    /**\r\n     * Asynchronous method that parses a XDS document (ebRim XML file) and return a manipulable java object\r\n     * with all the file content.\r\n     * @param fileContent XML ebRim file to parse.\r\n     * @param async asynchronous callback containing the java object set.\r\n     */\r\n    public void parseXdsMetadata(String fileContent, AsyncCallback<XdsMetadata> async);\r\n    public void toEbRim(XdsMetadata xdsDocumentEntry,AsyncCallback<String> async);\r\n}\r\n'),(4558,5681,'package gov.nist.hit.ds.docentryeditor.client.resources;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.resources.client.ClientBundle;\r\nimport com.google.gwt.resources.client.ImageResource;\r\n\r\n/**\r\n * Application image resources.\r\n */\r\npublic interface AppImages extends ClientBundle {\r\n    AppImages INSTANCE = GWT.create(AppImages.class);\r\n\r\n    @Source(\"baseResources/file.png\")\r\n    ImageResource file();\r\n\r\n    @Source(\"baseResources/file-plus.png\")\r\n    ImageResource filePlus();\r\n\r\n    @Source(\"baseResources/folder-32.png\")\r\n    ImageResource newFolder();\r\n\r\n    @Source(\"baseResources/prefilled.png\")\r\n    ImageResource preFilled();\r\n\r\n    @Source(\"baseResources/Warning-128.png\")\r\n    ImageResource warning();\r\n\r\n    @Source(\"baseResources/load-file.png\")\r\n    ImageResource loadFile();\r\n\r\n    @Source(\"baseResources/edit-subSet.png\")\r\n    ImageResource editSubSet();\r\n\r\n    @Source(\"baseResources/load-file-16.png\")\r\n    ImageResource loadFile12px();\r\n\r\n    @Source(\"baseResources/add.gif\")\r\n    ImageResource add();\r\n\r\n    @Source(\"baseResources/clear.gif\")\r\n    ImageResource clear();\r\n\r\n    @Source(\"baseResources/delete.gif\")\r\n    ImageResource delete();\r\n\r\n    @Source(\"baseResources/checkbox.png\")\r\n    ImageResource checkbox();\r\n\r\n    @Source(\"baseResources/comment.png\")\r\n    ImageResource help();\r\n\r\n    @Source(\"baseResources/save-disk.png\")\r\n    ImageResource save();\r\n\r\n    @Source(\"baseResources/refresh.gif\")\r\n    ImageResource refresh();\r\n\r\n    @Source(\"baseResources/home.png\")\r\n    ImageResource home();\r\n\r\n    @Source(\"baseResources/save-2.png\")\r\n    ImageResource saveBW();\r\n\r\n    @Source(\"baseResources/back-16.png\")\r\n    ImageResource back();\r\n\r\n    @Source(\"baseResources/pen.png\")\r\n    ImageResource pen();\r\n\r\n}\r\n'),(4559,5682,'package gov.nist.hit.ds.docentryeditor.client.resources;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.resources.client.ClientBundle;\r\nimport com.google.gwt.resources.client.TextResource;\r\n\r\n/**\r\n * Application file resources.\r\n */\r\npublic interface AppResources extends ClientBundle {\r\n    AppResources INSTANCE = GWT.create(AppResources.class);\r\n\r\n    @Source(\"codes.xml\")\r\n    TextResource codes();\r\n\r\n    @Source(\"xds-prefill.xml\")\r\n    TextResource xdsPrefill();\r\n}\r\n'),(4560,5683,'package gov.nist.hit.ds.docentryeditor.client.resources;\r\n\r\n/**\r\n * Created by onh2 on 4/7/2015.\r\n */\r\npublic enum ToolTipResources {\r\n    INSTANCE;\r\n    public String getEditSubSetTooltip(){\r\n        return \"Start editing the submission set.\";\r\n    }\r\n    public String getNewDocEntryTooltip(){\r\n        return \"Create an empty document entry and add it to the existing submission set.\";\r\n    }\r\n    public String getNewPrefilledDocEntryTooltip(){\r\n        return \"Create a document entry pre-filled with test data and add it to the existing submission set.\";\r\n    }\r\n\r\n    public String getUploadFileTooltip() {\r\n        return \"Upload a existing XDS metadata file in ebRim XML format. It musts at least contain a Submission set, a document entry and an association to bind them.\";\r\n    }\r\n\r\n    public String getSaveButtonToolTip() {\r\n        return \"Save data currently being edited and download an XDS Metadata file in ebRim XML format.\";\r\n    }\r\n\r\n    public String getCancelButtonToolTip() {\r\n        return \"Rollback all the changes made since the last save or the last page change (auto save).\";\r\n    }\r\n\r\n    public String getGridAddToolTip(){\r\n        return \"Add a new entry.\";\r\n    }\r\n\r\n    public String getGridDeleteToolTip() {\r\n        return \"Delete selected element(s).\";\r\n    }\r\n\r\n    public String getGridClearTooltip(){\r\n        return \"Clear widget (remove all entries).\";\r\n    }\r\n\r\n    public String getHelpButtonToolTip(){\r\n        return \"Help\";\r\n    }\r\n\r\n    public String getClearSubmissionSetToolTip() {\r\n        return \"Clear submission set from all elements.\";\r\n    }\r\n\r\n    public String getString256ToolTip() {\r\n        return \"It should contain less than 256 characters\";\r\n    }\r\n}\r\n'),(4561,5685,'package gov.nist.hit.ds.docentryeditor.client.root;\r\n\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\n\r\npublic class CenterPanel extends ContentPanel {\r\n	public CenterPanel() {\r\n		super();\r\n		setHeaderVisible(false);\r\n		setBorders(false);\r\n	}\r\n}\r\n'),(4562,5686,'package gov.nist.hit.ds.docentryeditor.client.root;\r\n\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;\r\nimport com.sencha.gxt.widget.core.client.container.MarginData;\r\nimport com.sencha.gxt.widget.core.client.container.SimpleContainer;\r\nimport com.sencha.gxt.widget.core.client.container.Viewport;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.GenericMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionMenuData;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelView;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * This class contains layout objects to handle the global interface layout,\r\n * which is divided into 3 parts.\r\n *\r\n * @author OLIVIER\r\n */\r\npublic class MetadataEditorAppView extends Viewport {\r\n    private static final int WEST_PANEL_WIDTH = 200;\r\n    private static final int PANELS_MARGINS = 5;\r\n    // Constant to compensate the size of the html header for resize purposes\r\n    private static final int HEADER_HEIGHT = 80;\r\n\r\n    private CenterPanel center; // main edtior fields\r\n    private GenericMVP<SubmissionMenuData, SubmissionPanelView, SubmissionPanelPresenter> submissionMVP;\r\n\r\n    private SimpleContainer simpleContainer;\r\n    private SubmissionPanelView submissionPanelView;\r\n    private SubmissionPanelPresenter submissionPanelPresenter;\r\n\r\n    @Inject\r\n    public MetadataEditorAppView(SubmissionPanelView submissionPanelView,SubmissionPanelPresenter submissionPanelPresenter) {\r\n        super();\r\n\r\n        this.submissionPanelPresenter = submissionPanelPresenter;\r\n        this.submissionPanelView = submissionPanelView;\r\n\r\n        BorderLayoutContainer con = new BorderLayoutContainer();\r\n        con.setBorders(true);\r\n\r\n        // CENTER\r\n        center = new CenterPanel();\r\n        MarginData centerData = new MarginData(PANELS_MARGINS);\r\n        BorderLayoutContainer c = new BorderLayoutContainer();\r\n        c.setCenterWidget(center, centerData);\r\n\r\n        con.setCenterWidget(c);\r\n\r\n        // WEST\r\n        submissionMVP = buildSubmissionMVP();\r\n        submissionMVP.init();\r\n        BorderLayoutData westData = new BorderLayoutData(WEST_PANEL_WIDTH);\r\n        westData.setMargins(new Margins(PANELS_MARGINS));\r\n        westData.setCollapsible(true);\r\n        westData.setSplit(false);\r\n\r\n        con.setWestWidget(submissionMVP.getDisplay(), westData);\r\n\r\n\r\n        simpleContainer = new SimpleContainer();\r\n        simpleContainer.add(con, new MarginData(0, 0, /*8*/0, 0));\r\n        simpleContainer.setWidget(con);\r\n        add(simpleContainer);\r\n\r\n        //  north.start();\r\n        submissionMVP.start();\r\n    }\r\n\r\n    public void setCenterDisplay(Widget display) {\r\n        center.clear();\r\n        center.add(display);\r\n        center.forceLayout();\r\n    }\r\n\r\n    public GenericMVP<SubmissionMenuData, SubmissionPanelView, SubmissionPanelPresenter> buildSubmissionMVP() {\r\n        return new GenericMVP<SubmissionMenuData, SubmissionPanelView, SubmissionPanelPresenter>(submissionPanelView, submissionPanelPresenter);\r\n    }\r\n\r\n    public void setMarginTop(int marginTop) {\r\n        simpleContainer.getWidget().setLayoutData(new MarginData(0,0,HEADER_HEIGHT,0));\r\n    }\r\n}\r\n'),(4563,5687,'package gov.nist.hit.ds.docentryeditor.client.root;\r\n\r\nimport com.google.gwt.place.shared.PlaceController;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.core.client.util.Padding;\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;\r\nimport com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocumentEntryEditorMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent.NewFileLoadedHandler;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.XdsEditorLoadedEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.uploader.FileUploadMVP;\r\n\r\nimport javax.inject.Inject;\r\nimport java.util.logging.Logger;\r\n\r\n// not used anymore\r\npublic class NorthPanel extends ContentPanel {\r\n\r\n    private final TextButton loadButton;\r\n    private final TextButton newButton;\r\n    private final TextButton saveButton;\r\n    @Inject\r\n    private PlaceController placeController;\r\n	@Inject\r\n    private FileUploadMVP fileUploadMVP;\r\n	@Inject\r\n    private DocumentEntryEditorMVP documentModelEditorMVP;\r\n	@Inject\r\n    private MetadataEditorEventBus eventBus;\r\n	private Dialog loadingDialog;\r\n\r\n	public NorthPanel() {\r\n		setHeaderVisible(false);\r\n		setBorders(false);\r\n\r\n		HBoxLayoutContainer c = new HBoxLayoutContainer();\r\n		c.setPadding(new Padding(5,20,5,5));\r\n		c.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);\r\n		c.setPack(BoxLayoutPack.END);\r\n\r\n		BoxLayoutData layoutData = new BoxLayoutData(new Margins(0, 10, 0, 0));\r\n\r\n		newButton = new TextButton(\"New\");\r\n		newButton.setSize(\"50\", \"-1\");\r\n		c.add(newButton, layoutData);\r\n\r\n		loadButton = new TextButton(\"Load\");\r\n		loadButton.setSize(\"50\", \"-1\");\r\n		c.add(loadButton, layoutData);\r\n\r\n		saveButton = new TextButton(\"Download file\");\r\n		saveButton.setSize(\"50\", \"-1\");\r\n		saveButton.disable();\r\n		c.add(saveButton, layoutData);\r\n\r\n		this.add(c);\r\n	}\r\n\r\n	private void bindUI() {\r\n		loadButton.addSelectHandler(new SelectHandler() {\r\n\r\n			@Override\r\n			public void onSelect(SelectEvent event) {\r\n				loadingDialog = new Dialog();\r\n				loadingDialog.setBodyBorder(false);\r\n				loadingDialog.setHeadingText(\"File Upload\");\r\n				loadingDialog.setHideOnButtonClick(true);\r\n				loadingDialog.add(fileUploadMVP.getDisplay());\r\n\r\n				// delete the default button\r\n				loadingDialog.getButtonBar().remove(0);\r\n				loadingDialog.setModal(true);\r\n				loadingDialog.show();\r\n			}\r\n\r\n		});\r\n		fileUploadMVP.getView().getBtnCancel().addSelectHandler(new SelectHandler() {\r\n\r\n			@Override\r\n			public void onSelect(SelectEvent event) {\r\n				loadingDialog.hide();\r\n                Logger.getLogger(this.getClass().getName()).info(\"Dialog Hided\");\r\n            }\r\n\r\n		});\r\n		eventBus.addNewFileLoadedHandler(new NewFileLoadedHandler() {\r\n\r\n            @Override\r\n            public void onNewFileLoaded(NewFileLoadedEvent event) {\r\n                if (loadingDialog != null) {\r\n                    loadingDialog.hide();\r\n                    saveButton.enable();\r\n                }\r\n            }\r\n        });\r\n        eventBus.addXdsEditorLoadedEventtHandler(new XdsEditorLoadedEvent.XdsEditorLoadedEventHandler() {\r\n            @Override\r\n            public void onXdsEditorLoaded(XdsEditorLoadedEvent event) {\r\n                saveButton.enable();\r\n            }\r\n        });\r\n		newButton.addSelectHandler(new SelectHandler() {\r\n\r\n			@Override\r\n			public void onSelect(SelectEvent event) {\r\n				saveButton.enable();\r\n//                eventBus.fireEditNewEvent(new EditNewEvent());\r\n//				placeController.goTo(new EditorPlace());\r\n            }\r\n\r\n		});\r\n		saveButton.addSelectHandler(new SelectHandler() {\r\n\r\n			@Override\r\n			public void onSelect(SelectEvent event) {\r\n				eventBus.fireSaveFileEvent();\r\n			}\r\n		});\r\n\r\n	}\r\n\r\n	public void start() {\r\n		fileUploadMVP.init();\r\n		bindUI();\r\n	}\r\n\r\n}\r\n'),(4564,5689,'package gov.nist.hit.ds.docentryeditor.client.root.submission;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.editor.client.Editor;\r\nimport com.sencha.gxt.core.client.ValueProvider;\r\nimport com.sencha.gxt.data.shared.LabelProvider;\r\nimport com.sencha.gxt.data.shared.ModelKeyProvider;\r\nimport com.sencha.gxt.data.shared.PropertyAccess;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsModelElement;\r\n\r\n/**\r\n * This is the model class handled by the UI tree to manage the different element of the\r\n * XDS Submission structure.\r\n * Created by onh2 on 7/11/2014.\r\n */\r\npublic class SubmissionMenuData<M extends XdsModelElement> {\r\n    public static final SubmissionMenuData.SubmissionMenuDataProperties PROPS = GWT.create(SubmissionMenuData.SubmissionMenuDataProperties.class);\r\n    private String key;\r\n    private String value;\r\n    private M model;\r\n\r\n    public SubmissionMenuData(String key, String value, M model) {\r\n        this.key = key;\r\n        this.value = value;\r\n        this.model = model;\r\n    }\r\n\r\n    public String getKey() {\r\n        return key;\r\n    }\r\n\r\n    public void setKey(String key) {\r\n        this.key = key;\r\n    }\r\n\r\n    public String getValue() {\r\n        return value;\r\n    }\r\n\r\n    public void setValue(String value) {\r\n        this.value = value;\r\n    }\r\n\r\n    public M getModel() {\r\n        return model;\r\n    }\r\n\r\n    public void setModel(M model) {\r\n        this.model = model;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof SubmissionMenuData)){ return false;}\r\n\r\n        SubmissionMenuData that = (SubmissionMenuData) o;\r\n\r\n        if (!key.equals(that.key)){ return false;}\r\n        if (!model.equals(that.model)){ return false;}\r\n        if (!value.equals(that.value)){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = key != null ? key.hashCode() : 0;\r\n        result = 31 * result + (value != null ? value.hashCode() : 0);\r\n        result = 31 * result + (model != null ? model.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public interface SubmissionMenuDataProperties extends PropertyAccess<SubmissionMenuData> {\r\n\r\n        ModelKeyProvider<SubmissionMenuData> key();\r\n\r\n        @Editor.Path(\"value\")\r\n        LabelProvider<SubmissionMenuData> valueLabel();\r\n\r\n        ValueProvider<SubmissionMenuData, String> value();\r\n\r\n\r\n    }\r\n}\r\n'),(4565,5690,'package gov.nist.hit.ds.docentryeditor.client.root.submission;\r\n\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractMVP;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * Created by onh2 on 7/11/2014.\r\n */\r\npublic class SubmissionPanelMVP extends AbstractMVP<SubmissionMenuData, SubmissionPanelView, SubmissionPanelPresenter> {\r\n\r\n    @Inject\r\n    SubmissionPanelView submissionPanelView;\r\n\r\n    @Inject\r\n    SubmissionPanelPresenter submissionPanelPresenter;\r\n\r\n    @Override\r\n    public SubmissionPanelView buildView() {\r\n        return submissionPanelView;\r\n    }\r\n\r\n    @Override\r\n    public SubmissionPanelPresenter buildPresenter() {\r\n        return submissionPanelPresenter;\r\n    }\r\n\r\n}\r\n'),(4566,5691,'package gov.nist.hit.ds.docentryeditor.client.root.submission;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.place.shared.PlaceController;\r\nimport com.google.gwt.user.client.Window;\r\nimport com.google.gwt.user.client.rpc.AsyncCallback;\r\nimport com.google.gwt.user.client.ui.HTMLPanel;\r\nimport com.google.gwt.user.client.ui.Label;\r\nimport com.google.web.bindery.requestfactory.shared.Receiver;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocEntryEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.*;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.home.WelcomePlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PreParse;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParser;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParserServices;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParserServicesAsync;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppResources;\r\nimport gov.nist.hit.ds.docentryeditor.client.utils.MetadataEditorRequestFactory;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.String256;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsSubmissionSet;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * This class presents the submission panel. It handles the mechanic of the submission set tree of the SubmissionPanelView.\r\n *\r\n * @see gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelView\r\n * @see gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionMenuData\r\n * Created by onh2 on 7/11/2014.\r\n */\r\npublic class SubmissionPanelPresenter extends AbstractPresenter<SubmissionPanelView> {\r\n    @Inject\r\n    private PlaceController placeController;\r\n    @Inject\r\n    private XdsParser xdsParser;\r\n    @Inject\r\n    private MetadataEditorRequestFactory requestFactory;\r\n\r\n    private final SubmissionMenuData submissionSetTreeNode = new SubmissionMenuData(\"subSet\", \"Submission set\",new XdsSubmissionSet());\r\n\r\n    private SubmissionMenuData currentlyEdited;\r\n    private int nextIndex = 1;\r\n    private XdsDocumentEntry prefilledDocEntry;\r\n\r\n    // RPC services declaration\r\n    private final XdsParserServicesAsync xdsParserServices = GWT.create(XdsParserServices.class);\r\n\r\n    @Override\r\n    public void init() {\r\n        bind();\r\n        requestFactory.initialize(eventBus);\r\n    }\r\n\r\n    /**\r\n     * Method that handles the different event fired in the event bus.\r\n     */\r\n    private void bind() {\r\n        // this event catches handle the navigation back to the home page.\r\n        ((MetadataEditorEventBus) getEventBus()).addBackToHomePageEventHandler(new BackToHomePageEvent.BackToHomePageEventHandler() {\r\n            @Override\r\n            public void onBackToHomePage(BackToHomePageEvent event) {\r\n                goToHomePage();\r\n            }\r\n        });\r\n        // this event catches that a Document entry has been loaded from the user\'s file system.\r\n        ((MetadataEditorEventBus) getEventBus()).addNewFileLoadedHandler(new NewFileLoadedEvent.NewFileLoadedHandler() {\r\n            @Override\r\n            public void onNewFileLoaded(NewFileLoadedEvent event) {\r\n                clearSubmissionSet();\r\n                view.getTreeStore().getRootItems().get(0).setModel(event.getMetadata().getSubmissionSet());\r\n                for (XdsDocumentEntry docEntry : event.getMetadata().getDocumentEntries()) {\r\n                    currentlyEdited = new SubmissionMenuData(\"DocEntry\" + nextIndex, \"Document Entry \" + nextIndex, docEntry);\r\n                    nextIndex++;\r\n                    view.getTreeStore().add(view.getTreeStore().getRootItems().get(0), currentlyEdited);\r\n                }\r\n                currentlyEdited=submissionSetTreeNode;\r\n                view.getTree().expandAll();\r\n                view.getTree().getSelectionModel().select(submissionSetTreeNode, false);\r\n            }\r\n        });\r\n        // this event catches that a Document entry has been loaded from the user\'s file system.\r\n        ((MetadataEditorEventBus) getEventBus()).addCreateNewDocEntryEventHandler(new CreateNewDocEntryEvent.CreateNewDocEntryEventHandler() {\r\n            @Override\r\n            public void onCreateNewDocumentEntry(CreateNewDocEntryEvent event) {\r\n                currentlyEdited = new SubmissionMenuData(\"DocEntry\" + nextIndex, \"Document Entry \" + nextIndex, event.getDocument());\r\n                nextIndex++;\r\n                view.getTreeStore().add(view.getTreeStore().getRootItems().get(0), currentlyEdited);\r\n                view.getTree().expandAll();\r\n                view.getTree().getSelectionModel().select(currentlyEdited, false);\r\n            }\r\n        });\r\n        // this catches that the XDS Document entry editor view has loaded.\r\n        ((MetadataEditorEventBus) getEventBus()).addXdsEditorLoadedEventtHandler(new XdsEditorLoadedEvent.XdsEditorLoadedEventHandler() {\r\n            @Override\r\n            public void onXdsEditorLoaded(XdsEditorLoadedEvent event) {\r\n                logger.info(\"... receive Editor loaded event.\");\r\n                if (currentlyEdited != null) {\r\n                    // if a doc. entry is currently under edition, an event is fired to transfer it to the editor.\r\n                    if (currentlyEdited.getModel() instanceof XdsDocumentEntry) {\r\n                        logger.info(\"A document is already selected. Loading it...\");\r\n                        ((MetadataEditorEventBus) getEventBus()).fireStartEditXdsDocumentEvent((XdsDocumentEntry) currentlyEdited.getModel());\r\n                    }else if (currentlyEdited.getModel() instanceof XdsSubmissionSet){\r\n                        ((MetadataEditorEventBus) getEventBus()).fireStartEditXdsSubmissionSetEvent((XdsSubmissionSet) currentlyEdited.getModel());\r\n                    }\r\n                } else {\r\n                    if (placeController.getWhere() instanceof SubmissionSetEditorPlace){\r\n                        view.getTree().getSelectionModel().select(submissionSetTreeNode,false);\r\n                    }else {\r\n                        // if no doc. entry is currently under edition, it means the app (editor view) has been loaded from\r\n                        // by its URL from the browser navigation bar (external link).\r\n                        logger.info(\"No Document Entry in Submission Set\");\r\n                        // a new doc. entry is create in the submission tree.\r\n                        createNewDocumentEntry();\r\n                    }\r\n                }\r\n            }\r\n        });\r\n        // this catches that a new pre-filled doc. entry creation has been required\r\n        // from another place than the submission panel.\r\n        ((MetadataEditorEventBus) getEventBus()).addLoadPreFilledDocEntryEventHandler(new LoadPrefilledDocEntryEvent.LoadPrefilledDocEntryEventHandler() {\r\n            @Override\r\n            public void onLoadPrefilledDocEntryHandler(LoadPrefilledDocEntryEvent event) {\r\n                createPreFilledDocumentEntry();\r\n            }\r\n        });\r\n        // handle auto-save\r\n        ((MetadataEditorEventBus) getEventBus()).addSaveFileEventHandler(new SaveFileEvent.SaveFileEventHandler() {\r\n            @Override\r\n            public void onFileSave(SaveFileEvent event) {\r\n                doSave();\r\n            }\r\n        });\r\n        // start edit submission set from home page\r\n        eventBus.addHandler(SelectSubmissionSetEvent.TYPE, new SelectSubmissionSetEvent.SelectSubmissionSetEventHandler() {\r\n            @Override\r\n            public void onSelectSubmissionSet(SelectSubmissionSetEvent event) {\r\n                view.getTree().getSelectionModel().select(submissionSetTreeNode,false);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This method initialize the submission set tree by adding\r\n     * a root node (an empty submission set) to the tree.\r\n     */\r\n    public void initSubmissionSet() {\r\n        submissionSetTreeNode.setModel(new XdsSubmissionSet());\r\n        if (view.getTreeStore().getAll().isEmpty()) {\r\n            view.getTreeStore().add(submissionSetTreeNode);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method creates a new Document Entry and adds it to the submissionSet tree.\r\n     */\r\n    public void createNewDocumentEntry() {\r\n        logger.info(\"Create new document entry\");\r\n        currentlyEdited = new SubmissionMenuData(\"DocEntry\" + nextIndex, \"Document Entry \" + nextIndex, new XdsDocumentEntry());\r\n        nextIndex++;\r\n        view.getTreeStore().add(view.getTreeStore().getRootItems().get(0), currentlyEdited);\r\n        view.getTree().expandAll();\r\n        view.getTree().getSelectionModel().select(currentlyEdited, false);\r\n    }\r\n\r\n    /**\r\n     * This method loads the adequate editor interface with the selected entry\r\n     * from the submission tree. It can be a XdsSubmissionSet, a XdsDocumentEntry\r\n     * or a XdsAssociation.\r\n     *\r\n     * @param selectedItem selected tree node\r\n     */\r\n    public void loadSelectedEntryEditor(SubmissionMenuData selectedItem) {\r\n        ((MetadataEditorEventBus) eventBus).firePlaceChangeEvent();\r\n        currentlyEdited = selectedItem;\r\n        startEditing();\r\n    }\r\n\r\n    /**\r\n     * This method load the editor user interface with a pre-filled document entry which is added to the submission set tree.\r\n     */\r\n    public void createPreFilledDocumentEntry() {\r\n        if (prefilledDocEntry==null) {\r\n            prefilledDocEntry = xdsParser.parse(PreParse.getInstance().doPreParse(AppResources.INSTANCE.xdsPrefill().getText()));\r\n            prefilledDocEntry.setFileName(new String256(\"new-doc-entry\"));\r\n        }\r\n        //------------------------------------------- MIGHT CHANGE\r\n        logger.info(\"Create new pre-filled document entry\");\r\n        XdsDocumentEntry newDoc=prefilledDocEntry.copy();\r\n        currentlyEdited = new SubmissionMenuData(\"DocEntry\" + nextIndex, \"Document Entry \" + nextIndex, newDoc);\r\n        nextIndex++;\r\n        view.getTreeStore().add(view.getTreeStore().getRootItems().get(0), currentlyEdited);\r\n        view.getTree().expandAll();\r\n        view.getTree().getSelectionModel().select(currentlyEdited, false);\r\n    }\r\n\r\n    /**\r\n     * Clear the submission set from all its data.\r\n     */\r\n    public void clearSubmissionSet() {\r\n        view.getTreeStore().clear();\r\n        nextIndex=1;\r\n        initSubmissionSet();\r\n    }\r\n\r\n    /**\r\n     * This method save file on the server and enable the user to download it by displaying it in its browser.\r\n     */\r\n    public void doSave() {\r\n        // set XdsMetadata object from the submission tree data.\r\n        XdsMetadata m=new XdsMetadata();\r\n        m.setSubmissionSet((XdsSubmissionSet) getSubmissionSetTreeNode().getModel());\r\n        for (SubmissionMenuData subData:view.getTreeStore().getChildren(getSubmissionSetTreeNode())){\r\n            if (subData.getModel() instanceof XdsDocumentEntry) {\r\n                m.getDocumentEntries().add((XdsDocumentEntry) subData.getModel());\r\n            }\r\n        }\r\n        // rpc server call to translate metadata java object into an ebRim xml String.\r\n        xdsParserServices.toEbRim(m, new AsyncCallback<String>() {\r\n            @Override\r\n            public void onFailure(Throwable throwable) {\r\n                logger.warning(throwable.getMessage());\r\n            }\r\n\r\n            @Override\r\n            public void onSuccess(String s) {\r\n                // request factory server call to physically save the file on the server.\r\n                requestFactory.saveFileRequestContext().saveAsXMLFile(s).fire(new Receiver<String>() {\r\n                    @Override\r\n                    public void onSuccess(String response) {\r\n                        logger.info(\"saveAsXMLFile call succeed\");\r\n                        logger.info(\"Generated filename sent to the client \\n\" + response);\r\n                        logger.info(\"File\'s URL: \" + GWT.getHostPageBaseURL() + \"files/\" + response);\r\n                        Window.open(GWT.getHostPageBaseURL() + \"files/\" + response, response + \" Metadata File\", \"enabled\");\r\n                        Dialog d = new Dialog();\r\n                        HTMLPanel htmlP = new HTMLPanel(\"<a href=\'\" + GWT.getHostPageBaseURL() + \"files/\" + response + \"\'>\"\r\n                                + GWT.getHostPageBaseURL() + \"files/\" + response + \"</a>\");\r\n                        VerticalLayoutContainer vp = new VerticalLayoutContainer();\r\n                        vp.add(new Label(\"Your download is in progress, please allow this application to open popups with your browser...\"),\r\n                                new VerticalLayoutContainer.VerticalLayoutData(1, 1, new Margins(10, 5, 10, 5)));\r\n                        vp.add(htmlP, new VerticalLayoutContainer.VerticalLayoutData(1, 1, new Margins(10, 5, 10, 5)));\r\n                        d.add(vp);\r\n                        d.setPredefinedButtons(Dialog.PredefinedButton.OK);\r\n                        d.setButtonAlign(BoxLayoutContainer.BoxLayoutPack.CENTER);\r\n                        d.setHideOnButtonClick(true);\r\n                        d.setHeadingText(\"XML Metadata File Download\");\r\n                        d.show();\r\n                    }\r\n                });\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This method loads a document entry into the editor user interface, which is loaded if not already.\r\n     */\r\n    private void startEditing() {\r\n        if(currentlyEdited.getModel() instanceof XdsDocumentEntry) {\r\n            if (!(placeController.getWhere() instanceof DocEntryEditorPlace)) {\r\n                placeController.goTo(new DocEntryEditorPlace());\r\n            }\r\n            logger.info(\"Fire Start Edit selected (\" + currentlyEdited.getValue() + \") document entry event...\");\r\n            ((MetadataEditorEventBus) getEventBus()).fireStartEditXdsDocumentEvent((XdsDocumentEntry) currentlyEdited.getModel());\r\n        }else if(currentlyEdited.getModel() instanceof XdsSubmissionSet){\r\n            if(!(placeController.getWhere() instanceof SubmissionSetEditorPlace)){\r\n                placeController.goTo(new SubmissionSetEditorPlace());\r\n            }\r\n            logger.info(\"Fire Start Edit selected (\" + currentlyEdited.getValue() + \") submission set event...\");\r\n            logger.info(currentlyEdited.getModel().toString());\r\n            ((MetadataEditorEventBus) getEventBus()).fireStartEditXdsSubmissionSetEvent((XdsSubmissionSet) currentlyEdited.getModel());\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method handle the navigation back to the home page of the application.\r\n     */\r\n    public void goToHomePage() {\r\n        getView().getTree().getSelectionModel().deselectAll();\r\n        placeController.goTo(new WelcomePlace());\r\n    }\r\n\r\n    /**\r\n     * Getter that return the entity currently under edition.\r\n     * @return SubmissionMenuData.\r\n     */\r\n    public SubmissionMenuData getCurrentlyEdited(){\r\n        return currentlyEdited;\r\n    }\r\n\r\n    /**\r\n     * This method returns the root node of the submissions set tree.\r\n     * It is actually the Submission Set Node.\r\n     *\r\n     * @return Submission Set tree node data\r\n     */\r\n    public SubmissionMenuData getSubmissionSetTreeNode() {\r\n        return submissionSetTreeNode;\r\n    }\r\n}\r\n'),(4567,5692,'package gov.nist.hit.ds.docentryeditor.client.root.submission;\r\n\r\nimport com.google.gwt.event.logical.shared.SelectionEvent;\r\nimport com.google.gwt.event.logical.shared.SelectionHandler;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.data.shared.TreeStore;\r\nimport com.sencha.gxt.widget.core.client.ContentPanel;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.menu.Item;\r\nimport com.sencha.gxt.widget.core.client.menu.Menu;\r\nimport com.sencha.gxt.widget.core.client.menu.MenuItem;\r\nimport com.sencha.gxt.widget.core.client.toolbar.ToolBar;\r\nimport com.sencha.gxt.widget.core.client.tree.Tree;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractView;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.ToolTipResources;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.uploader.FileUploadDialog;\r\n\r\nimport javax.inject.Inject;\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\n\r\n/**\r\n * Created by onh2 on 7/11/2014.\r\n */\r\npublic class SubmissionPanelView extends AbstractView<SubmissionPanelPresenter> {\r\n    private final TreeStore<SubmissionMenuData> treeStore = new TreeStore<SubmissionMenuData>(SubmissionMenuData.PROPS.key());\r\n    private final Tree<SubmissionMenuData, String> tree = new Tree<SubmissionMenuData, String>(treeStore, SubmissionMenuData.PROPS.value());\r\n    private final ToolBar toolbar = new ToolBar();\r\n\r\n    private final TextButton uploadFileButton = new TextButton();\r\n    private final TextButton removeDocEntryButton = new TextButton();\r\n    private final TextButton clearDocEntriesButton = new TextButton();\r\n    private final TextButton saveDocEntriesButton = new TextButton();\r\n    private final TextButton helpButton = new TextButton();\r\n\r\n    private final MenuItem addEmptyDocEntry = new MenuItem(\"Create an empty document entry\");\r\n    private final MenuItem addPrefilledDocEntry = new MenuItem(\"Create a pre-filled document entry\");\r\n\r\n    @Inject\r\n    private FileUploadDialog fileUploadDialog;\r\n\r\n    @Override\r\n    protected Map<String, Widget> getPathToWidgetsMap() {\r\n        Map<String, Widget> map = new HashMap<String, Widget>();\r\n        return map;\r\n    }\r\n\r\n    @Override\r\n    protected Widget buildUI() {\r\n        ContentPanel cp = new ContentPanel();\r\n        cp.setHeadingText(\"Submission\");\r\n        cp.setHeaderVisible(true);\r\n        cp.setBorders(false);\r\n\r\n        VerticalLayoutContainer vlc = new VerticalLayoutContainer();\r\n\r\n        uploadFileButton.setIcon(AppImages.INSTANCE.loadFile12px());\r\n        uploadFileButton.setToolTip(ToolTipResources.INSTANCE.getUploadFileTooltip());\r\n\r\n        TextButton addDocEntryButton = new TextButton();\r\n        addDocEntryButton.setIcon(AppImages.INSTANCE.add());\r\n        addDocEntryButton.setToolTip(\"Create a new Document Entry.\");\r\n\r\n        addEmptyDocEntry.setToolTip(ToolTipResources.INSTANCE.getNewDocEntryTooltip());\r\n        addPrefilledDocEntry.setToolTip(ToolTipResources.INSTANCE.getNewPrefilledDocEntryTooltip());\r\n\r\n        Menu addDocEntryMenu = new Menu();\r\n        addDocEntryMenu.add(addEmptyDocEntry);\r\n        addDocEntryMenu.add(addPrefilledDocEntry);\r\n        addDocEntryButton.setMenu(addDocEntryMenu);\r\n        removeDocEntryButton.setIcon(AppImages.INSTANCE.delete());\r\n        removeDocEntryButton.setToolTip(ToolTipResources.INSTANCE.getGridDeleteToolTip().split(\"(s)\\\\.\")[0]);\r\n        clearDocEntriesButton.setIcon(AppImages.INSTANCE.clear());\r\n        clearDocEntriesButton.setToolTip(ToolTipResources.INSTANCE.getClearSubmissionSetToolTip());\r\n        saveDocEntriesButton.setIcon(AppImages.INSTANCE.save());\r\n        saveDocEntriesButton.setToolTip(ToolTipResources.INSTANCE.getSaveButtonToolTip());\r\n        helpButton.setIcon(AppImages.INSTANCE.help());\r\n        helpButton.setToolTip(ToolTipResources.INSTANCE.getHelpButtonToolTip());\r\n        toolbar.add(uploadFileButton);\r\n        toolbar.add(addDocEntryButton);\r\n        toolbar.add(removeDocEntryButton);\r\n        toolbar.add(clearDocEntriesButton);\r\n        toolbar.add(saveDocEntriesButton);\r\n        toolbar.add(helpButton);\r\n        vlc.add(toolbar);\r\n        getPresenter().initSubmissionSet();\r\n        tree.getStyle().setLeafIcon(AppImages.INSTANCE.file());\r\n        tree.expandAll();\r\n        tree.setAutoExpand(true);\r\n        vlc.add(tree);\r\n\r\n        cp.setWidget(vlc);\r\n\r\n        return cp;\r\n    }\r\n\r\n    /**\r\n     * This method ties the widgets with their actions in the view or with actions defined in the presenter.\r\n     */\r\n    @Override\r\n    protected void bindUI() {\r\n        addEmptyDocEntry.addSelectionHandler(new SelectionHandler<Item>() {\r\n            @Override\r\n            public void onSelection(SelectionEvent<Item> event) {\r\n                presenter.createNewDocumentEntry();\r\n            }\r\n        });\r\n        removeDocEntryButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                tree.getStore().remove(tree.getSelectionModel().getSelectedItem());\r\n                tree.getSelectionModel().select(tree.getStore().getFirstChild(presenter.getSubmissionSetTreeNode()), false);\r\n            }\r\n        });\r\n        clearDocEntriesButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                presenter.clearSubmissionSet();\r\n                presenter.goToHomePage();\r\n            }\r\n        });\r\n        tree.getSelectionModel().addSelectionHandler(new SelectionHandler<SubmissionMenuData>() {\r\n            @Override\r\n            public void onSelection(SelectionEvent<SubmissionMenuData> event) {\r\n                presenter.loadSelectedEntryEditor(event.getSelectedItem());\r\n            }\r\n        });\r\n        addPrefilledDocEntry.addSelectionHandler(new SelectionHandler<Item>() {\r\n            @Override\r\n            public void onSelection(SelectionEvent<Item> itemSelectionEvent) {\r\n                getPresenter().createPreFilledDocumentEntry();\r\n            }\r\n        });\r\n        uploadFileButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                fileUploadDialog.init();\r\n                fileUploadDialog.show();\r\n            }\r\n\r\n        });\r\n        saveDocEntriesButton.addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                presenter.doSave();\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This method returns the submission set Tree widget.\r\n     *\r\n     * @return submission set tree\r\n     */\r\n    public Tree<SubmissionMenuData, String> getTree() {\r\n        return tree;\r\n    }\r\n\r\n    /**\r\n     * This method returns the submission set TreeStore, which contains all the data.\r\n     *\r\n     * @return submission set tree store\r\n     */\r\n    public TreeStore<SubmissionMenuData> getTreeStore() {\r\n        return treeStore;\r\n    }\r\n\r\n}\r\n'),(4568,5694,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.gwt.activity.shared.AbstractActivity;\r\nimport com.google.gwt.activity.shared.Activity;\r\nimport com.google.gwt.activity.shared.ActivityMapper;\r\nimport com.google.gwt.place.shared.Place;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocEntryEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.home.WelcomePlace;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * Finds the activity to run for a given Place, used to configure an ActivityManager.\r\n * It binds the Places with the right Activities.\r\n *\r\n * @see com.google.gwt.activity.shared.ActivityManager\r\n */\r\npublic class MetadataEditorActivityMapper implements ActivityMapper {\r\n\r\n    private final MetadataEditorGinInjector injector = MetadataEditorGinInjector.INSTANCE;\r\n\r\n    @Inject\r\n    public MetadataEditorActivityMapper() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * This method is supposed to return the right Activity for a given Place to load.\r\n     *\r\n     * @param place Place to load\r\n     * @return the right Activity for a given place to load.\r\n     */\r\n    @Override\r\n    public Activity getActivity(Place place) {\r\n        AbstractActivity activity = null;\r\n\r\n        // WELCOME\r\n        if (place instanceof WelcomePlace) {\r\n            activity = injector.getWelcomeActivity();\r\n        } else if (place instanceof SubmissionSetEditorPlace) {\r\n            activity = injector.getSubmissionSetEditorActivity();\r\n        } else if (place instanceof DocEntryEditorPlace) {\r\n            activity = injector.getDocEntryEditorActivity();\r\n        }\r\n        return activity;\r\n    }\r\n\r\n}\r\n'),(4569,5695,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.gwt.place.shared.PlaceHistoryMapper;\r\nimport com.google.gwt.place.shared.WithTokenizers;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocEntryEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorPlace;\r\nimport gov.nist.hit.ds.docentryeditor.client.home.WelcomePlace;\r\n\r\n/**\r\n * Monitors PlaceChangeEvents and History events and keep them in sync.\r\n * It must know all the different Places used in the application.\r\n */\r\n@WithTokenizers({ WelcomePlace.Tokenizer.class, SubmissionSetEditorPlace.Tokenizer.class, DocEntryEditorPlace.Tokenizer.class })\r\npublic interface MetadataEditorAppPlaceHistoryMapper extends PlaceHistoryMapper {\r\n\r\n}\r\n'),(4570,5696,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.gwt.core.shared.GWT;\r\nimport com.google.gwt.inject.client.GinModules;\r\nimport com.google.gwt.inject.client.Ginjector;\r\nimport com.google.gwt.place.shared.PlaceController;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocEntryEditorActivity;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocumentEntryEditorMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocumentEntryEditorPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.documentEntryEditor.DocumentEntryEditorView;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorActivity;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.submissionSetEditor.SubmissionSetEditorView;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.AuthorWidgets.AuthorsListEditorWidget;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.ActivityDisplayer;\r\nimport gov.nist.hit.ds.docentryeditor.client.home.WelcomeActivity;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParser;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.CenterPanel;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.MetadataEditorAppView;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelMVP;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.submission.SubmissionPanelView;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.EditorToolbar;\r\nimport gov.nist.hit.ds.docentryeditor.client.widgets.uploader.FileUploadMVP;\r\n\r\n@GinModules(MetadataEditorGinModule.class)\r\npublic interface MetadataEditorGinInjector extends Ginjector {\r\n\r\n    public static MetadataEditorGinInjector INSTANCE = GWT.create(MetadataEditorGinInjector.class);\r\n\r\n    // -----------------------------------------\r\n    // ~ Utils\r\n    MetadataEditorEventBus getEventBus();\r\n    PlaceController getPlaceController();\r\n    MetadataEditorRequestFactory getRequestFactory();\r\n    ActivityDisplayer getActivityDisplayer();\r\n\r\n    // ------------------------------------------\r\n    // ~ Root\r\n    MetadataEditorAppView getMetadataEditorAppView();\r\n    CenterPanel getCenterPanel();\r\n    // NorthPanel getNorthPanel();\r\n\r\n    // ------------------------------------------\r\n    // ~ Various widgets\r\n    FileUploadMVP getFileUploadMVP();\r\n    AuthorsListEditorWidget getAuthorsListEditorWidget();\r\n    EditorToolbar getToolbar();\r\n\r\n    // ------------------------------------------\r\n    // ~ ACTIVITIES\r\n    WelcomeActivity getWelcomeActivity();\r\n    SubmissionSetEditorActivity getSubmissionSetEditorActivity();\r\n    DocEntryEditorActivity getDocEntryEditorActivity();\r\n\r\n    // SubmissionSet editor\r\n    SubmissionSetEditorMVP getSubmissionSetEditorMVP();\r\n    SubmissionSetEditorView getSubmissionSetEditorView();\r\n    SubmissionSetEditorPresenter getSubmissionSetEditorPresenter();\r\n\r\n    // DocEntry editor\r\n    DocumentEntryEditorMVP getDocumentEntryEditorMVP();\r\n    DocumentEntryEditorView getDocumentEntryEditorView();\r\n    DocumentEntryEditorPresenter getDocumentEntryEditorPresenter();\r\n\r\n    // Submission panel\r\n    SubmissionPanelMVP getSubmissionPanelMVP();\r\n    SubmissionPanelView getSubmissionPanelView();\r\n    SubmissionPanelPresenter getSubmissionPanelPresenter();\r\n\r\n    // Client parser\r\n    XdsParser getXdsParser();\r\n\r\n}\r\n'),(4571,5697,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.inject.client.AbstractGinModule;\r\nimport com.google.gwt.place.shared.PlaceController;\r\nimport com.google.inject.Provider;\r\nimport com.google.inject.Provides;\r\nimport com.google.inject.Singleton;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.ActivityDisplayer;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.ActivityDisplayer.MetadataEditorAppDisplayer;\r\nimport gov.nist.hit.ds.docentryeditor.client.root.MetadataEditorAppView;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class MetadataEditorGinModule extends AbstractGinModule {\r\n\r\n    @Override\r\n    protected void configure() {\r\n        bind(com.google.web.bindery.event.shared.EventBus.class).to(MetadataEditorEventBus.class);\r\n        // bind(com.google.gwt.event.shared.EventBus.class).to(MetadataEditorEventBus.class);\r\n        bind(MetadataEditorEventBus.class).in(Singleton.class);\r\n\r\n        bind(com.google.web.bindery.requestfactory.shared.RequestFactory.class).to(MetadataEditorRequestFactory.class);\r\n\r\n        bind(com.google.gwt.place.shared.PlaceController.class).toProvider(PlaceControllerProvider.class).in(Singleton.class);\r\n\r\n        bind(ActivityDisplayer.class).to(MetadataEditorAppDisplayer.class).in(Singleton.class);\r\n        bind(MetadataEditorAppView.class).in(Singleton.class);\r\n    }\r\n\r\n    /**\r\n     * This method instantiate and return for MetadataEditorRequestFactory\r\n     *\r\n     * @return Provider for MetadataEditorRequestFactory\r\n     */\r\n    @Provides\r\n    MetadataEditorRequestFactory provideMetadataEditorRequestFactory() {\r\n        MetadataEditorRequestFactory requestFactory = GWT.create(MetadataEditorRequestFactory.class);\r\n        requestFactory.initialize(MetadataEditorGinInjector.INSTANCE.getEventBus());\r\n        return requestFactory;\r\n    }\r\n\r\n    /** Provider for PlaceController */\r\n    public static class PlaceControllerProvider implements Provider<PlaceController> {\r\n        @Inject\r\n        MetadataEditorEventBus eventBus;\r\n        private PlaceController controller;\r\n\r\n        @SuppressWarnings(\"deprecation\")\r\n        @Override\r\n        public PlaceController get() {\r\n            if (controller == null) {\r\n                controller = new PlaceController(eventBus);\r\n            }\r\n            return controller;\r\n        }\r\n    }\r\n}\r\n'),(4572,5698,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.web.bindery.requestfactory.shared.RequestFactory;\r\n\r\npublic interface MetadataEditorRequestFactory extends RequestFactory {\r\n	SaveFileRequestContext saveFileRequestContext();\r\n}\r\n'),(4573,5699,'package gov.nist.hit.ds.docentryeditor.client.utils;\r\n\r\nimport com.google.web.bindery.requestfactory.shared.Request;\r\nimport com.google.web.bindery.requestfactory.shared.RequestContext;\r\nimport com.google.web.bindery.requestfactory.shared.Service;\r\nimport gov.nist.hit.ds.docentryeditor.server.GenericServiceLocator;\r\nimport gov.nist.hit.ds.docentryeditor.server.SaveFileService;\r\n\r\n@Service(value = SaveFileService.class, locator = GenericServiceLocator.class)\r\npublic interface SaveFileRequestContext extends RequestContext {\r\n    public Request<String> saveAsXMLFile(String name);\r\n\r\n    public Request<String> saveAsXMLFile(String filename, String filecontent);\r\n}\r\n'),(4574,5701,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.google.gwt.dom.client.InputElement;\r\nimport com.sencha.gxt.widget.core.client.form.TextField;\r\n\r\n/**\r\n * This class is an extend of Textfield with an limit of input character.\r\n * Its default limit is 256 characters.\r\n */\r\npublic class BoundedTextField extends TextField {\r\n\r\n    private static final int FIELD_MAX_LENGTH = 256;\r\n\r\n    /**\r\n     * Default constructor, with default max length=256\r\n     */\r\n    public BoundedTextField() {\r\n        super();\r\n        setWidth(\"auto\");\r\n        setMaxLength(FIELD_MAX_LENGTH);\r\n    }\r\n\r\n    public void setMaxLength(int length) {\r\n        InputElement ie = this.getInputEl().cast();\r\n        ie.setMaxLength(length);\r\n    }\r\n\r\n}\r\n'),(4575,5702,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;\r\n\r\n/**\r\n * This class is an extend of ConfirmMessageBox with with a pre-configured message for deletion.\r\n * @see com.sencha.gxt.widget.core.client.box.ConfirmMessageBox\r\n */\r\npublic class ConfirmDeleteDialog extends ConfirmMessageBox {\r\n\r\n	public ConfirmDeleteDialog(String valueToDelete) {\r\n		super(\"Confirm delete dialog\", \"Are you sure you want to delete this value: \" + valueToDelete);\r\n	}\r\n\r\n    public ConfirmDeleteDialog(String boxTitle,String message){\r\n        super(boxTitle,message);\r\n\r\n    }\r\n\r\n}\r\n'),(4576,5703,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.ToolTipResources;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * Created by onh2 on 3/3/2015.\r\n */\r\npublic class EditorToolbar extends HorizontalLayoutContainer {\r\n    private HomeButton homeBtn;\r\n    private ToolbarIconButton saveButton;\r\n    private ToolbarIconButton cancelButton;\r\n\r\n    private final static int BUTTON_RIGHT_MARGIN=5;\r\n\r\n    @Inject\r\n    public EditorToolbar(HomeButton hb) {\r\n        homeBtn=hb;\r\n        saveButton = new ToolbarIconButton(\"Save\",AppImages.INSTANCE.saveBW(),60);\r\n        saveButton.setToolTip(ToolTipResources.INSTANCE.getSaveButtonToolTip());\r\n        cancelButton = new ToolbarIconButton(\"Cancel changes\",AppImages.INSTANCE.back(),110);\r\n        cancelButton.setToolTip(ToolTipResources.INSTANCE.getCancelButtonToolTip());\r\n\r\n        this.add(homeBtn, new HorizontalLayoutData(-1, -1, new Margins(0, BUTTON_RIGHT_MARGIN, 0, 0)));\r\n        this.add(saveButton, new HorizontalLayoutData(-1, -1, new Margins(0, BUTTON_RIGHT_MARGIN, 0, 0)));\r\n        this.add(cancelButton, new HorizontalLayoutData(-1, -1, new Margins(0, BUTTON_RIGHT_MARGIN, 0, 0)));\r\n        bindUI();\r\n    }\r\n\r\n    private void bindUI() {\r\n//        homeBtn.addSelectHandler(new SelectEvent.SelectHandler() {\r\n//            @Override\r\n//            public void onSelect(SelectEvent selectEvent) {\r\n//                eventBus.fireBackToHomePageEvent();\r\n//            }\r\n//        });\r\n    }\r\n\r\n    public HandlerRegistration addSaveHandler(SelectEvent.SelectHandler handler){\r\n        return saveButton.addSelectHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addCancelHandler(SelectEvent.SelectHandler handler) {\r\n        return cancelButton.addSelectHandler(handler);\r\n    }\r\n\r\n    public void addButton(ToolbarIconButton button){\r\n        this.add(button,new HorizontalLayoutData(-1,-1,new Margins(0,BUTTON_RIGHT_MARGIN,0,0)));\r\n    }\r\n\r\n    public HomeButton getHomeBtn() {\r\n        return homeBtn;\r\n    }\r\n\r\n    public TextButton getSaveButton() {\r\n        return saveButton;\r\n    }\r\n\r\n    public TextButton getCancelButton() {\r\n        return cancelButton;\r\n    }\r\n}\r\n'),(4577,5704,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;\r\n\r\n/**\r\n * Created by onh2 on 6/26/2014.\r\n */\r\npublic class FieldEmptyValidator<T> extends EmptyValidator<T> {\r\n    public FieldEmptyValidator(final String fieldName){\r\n        super();\r\n        setMessages(new EmptyMessages() {\r\n            @Override\r\n            public String blankText() {\r\n                return \"The field \"+fieldName+\" is required. It can not be null.\";\r\n            }\r\n        });\r\n    }\r\n}\r\n'),(4578,5705,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * Button to return to the Home page.\r\n */\r\npublic class HomeButton extends ToolbarIconButton {\r\n\r\n    @Inject\r\n    private MetadataEditorEventBus eventBus;\r\n\r\n    public HomeButton() {\r\n        super(\"Back to home page\", AppImages.INSTANCE.home());\r\n        setToolTip(\"Navigate back to the home page\");\r\n        setWidth(130);\r\n        bindUI();\r\n    }\r\n\r\n    private void bindUI() {\r\n        addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                eventBus.fireBackToHomePageEvent();\r\n            }\r\n        });\r\n    }\r\n}\r\n'),(4579,5706,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.google.gwt.user.client.ui.Image;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppImages;\r\n\r\n/**\r\n * Widget to display a warning message in a red bordered panel at the bottom of the page\r\n */\r\npublic class PageWarningPanel extends VerticalLayoutContainer{\r\n    /**\r\n     * Default constructor\r\n     */\r\n    public PageWarningPanel(String message){\r\n        // triangle warning icon\r\n        Image i = new Image(AppImages.INSTANCE.warning());\r\n\r\n        // warning message\r\n        HtmlLayoutContainer l = new HtmlLayoutContainer(message);\r\n        l.setStyleName(\"warning-message\");\r\n\r\n        // render the icon warning message\r\n        HorizontalLayoutContainer hlc=new HorizontalLayoutContainer();\r\n        hlc.add(i, new HorizontalLayoutContainer.HorizontalLayoutData(-1, -1, new Margins(0, 0, 0, 5)));\r\n        hlc.add(l, new HorizontalLayoutContainer.HorizontalLayoutData(1, -1, new Margins(0, 0, 0, 5)));\r\n\r\n        // set the red bordered warning panel\r\n        this.add(hlc, new VerticalLayoutData(1,100));\r\n        // this.setHeaderVisible(false);\r\n        // this.setBodyBorder(false);\r\n        // this.setHeight(100);\r\n        this.setStyleName(\"warning-panel\");\r\n    }\r\n}\r\n'),(4580,5707,'package gov.nist.hit.ds.docentryeditor.client.widgets;\r\n\r\nimport com.google.gwt.resources.client.ImageResource;\r\nimport com.sencha.gxt.cell.core.client.ButtonCell;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\n\r\n/**\r\n * Created by onh2 on 4/7/2015.\r\n */\r\npublic class ToolbarIconButton extends TextButton {\r\n    private static final int BUTTON_HEIGHT=30;\r\n    public ToolbarIconButton(String title,ImageResource icon){\r\n        super(title,icon);\r\n        setHeight(BUTTON_HEIGHT);\r\n        setIconAlign(ButtonCell.IconAlign.LEFT);\r\n    }\r\n    public ToolbarIconButton(String title,ImageResource icon,int width){\r\n        this(title,icon);\r\n        setWidth(width);\r\n    }\r\n}\r\n'),(4581,5709,'package gov.nist.hit.ds.docentryeditor.client.widgets.uploader;\r\n\r\nimport com.sencha.gxt.widget.core.client.Dialog;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.MetadataEditorEventBus;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent;\r\n\r\nimport javax.inject.Inject;\r\n\r\n/**\r\n * This class is an extend of Dialog. It is a Dialog widget to upload\r\n * a ebRim xml file to the application.\r\n */\r\npublic class FileUploadDialog extends Dialog {\r\n\r\n    @Inject\r\n    private FileUploadMVP fileUploadMVP;\r\n    @Inject\r\n    private MetadataEditorEventBus eventBus;\r\n\r\n    public FileUploadDialog() {\r\n        super();\r\n        setBodyBorder(false);\r\n        setHeadingText(\"File Upload\");\r\n        setHideOnButtonClick(true);\r\n\r\n        // delete the default button\r\n        getButtonBar().remove(0);\r\n        setModal(true);\r\n    }\r\n\r\n    public void init() {\r\n        fileUploadMVP.init();\r\n        add(fileUploadMVP.getDisplay());\r\n        bind();\r\n    }\r\n\r\n    private void bind() {\r\n        fileUploadMVP.getView().getBtnCancel().addSelectHandler(new SelectEvent.SelectHandler() {\r\n            @Override\r\n            public void onSelect(SelectEvent selectEvent) {\r\n                hide();\r\n            }\r\n        });\r\n        eventBus.addNewFileLoadedHandler(new NewFileLoadedEvent.NewFileLoadedHandler() {\r\n\r\n            @Override\r\n            public void onNewFileLoaded(NewFileLoadedEvent event) {\r\n                hide();\r\n            }\r\n        });\r\n    }\r\n}\r\n'),(4582,5710,'package gov.nist.hit.ds.docentryeditor.client.widgets.uploader;\r\n\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractMVP;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class FileUploadMVP extends AbstractMVP<XdsDocumentEntry, FileUploadView, FileUploadPresenter> {\r\n    @Inject\r\n    private FileUploadView fileUploadView;\r\n    @Inject\r\n    private FileUploadPresenter fileUploadPresenter;\r\n\r\n    public FileUploadMVP() {\r\n\r\n    }\r\n\r\n    @Override\r\n    public FileUploadView buildView() {\r\n        return fileUploadView;\r\n    }\r\n\r\n    @Override\r\n    public FileUploadPresenter buildPresenter() {\r\n        return fileUploadPresenter;\r\n    }\r\n\r\n}\r\n'),(4583,5711,'package gov.nist.hit.ds.docentryeditor.client.widgets.uploader;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.user.client.rpc.AsyncCallback;\r\nimport gov.nist.hit.ds.docentryeditor.client.event.NewFileLoadedEvent;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractPresenter;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParserServices;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParserServicesAsync;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsMetadata;\r\n\r\npublic class FileUploadPresenter extends AbstractPresenter<FileUploadView> {\r\n\r\n    // RPC services declaration\r\n    private final XdsParserServicesAsync xdsParserServices = GWT\r\n            .create(XdsParserServices.class);\r\n\r\n    public void fileUploaded(String results) {\r\n        // remove xml file first line (xml doctype => <?xml...>)\r\n        logger.info(\"... file loaded, parsing metadata...\");\r\n        String s=results.replace(\"&lt;\",\"<\");\r\n        s=s.replace(\"&gt;\",\">\");\r\n        s=s.replace(\"&amp;\",\"&\");\r\n        xdsParserServices.parseXdsMetadata(s, new AsyncCallback<XdsMetadata>() {\r\n            @Override\r\n            public void onFailure(Throwable throwable) {\r\n                logger.warning(throwable.getMessage());\r\n            }\r\n\r\n            @Override\r\n            public void onSuccess(XdsMetadata xdsMetadata) {\r\n                logger.info(\"... file parsed.\");\r\n                getEventBus().fireEvent(new NewFileLoadedEvent(xdsMetadata));\r\n            }\r\n        });\r\n    }\r\n\r\n    @Override\r\n    public void init() {\r\n        // don\'t need to do anything in that particular case\r\n    }\r\n}\r\n'),(4584,5712,'package gov.nist.hit.ds.docentryeditor.client.widgets.uploader;\r\n\r\nimport com.google.gwt.event.dom.client.ChangeEvent;\r\nimport com.google.gwt.event.dom.client.ChangeHandler;\r\nimport com.google.gwt.user.client.ui.FormPanel;\r\nimport com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;\r\nimport com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport com.sencha.gxt.core.client.util.Margins;\r\nimport com.sencha.gxt.widget.core.client.FramedPanel;\r\nimport com.sencha.gxt.widget.core.client.button.TextButton;\r\nimport com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;\r\nimport com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;\r\nimport com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent;\r\nimport com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;\r\nimport com.sencha.gxt.widget.core.client.form.FileUploadField;\r\nimport com.sencha.gxt.widget.core.client.info.Info;\r\nimport gov.nist.hit.ds.docentryeditor.client.editor.widgets.EditorFieldLabel;\r\nimport gov.nist.hit.ds.docentryeditor.client.generics.abstracts.AbstractView;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.ToolTipResources;\r\n\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\n\r\npublic class FileUploadView extends AbstractView<FileUploadPresenter> {\r\n    private FormPanel form;\r\n    private FramedPanel panel;\r\n    private TextButton btnSubmit;\r\n    private TextButton btnCancel;\r\n\r\n    private FileUploadField file;\r\n\r\n    private static final int UPLOADER_WIDTH=500;\r\n    private static final int UPLOADER_HEIGHT=120;\r\n\r\n    @Override\r\n    public Widget asWidget() {\r\n        return panel.asWidget();\r\n    }\r\n\r\n    public TextButton getBtnSubmit() {\r\n        return btnSubmit;\r\n    }\r\n\r\n    public TextButton getBtnCancel() {\r\n        return btnCancel;\r\n    }\r\n\r\n    @Override\r\n    protected Map<String, Widget> getPathToWidgetsMap() {\r\n        Map<String, Widget> map = new HashMap<String, Widget>();\r\n        map.put(\"file\", file);\r\n        return map;\r\n    }\r\n\r\n    @Override\r\n    protected Widget buildUI() {\r\n        panel = new FramedPanel();\r\n        panel.setHeaderVisible(false);\r\n        panel.setButtonAlign(BoxLayoutPack.CENTER);\r\n        panel.setWidth(UPLOADER_WIDTH);\r\n        panel.setHeight(UPLOADER_HEIGHT);\r\n        panel.getElement().setMargins(5);\r\n        panel.setBorders(false);\r\n\r\n        form = new FormPanel();\r\n        form.setStyleName(\"form-margin\");\r\n        form.setAction(\"ServletUpload\");\r\n        form.setEncoding(FormPanel.ENCODING_MULTIPART);\r\n        form.setMethod(FormPanel.METHOD_POST);\r\n        panel.add(form);\r\n\r\n        VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();\r\n        form.add(vcontainer);\r\n\r\n        file = new FileUploadField();\r\n        file.addChangeHandler(new ChangeHandler() {\r\n\r\n            @Override\r\n            public void onChange(ChangeEvent event) {\r\n                if (!file.getValue().matches(\".*\\\\.xml\")) {\r\n                    Info.display(\"File Invalid\", \"XML File Required\");\r\n                    btnSubmit.disable();\r\n                    // file.isValid();\r\n                } else {\r\n                    Info.display(\"File Changed\", \"You selected \" + file.getValue());\r\n                    btnSubmit.enable();\r\n                }\r\n            }\r\n        });\r\n        file.setName(\"uploadedfile\");\r\n        file.setAllowBlank(false);\r\n\r\n        HtmlLayoutContainer uploadGuidance=new HtmlLayoutContainer(ToolTipResources.INSTANCE.getUploadFileTooltip());\r\n        EditorFieldLabel fileField=new EditorFieldLabel(file, \"Metadata file (*.xml)\");\r\n        vcontainer.add(uploadGuidance,new VerticalLayoutData(1,-1,new Margins(0,0,10,0)));\r\n        vcontainer.add(fileField, new VerticalLayoutData(1,-1,new Margins(0,0,0,0)));\r\n\r\n        btnSubmit = new TextButton(\"Open\");\r\n        btnSubmit.disable();\r\n        btnCancel = new TextButton(\"Cancel\");\r\n\r\n        panel.addButton(btnSubmit);\r\n        panel.addButton(btnCancel);\r\n\r\n        return panel;\r\n    }\r\n\r\n    @Override\r\n    protected void bindUI() {\r\n        btnSubmit.addSelectHandler(new SelectHandler() {\r\n\r\n            @Override\r\n            public void onSelect(SelectEvent event) {\r\n                if (file.getValue().matches(\".*\\\\.xml\")) {\r\n                    logger.info(\"Loading file...\");\r\n                    form.submit();\r\n                }\r\n            }\r\n\r\n        });\r\n        form.addSubmitCompleteHandler(new SubmitCompleteHandler() {\r\n\r\n            @Override\r\n            public void onSubmitComplete(SubmitCompleteEvent event) {\r\n                getPresenter().fileUploaded(event.getResults());\r\n            }\r\n        });\r\n    }\r\n\r\n}\r\n'),(4585,5714,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\nimport com.google.web.bindery.requestfactory.shared.ServiceLocator;\r\n\r\nimport java.util.logging.Logger;\r\n\r\npublic class GenericServiceLocator implements ServiceLocator {\r\n\r\n	private final static Logger LOGGER = Logger.getLogger(GenericServiceLocator.class.getName());\r\n\r\n	@Override\r\n	public Object getInstance(Class<?> clazz) {\r\n		try {\r\n			LOGGER.info(\"getInstance for Service : \" + clazz);\r\n			Object service;\r\n			service = clazz.newInstance();\r\n			LOGGER.info(\"serviceLocator returned : \" + service);\r\n			return service;\r\n		} catch (InstantiationException e) {\r\n			throw new RuntimeException(e);\r\n		} catch (IllegalAccessException e) {\r\n			throw new RuntimeException(e);\r\n		}\r\n	}\r\n\r\n}\r\n'),(4586,5715,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\nimport com.google.web.bindery.requestfactory.server.RequestFactoryServlet;\r\n\r\nimport java.io.File;\r\nimport java.io.FileOutputStream;\r\nimport java.io.IOException;\r\nimport java.io.Serializable;\r\nimport java.util.UUID;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * This class enables to create a xml metadata file\'s content on the server and\r\n * retrieve the name of the generated file.\r\n *\r\n * @author Olivier\r\n */\r\npublic class SaveFileService implements Serializable {\r\n\r\n    private final static Logger LOGGER = Logger.getLogger(SaveFileService.class.getName());\r\n    private static final long serialVersionUID = 1L;\r\n    private static File FILE_REPOSITORY;\r\n\r\n    public SaveFileService(){\r\n        String rootDirPath;\r\n        if (RequestFactoryServlet.getThreadLocalServletContext()!=null){\r\n            // ~ For realsed version. System.getProperty(\"user.dir\") returns null on our deployment system.\r\n            rootDirPath = RequestFactoryServlet.getThreadLocalServletContext().getRealPath(\"/\");\r\n        }else {\r\n            // ~ For tests purpose\r\n            rootDirPath = System.getProperty(\"user.dir\");\r\n        }\r\n        LOGGER.info(\"Root Path: \" + rootDirPath);\r\n        File fileFolder=new File(new File(rootDirPath),\"/files/\");\r\n        if(!fileFolder.exists()) {\r\n            LOGGER.info(\"Create storage folder \'files\'\'\");\r\n            fileFolder.mkdir();\r\n            LOGGER.info(\"... storage folder \'files\' created.\");\r\n        }\r\n        FILE_REPOSITORY=fileFolder;\r\n        LOGGER.info(\"New storage folder is: \" + FILE_REPOSITORY.getAbsolutePath());\r\n    }\r\n\r\n    /**\r\n     * Distant method that save a String into a generated xml file in the\r\n     * server. It returns the generated file name.\r\n     *\r\n     * @param fileContent\r\n     * @return String filename\r\n     */\r\n    public String saveAsXMLFile(String fileContent) {\r\n        LOGGER.info(\"Saving xml file...\");\r\n\r\n        // Random name created for save on server\r\n        String filename = UUID.randomUUID().toString() + \".xml\";\r\n\r\n        // Save xml file content into \"files\" repository\r\n        LOGGER.info(\"Metadata xml file creation...\");\r\n\r\n        // return created file\'s name\r\n        return saveAsXMLFile(filename,fileContent.replace(\"displayName\",\"name\"));\r\n\r\n//        return filename;\r\n    }\r\n\r\n    /**\r\n     * Distant method that save a String into a generated xml file in the\r\n     * server. It returns the generated file name.\r\n     *\r\n     * @param fileContent\r\n     * @param filename\r\n     * @return String filename\r\n     */\r\n    public String saveAsXMLFile(String filename, String fileContent) {\r\n        LOGGER.info(\"Saving xml file...\");\r\n\r\n        // Random name created for save on server\r\n        String fileName = filename;\r\n        if (fileName == null || fileName.equals(\"\"))\r\n            fileName = UUID.randomUUID().toString();\r\n        if (!(fileName.matches(\".*(\\\\.[0-9A-Za-z]+)$\") || fileName.matches(\".*\\\\.xml$\")))\r\n            fileName += \".xml\";\r\n\r\n        // Save xml file content into \"files\" repository\r\n        LOGGER.info(\"Metadata xml file creation...\");\r\n\r\n        FileOutputStream out;\r\n\r\n        // TODO Remove hard coded xml when submission set and association are done\r\n        String outS= fileContent.replace(\"displayName\",\"name\");\r\n\r\n        try {\r\n            out = new FileOutputStream(new File(FILE_REPOSITORY, fileName));\r\n            LOGGER.info(\"... writing file (\" + fileName + \") in \" + FILE_REPOSITORY.getAbsolutePath() + \"...\");\r\n            out.write(outS.getBytes());\r\n            out.close();\r\n        } catch (IOException e) {\r\n            LOGGER.warning(\"Error when writing metadata file on server.\\n\" + e.getMessage());\r\n        }\r\n        LOGGER.fine(\"... temporary file created: \" + FILE_REPOSITORY + \"/\" + fileName);\r\n\r\n        // return created file\'s name\r\n        return fileName;\r\n    }\r\n\r\n}\r\n'),(4587,5716,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\nimport org.apache.commons.fileupload.FileItemIterator;\r\nimport org.apache.commons.fileupload.FileItemStream;\r\nimport org.apache.commons.fileupload.servlet.ServletFileUpload;\r\nimport org.apache.commons.io.IOUtils;\r\n\r\nimport javax.servlet.ServletException;\r\nimport javax.servlet.http.HttpServlet;\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\nimport java.io.File;\r\nimport java.io.FileOutputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.nio.ByteBuffer;\r\nimport java.nio.charset.Charset;\r\nimport java.nio.charset.StandardCharsets;\r\nimport java.util.UUID;\r\nimport java.util.logging.Logger;\r\n\r\npublic class UploadFileServlet extends HttpServlet {\r\n	private final static Logger LOGGER = Logger.getLogger(UploadFileServlet.class.getName());\r\n	private static final long serialVersionUID = 1L;\r\n	private final static Charset ENCODING = StandardCharsets.UTF_8;\r\n	private final static String FILE_REPOSITORY = \"files\";\r\n\r\n\r\n	@Override\r\n	protected void doPost(HttpServletRequest req, HttpServletResponse resp)\r\n			throws ServletException {\r\n		try {\r\n			ServletFileUpload upload = new ServletFileUpload();\r\n			resp.setContentType(\"text/plain\");\r\n			FileItemIterator iterator = upload.getItemIterator(req);\r\n\r\n			while (iterator.hasNext()) {\r\n				FileItemStream item = iterator.next();\r\n                String filename=item.getName();\r\n\r\n				if (!item.isFormField()) {\r\n					LOGGER.fine(\"file uploaded on server side\");\r\n\r\n					// Reading file content\r\n					InputStream is = item.openStream();\r\n					byte[] encoded = IOUtils.toByteArray(is);\r\n					String fileContent = ENCODING.decode(\r\n							ByteBuffer.wrap(encoded)).toString();\r\n\r\n					// Return file content to the client\r\n//					resp.getOutputStream().print(filename+\";^;^;\"+fileContent);\r\n                    LOGGER.info(fileContent);\r\n					resp.getOutputStream().print(fileContent);\r\n\r\n\r\n                    // This was the previous method...\r\n					// String filename=writeTemporaryFile(item);\r\n					// // Send file\'s random name and its location\r\n					// resp.getOutputStream().print(FILE_REPOSITORY + \"/\" +\r\n					// filename);\r\n\r\n				}\r\n			}\r\n		} catch (Exception ex) {\r\n			throw new ServletException(ex);\r\n		}\r\n	}\r\n\r\n	/**\r\n	 * A better solution without writing a temporary file has been implemented.\r\n	 *\r\n	 * @deprecated\r\n	 * @param item\r\n	 * @return filename\r\n	 * @throws IOException\r\n	 */\r\n	@SuppressWarnings(\"unused\")\r\n	@Deprecated\r\n	private String writeTemporaryFile(FileItemStream item) throws IOException {\r\n		// Random name created for save on server\r\n		String filename = UUID.randomUUID().toString() + \".xml\";\r\n\r\n		// Recovery of submitted file and save it into \"files\"\r\n		// repository\r\n		LOGGER.info(\"Temporary metadata xml file creation...\");\r\n\r\n		FileOutputStream out = new FileOutputStream(new File(FILE_REPOSITORY,\r\n				filename));\r\n		InputStream is = item.openStream();\r\n		out.write(IOUtils.toByteArray(is));\r\n		out.close();\r\n\r\n		LOGGER.fine(\"... temporary file created: \" + FILE_REPOSITORY + \"/\"\r\n                + filename);\r\n\r\n		return filename;\r\n	}\r\n}\r\n'),(4588,5717,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\nimport com.google.gwt.user.server.rpc.RemoteServiceServlet;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParserServices;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.*;\r\nimport gov.nist.hit.ds.ebMetadata.Metadata;\r\nimport gov.nist.hit.ds.ebMetadata.MetadataParser;\r\nimport gov.nist.hit.ds.ebMetadata.MetadataSupport;\r\nimport gov.nist.hit.ds.utilities.xml.OMFormatter;\r\nimport gov.nist.hit.ds.xdsExceptions.MetadataException;\r\nimport gov.nist.hit.ds.xdsExceptions.XdsInternalException;\r\nimport org.apache.axiom.om.OMElement;\r\n\r\nimport java.text.DateFormat;\r\nimport java.text.ParseException;\r\nimport java.text.SimpleDateFormat;\r\nimport java.util.ArrayList;\r\nimport java.util.Date;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.logging.Logger;\r\n\r\n/**\r\n * This class is a parser meant to generate a XdsMetadata object from an ebRim Metadata\r\n * XML file.\r\n *\r\n * @See XdsMetadata\r\n */\r\npublic class XdsMetadataParserServicesImpl extends RemoteServiceServlet implements XdsParserServices{\r\n    private Metadata m;\r\n    private XdsMetadata xdsMetadata;\r\n\r\n    private final static Logger LOGGER = Logger.getLogger(XdsMetadataParserServicesImpl.class.getName());\r\n    private final static List<String> SCHEMES = new ArrayList<String>();\r\n    private Map<String, List<String>> codes = null;\r\n\r\n    public XdsMetadataParserServicesImpl(){\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_classCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_confCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_eventCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_formatCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_hcftCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_psCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSDocumentEntry_typeCode_uuid);\r\n        SCHEMES.add(MetadataSupport.XDSSubmissionSet_contentTypeCode_uuid);\r\n    }\r\n\r\n    /**\r\n     * Method that returns a complete XdsMetadata object containing\r\n     * all the metadata information extracted from the given XML\r\n     * ebRim Metadata document.\r\n     * @param fileContent ebRim document XML.\r\n     * @return XdsMetadataObject\r\n     */\r\n    @Override\r\n    public XdsMetadata parseXdsMetadata(String fileContent) {\r\n        xdsMetadata=new XdsMetadata();\r\n        try {\r\n            m=MetadataParser.parse(fileContent);\r\n            for(OMElement oe : m.getRegistryPackages()){\r\n                // parse and set the Submission Set (Registry Packages)\r\n                xdsMetadata.setSubmissionSet(parseSubmissionSet(oe));\r\n            }\r\n            // parse and add the document entries (Extrinsic Objects)\r\n            for(OMElement eo : m.getExtrinsicObjects()){\r\n                xdsMetadata.getDocumentEntries().add(parseDocumentEntry(eo));\r\n            }\r\n        } catch (XdsInternalException e) {\r\n            LOGGER.warning(e.getMessage());\r\n        } catch (MetadataException e) {\r\n            LOGGER.warning(e.getMessage());\r\n        }\r\n        return xdsMetadata;\r\n    }\r\n\r\n    /**\r\n     * Method that parses an ebRim RegistryPackages from an ebRim Metadata document\r\n     * to create a XdsSubmissionSet object.\r\n     * @param oe ebRim RegistryPackages from a Metadata document.\r\n     * @return XdsSubmissionSet object\r\n     */\r\n    private XdsSubmissionSet parseSubmissionSet(OMElement oe) {\r\n        OMFormatter omf=new OMFormatter(oe);\r\n        omf.noRecurse();\r\n\r\n        XdsSubmissionSet subSet=new XdsSubmissionSet();\r\n        subSet.setEntryUUID(new String256(m.getSubmissionSetId()));\r\n        String status = m.getStatus(oe);\r\n        if(status!= null) {\r\n            subSet.setAvailabilityStatus(new String256(status));\r\n        }\r\n        String home=m.getHome(oe);\r\n        if (home!=null){\r\n            subSet.setHomeCommunityId(new String256(home));\r\n        }\r\n        NameValueDTM submissionTime=new NameValueDTM();\r\n        submissionTime.getValues().clear();\r\n        String submissionTimeString=asString(m.getSlotValue(oe, \"submissionTime\", 0));\r\n        while(submissionTimeString.length()<14){\r\n            submissionTimeString += \"0\";\r\n        }\r\n        submissionTime.getValues().add(new DTM(parserDate(submissionTimeString)));\r\n        subSet.setSubmissionTime(submissionTime);\r\n        for(String s:m.getSlotValues(oe, \"intendedRecipient\")){\r\n            subSet.getIntendedRecipient().getValues().add(new String256(s));\r\n        }\r\n        try {\r\n            String patientId=m.getSubmissionSetPatientId();\r\n            if (patientId!=null) {\r\n                subSet.setPatientId(new IdentifierString256(new String256(patientId), new String256(MetadataSupport.XDSSubmissionSet_patientid_uuid)));\r\n            }\r\n            subSet.setUniqueId(new IdentifierOID(new OID(new String256(m.getSubmissionSetUniqueId())),new String256(MetadataSupport.XDSSubmissionSet_uniqueid_uuid)));\r\n            subSet.setSourceId(new IdentifierOID(new OID(new String256(m.getSubmissionSetSourceId(oe))),new String256(MetadataSupport.XDSSubmissionSet_sourceid_uuid)));\r\n            codes = m.getCodesWithDisplayName(oe, SCHEMES);\r\n            String[] contentTypeCode = codes.get(MetadataSupport.XDSSubmissionSet_contentTypeCode_uuid).get(0).split(\"\\\\^\");\r\n            subSet.setContentTypeCode(new CodedTerm(contentTypeCode[0],contentTypeCode[1],contentTypeCode[2]));\r\n            List<OMElement> authorClassifications = m.getClassifications(oe, MetadataSupport.XDSSubmissionSet_author_uuid);\r\n            subSet.setAuthors(parseAuthors(authorClassifications));\r\n        } catch (MetadataException e) {\r\n            LOGGER.warning(e.getMessage());\r\n        } catch (Exception e) {LOGGER.warning(e.getMessage());}\r\n        return subSet;\r\n    }\r\n\r\n    /**\r\n     * Method that parses an ebRim ExtrinsicObject from an ebRim Metadata document\r\n     * to create a XdsDocumentEntry object.\r\n     * @param ele ebRim ExtrinsicObject from a Metadata document.\r\n     * @return XdsDocumentEntry\r\n     */\r\n    private XdsDocumentEntry parseDocumentEntry(OMElement ele) {\r\n        OMFormatter omf = new OMFormatter(ele);\r\n        omf.noRecurse();\r\n\r\n        XdsDocumentEntry de=new XdsDocumentEntry();\r\n        de.setId(new String256(asString(m.getId(ele))));\r\n        de.setLogicalId(new String256(asString(m.getLid(ele))));\r\n        de.setVersion(new String256(asString(m.getVersion(ele))));\r\n        de.setAvailabilityStatus(new String256(asString(m.getStatus(ele))));\r\n        de.setHomeCommunityId(new String256(asString(m.getHome(ele))));\r\n\r\n        // FIXME should be a list\r\n//        de.title = asString(m.getNameValue(ele));\r\n//        de.titleX = new OMFormatter(MetadataSupport.firstChildWithLocalName(ele, \"Name\")).toHtml();\r\n        //FIXME should be a list\r\n//        de.comments = asString(m.getDescriptionValue(ele));\r\n//        de.commentsX = new OMFormatter(MetadataSupport.firstChildWithLocalName(ele, \"Description\")).toHtml();\r\n\r\n        de.setMimeType(new String256(asString(m.getMimeType(ele))));\r\n        de.setHash(new String256(asString(m.getSlotValue(ele, \"hash\", 0))));\r\n        de.setLanguageCode(LanguageCode.getValueOf(asString(m.getSlotValue(ele, \"languageCode\", 0))));\r\n        de.getLegalAuthenticator().getValues().add(new String256(asString(m.getSlotValue(ele, \"legalAuthenticator\", 0))));\r\n\r\n        NameValueDTM serviceStartDate=new NameValueDTM();\r\n        serviceStartDate.getValues().clear();\r\n        String serviceStartDateString=asString(m.getSlotValue(ele, \"serviceStartTime\", 0));\r\n        while(serviceStartDateString.length()<14){\r\n            serviceStartDateString += \"0\";\r\n        }\r\n        serviceStartDate.getValues().add(new DTM(parserDate(serviceStartDateString)));\r\n        de.setServiceStartTime(serviceStartDate);\r\n\r\n        NameValueDTM serviceStopDate=new NameValueDTM();\r\n        serviceStopDate.getValues().clear();\r\n        String serviceStopDateString=asString(m.getSlotValue(ele, \"serviceStopTime\", 0));\r\n        while(serviceStopDateString.length()<14){\r\n            serviceStopDateString += \"0\";\r\n        }\r\n        serviceStopDate.getValues().add(new DTM(parserDate(serviceStopDateString)));\r\n        de.setServiceStopTime(serviceStopDate);\r\n\r\n        de.setRepoUId(new OID(new String256(asString(m.getSlotValue(ele, \"repositoryUniqueId\", 0)))));\r\n        de.setUri(new String256(asString(m.getSlotValue(ele, \"URI\", 0))));\r\n\r\n        String sizeString=asString(m.getSlotValue(ele, \"size\", 0));\r\n        if (sizeString!=null&&!sizeString.equals(\"\")) {\r\n            de.getSize().getValues().clear();\r\n            de.getSize().getValues().add(Integer.parseInt(sizeString));\r\n        }\r\n\r\n        // parseExtra(de, ele);\r\n\r\n        try {\r\n            de.setPatientID(new IdentifierString256(new String256(asString(m.getPatientId(ele))),new String256(\"urn:uuid:6b5aea1a-874d-4603-a4bc-96a0a7b38446\")));\r\n            de.setUniqueId(new IdentifierOID(new OID(new String256(asString(m.getUniqueIdValue(ele)))),new String256(\"urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab\")));\r\n        } catch (MetadataException e) {\r\n           LOGGER.warning(e.getMessage());\r\n        }\r\n        de.getSourcePatientId().getValues().add(new String256(asString(m.getSlotValue(ele, \"sourcePatientId\", 0))));\r\n        for(String s:m.getSlotValues(ele, \"sourcePatientInfo\")){\r\n            de.getSourcePatientInfo().getValues().add(new String256(s));\r\n        }\r\n\r\n        NameValueDTM creationTime=new NameValueDTM();\r\n        creationTime.getValues().clear();\r\n        String creationTimeString =asString(m.getSlotValue(ele, \"creationTime\", 0));\r\n        while(creationTimeString.length()<14){\r\n            creationTimeString+=\"0\";\r\n        }\r\n        creationTime.getValues().add(new DTM(parserDate(creationTimeString)));\r\n        de.setCreationTime(creationTime);\r\n\r\n        try {\r\n            codes = m.getCodesWithDisplayName(ele, SCHEMES);\r\n\r\n            String[] classCodeStrings = codes.get(MetadataSupport.XDSDocumentEntry_classCode_uuid).get(0).split(\"\\\\^\");\r\n            de.setClassCode(new CodedTerm(classCodeStrings[0],classCodeStrings[1],classCodeStrings[2]));\r\n\r\n            String[] formatCodeStrings = codes.get(MetadataSupport.XDSDocumentEntry_formatCode_uuid).get(0).split(\"\\\\^\");\r\n            de.setFormatCode(new CodedTerm(formatCodeStrings[0], formatCodeStrings[1], formatCodeStrings[2]));\r\n\r\n            String[] hcftCodeStrings = codes.get(MetadataSupport.XDSDocumentEntry_hcftCode_uuid).get(0).split(\"\\\\^\");\r\n            de.setHealthcareFacilityType(new CodedTerm(hcftCodeStrings[0], hcftCodeStrings[1], hcftCodeStrings[2]));\r\n\r\n            String[] practiceSettingCodeStrings = codes.get(MetadataSupport.XDSDocumentEntry_psCode_uuid).get(0).split(\"\\\\^\");\r\n            de.setPracticeSettingCode(new CodedTerm(practiceSettingCodeStrings[0], practiceSettingCodeStrings[1], practiceSettingCodeStrings[2]));\r\n\r\n            String[] typeCodeStrings = codes.get(MetadataSupport.XDSDocumentEntry_typeCode_uuid).get(0).split(\"\\\\^\");\r\n            de.setTypeCode(new CodedTerm(typeCodeStrings[0], typeCodeStrings[1], typeCodeStrings[2]));\r\n\r\n            List<CodedTerm> confidentialityCodes=new ArrayList<CodedTerm>();\r\n            for (String confCode:codes.get(MetadataSupport.XDSDocumentEntry_confCode_uuid)){\r\n                String[] confCodeStrings=confCode.split(\"\\\\^\");\r\n                confidentialityCodes.add(new CodedTerm(confCodeStrings[0],confCodeStrings[1],confCodeStrings[2]));\r\n            }\r\n            de.setConfidentialityCodes(confidentialityCodes);\r\n\r\n            List<CodedTerm> eventCodes=new ArrayList<CodedTerm>();\r\n            for(String eventCodeString:codes.get(MetadataSupport.XDSDocumentEntry_eventCode_uuid)){\r\n                String[] eventCodeStrings=eventCodeString.split(\"\\\\^\");\r\n                eventCodes.add(new CodedTerm(eventCodeStrings[0],eventCodeStrings[1],eventCodeStrings[2]));\r\n            }\r\n            de.setEventCode(eventCodes);\r\n        } catch(Exception e) {LOGGER.warning(e.getMessage());}\r\n        try {\r\n            List<OMElement> authorClassifications = m.getClassifications(ele, MetadataSupport.XDSDocumentEntry_author_uuid);\r\n            de.setAuthors(parseAuthors(authorClassifications));\r\n            for (OMElement auEle : authorClassifications) {\r\n                // TODO\r\n                // de.authorsX.add(new OMFormatter(auEle).toHtml());\r\n            }\r\n        } catch (Exception e) {LOGGER.warning(e.getMessage());}\r\n\r\n        return de;\r\n    }\r\n\r\n    /**\r\n     * Method that parses a list of ebRim author classification\r\n     * to return a list of Author java objects.\r\n     * @param authorClassifications list of ebRim author classification.\r\n     * @return a list of Author java objects.\r\n     */\r\n    List<Author> parseAuthors(List<OMElement> authorClassifications) {\r\n        List<Author> authors = new ArrayList<Author>();\r\n\r\n        for (OMElement authorClas : authorClassifications) {\r\n            String name = m.getSlotValue(authorClas, \"authorPerson\", 0);\r\n            List<String> institutions = m.getSlotValues(authorClas, \"authorInstitution\");\r\n            List<String> roles = m.getSlotValues(authorClas, \"authorRole\");\r\n            List<String> specialties = m.getSlotValues(authorClas, \"authorSpecialty\");\r\n            Author a = new Author();\r\n            a.setAuthorPerson(new String256(name));\r\n            for (String s:institutions)\r\n                a.getAuthorInstitutions().add(new String256(s));\r\n            for (String s:roles)\r\n                a.getAuthorRoles().add(new String256(s));\r\n            for (String s:specialties)\r\n                a.getAuthorSpecialties().add(new String256(s));\r\n            // TODO telecommunication is missing\r\n            authors.add(a);\r\n        }\r\n\r\n        return authors;\r\n    }\r\n\r\n    /**\r\n     * This method generates formatted ebRim xml as a String for the metadata given in parameter.\r\n     *\r\n     * @param metadata XdsMetadata object to be translated to ebRim xml.\r\n     * @return ebRim xml of the metadata given in parameter as a String.\r\n     */\r\n    public String toEbRim(XdsMetadata metadata){\r\n        Metadata m=new Metadata();\r\n        // Submission Set\r\n        // TODO authors, comments, titles are missing\r\n        XdsSubmissionSet subSet=metadata.getSubmissionSet();\r\n        OMElement regPackage=m.mkSubmissionSet(subSet.getEntryUUID().toString());\r\n        m.addSubmissionSetPatientId(regPackage,subSet.getPatientId().getValue().toString());\r\n        m.addSubmissionSetUniqueId(regPackage,subSet.getUniqueId().getValue().toString());\r\n        m.addSlot(regPackage,\"submissionTime\",formatDate(subSet.getSubmissionTime().getValues().get(0).getDtm()));\r\n        m.addExtClassification(regPackage,MetadataSupport.XDSSubmissionSet_contentTypeCode_uuid,\r\n                subSet.getContentTypeCode().getCodingScheme().toString(),\r\n                subSet.getContentTypeCode().getDisplayName().toString(),\r\n                subSet.getContentTypeCode().getCode().toString());\r\n        m.addExternalId(regPackage,MetadataSupport.XDSSubmissionSet_sourceid_uuid,subSet.getSourceId().getValue().toString(),\"sourceId\");\r\n        if (subSet.getHomeCommunityId()!=null && !subSet.getHomeCommunityId().toString().equals(\"\")){\r\n            m.setHome(regPackage,subSet.getHomeCommunityId().toString());\r\n        }\r\n        if (subSet.getAvailabilityStatus()!=null && !subSet.getAvailabilityStatus().toString().equals(\"\")){\r\n            m.setStatus(regPackage,subSet.getAvailabilityStatus().toString());\r\n        }\r\n        if (!subSet.getIntendedRecipient().getValues().isEmpty()) {\r\n            OMElement intendedRecipient = m.addSlot(regPackage, \"intendedRecipient\");\r\n            for (String256 r : subSet.getIntendedRecipient().getValues()) {\r\n                m.addSlotValue(intendedRecipient, r.toString());\r\n            }\r\n        }\r\n        // DocEntries\r\n        // TODO authors, titles and comments are missing\r\n        for (XdsDocumentEntry documentEntry : metadata.getDocumentEntries()) {\r\n            OMElement extObj = m.mkExtrinsicObject(documentEntry.getId().toString(), documentEntry.getMimeType().toString());\r\n            m.addDocumentEntryPatientId(extObj, documentEntry.getPatientID().getValue().toString());\r\n            m.addDocumentEntryUniqueId(extObj, documentEntry.getUniqueId().getValue().toString());\r\n            m.addSlot(extObj, \"languageCode\", documentEntry.getLanguageCode().toString());\r\n            m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_classCode_uuid, documentEntry.getClassCode().getCodingScheme().toString(), documentEntry.getClassCode().getDisplayName().toString(), documentEntry.getClassCode().getCode().toString());\r\n            m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_formatCode_uuid, documentEntry.getFormatCode().getCodingScheme().toString(), documentEntry.getFormatCode().getDisplayName().toString(), documentEntry.getFormatCode().getCode().toString());\r\n            m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_hcftCode_uuid, documentEntry.getHealthcareFacilityType().getCodingScheme().toString(), documentEntry.getHealthcareFacilityType().getDisplayName().toString(), documentEntry.getHealthcareFacilityType().getCode().toString());\r\n            m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_typeCode_uuid, documentEntry.getTypeCode().getCodingScheme().toString(), documentEntry.getTypeCode().getDisplayName().toString(), documentEntry.getTypeCode().getCode().toString());\r\n            m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_psCode_uuid, documentEntry.getPracticeSettingCode().getCodingScheme().toString(), documentEntry.getPracticeSettingCode().getDisplayName().toString(), documentEntry.getPracticeSettingCode().getCode().toString());\r\n            if (documentEntry.getCreationTime().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"creationTime\", formatDate(documentEntry.getCreationTime().getValues().get(0).getDtm()));\r\n            }\r\n            if (documentEntry.getHash() != null && !documentEntry.getHash().toString().equals(\"\")) {\r\n                m.addSlot(extObj, \"hash\", documentEntry.getHash().toString());\r\n            }\r\n            if (documentEntry.getSize().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"size\", documentEntry.getSize().getValues().get(0).toString());\r\n            }\r\n            if (documentEntry.getRepoUId() != null && !documentEntry.getRepoUId().toString().equals(\"\")) {\r\n                m.addSlot(extObj, \"repositoryUniqueId\", documentEntry.getRepoUId().toString());\r\n            }\r\n            if (documentEntry.getUri() != null && !documentEntry.getUri().toString().equals(\"\")) {\r\n                m.addSlot(extObj, \"URI\", documentEntry.getUri().toString());\r\n            }\r\n            if (documentEntry.getHomeCommunityId() != null && !documentEntry.getHomeCommunityId().toString().equals(\"\")) {\r\n                m.setHome(extObj, documentEntry.getHomeCommunityId().toString());\r\n            }\r\n            if (documentEntry.getAvailabilityStatus() != null && !documentEntry.getAvailabilityStatus().toString().equals(\"\")) {\r\n                m.setStatus(extObj, documentEntry.getAvailabilityStatus().toString());\r\n            }\r\n            if (documentEntry.getLegalAuthenticator().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"legalAuthenticator\", documentEntry.getLegalAuthenticator().getValues().get(0).toString());\r\n            }\r\n            if (documentEntry.getSourcePatientId().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"sourcePatientId\", documentEntry.getSourcePatientId().getValues().get(0).getString());\r\n            }\r\n            if (!documentEntry.getSourcePatientInfo().getValues().isEmpty()) {\r\n                OMElement sourcePatientInfo = m.addSlot(extObj, \"sourcePatientInfo\");\r\n                for (String256 value : documentEntry.getSourcePatientInfo().getValues()) {\r\n                    m.addSlotValue(sourcePatientInfo, value.toString());\r\n                }\r\n            }\r\n            for (CodedTerm ct : documentEntry.getEventCode()) {\r\n                m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_eventCode_uuid, ct.getCodingScheme().toString(), ct.getDisplayName().toString(), ct.getCode().toString());\r\n            }\r\n            for (CodedTerm ct : documentEntry.getConfidentialityCodes()) {\r\n                m.addExtClassification(extObj, MetadataSupport.XDSDocumentEntry_confCode_uuid, ct.getCodingScheme().toString(), ct.getDisplayName().toString(), ct.getCode().toString());\r\n            }\r\n            if (documentEntry.getServiceStartTime().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"serviceStartTime\", formatDate(documentEntry.getServiceStartTime().getValues().get(0).getDtm()));\r\n            }\r\n            if (documentEntry.getServiceStopTime().getValues().get(0) != null) {\r\n                m.addSlot(extObj, \"serviceStopTime\", formatDate(documentEntry.getServiceStopTime().getValues().get(0).getDtm()));\r\n            }\r\n            // FIXME this is not working\r\n            for (Author author : documentEntry.getAuthors()) {\r\n                OMElement authorClassification = m.addIntClassification(extObj, MetadataSupport.XDSDocumentEntry_author_uuid);\r\n                m.addSlot(authorClassification, \"authorPerson\", author.getAuthorPerson().toString());\r\n                OMElement authorInstitutionClassification = m.addSlot(authorClassification, \"authorInstitution\");\r\n                for (String256 institution : author.getAuthorInstitutions()) {\r\n                    m.addSlotValue(authorInstitutionClassification, institution.toString());\r\n                }\r\n                OMElement authorRoleClassification = m.addSlot(authorClassification, \"authorRole\");\r\n                for (String256 role : author.getAuthorRoles()) {\r\n                    m.addSlotValue(authorRoleClassification, role.toString());\r\n                }\r\n                OMElement authorSpecialtyClassification = m.addSlot(authorClassification, \"authorSpecialty\");\r\n                for (String256 specialty : author.getAuthorSpecialties()) {\r\n                    m.addSlotValue(authorSpecialtyClassification, specialty.toString());\r\n                }\r\n                OMElement authorTelecommunicationClassification = m.addSlot(authorClassification, \"authorTelecommunication\");\r\n                for (String256 telecommunication : author.getAuthorTelecommunications()) {\r\n                    m.addSlotValue(authorTelecommunicationClassification, telecommunication.toString());\r\n                }\r\n            }\r\n            m.addAssociation(m.mkAssociation(MetadataSupport.assoctype_has_member, subSet.getEntryUUID().toString(), documentEntry.getId().toString()));\r\n        }\r\n        String result=\"<xdsb:ProvideAndRegisterDocumentSetRequest xmlns:xdsb=\\\"urn:ihe:iti:xds-b:2007\\\">\\n\" +\r\n                \"    <lcm:SubmitObjectsRequest xmlns:lcm=\\\"urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0\\\">\\n\" +\r\n                \"        <rim:RegistryObjectList xmlns:rim=\\\"urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0\\\">\";\r\n        result+=m.format();\r\n        result+=\"</rim:RegistryObjectList>\\n\" +\r\n                \"    </lcm:SubmitObjectsRequest>\\n\" +\r\n                \"</xdsb:ProvideAndRegisterDocumentSetRequest>\";\r\n\r\n        return result;\r\n    }\r\n\r\n    private String formatDate(Date date){\r\n        DateFormat dFormatter = new SimpleDateFormat(\"yyyyMMddHHmmss\");\r\n        return dFormatter.format(date);\r\n    }\r\n\r\n    private Date parserDate(String sdate) {\r\n        DateFormat lFormatter = new SimpleDateFormat(\"yyyyMMddHHmmss\");\r\n        Date date=new Date();\r\n        try {\r\n            date = (Date)lFormatter.parse(sdate);\r\n        } catch (ParseException e) {\r\n            LOGGER.warning(e.getMessage());\r\n        }\r\n        return date;\r\n    }\r\n\r\n    private String splitLast(String in, String separator) {\r\n        String[] parts = in.split(separator);\r\n        if (parts.length <= 1)\r\n            return in;\r\n        return parts[parts.length - 1];\r\n    }\r\n\r\n    private String asString(String in) {\r\n        if (in == null) return \"\";\r\n        return in;\r\n    }\r\n}\r\n'),(4589,5719,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport org.hibernate.validator.constraints.NotEmpty;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents an author.</b>\r\n * </p>\r\n * <p>\r\n * An author has the following parameters:\r\n * <ul>\r\n * <li>{@link #authorPerson}: The name of the author ( {@link String256}) ;</li>\r\n * <li>{@link #authorTelecommunications}: Telecommunication for the author, like email address ( {@link String256}) ;</li>\r\n * <li>{@link #authorInstitutions}: The institutions the author is working for\r\n * (List of {@link String256}) ;</li>\r\n * <li>{@link #authorRoles}: The roles of the author (List of {@link String256})\r\n * ;</li>\r\n * <li>{@link #authorSpecialties}: The specialties of the author (List of\r\n * {@link String256}).</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the author in XML format.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * This class also contains getters/setters.<br>\r\n * In addition, it has several methods such as verify, toXML or toString.</br>\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * {@link #toString() method toString}\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement </p>\r\n */\r\npublic class Author implements ModelElement, Serializable {\r\n    private static final long serialVersionUID = 4744955203293986600L;\r\n\r\n    /**\r\n     * <b>String256 authorPerson</b> - His name [Mandatory].<br>\r\n     * Type: {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see Author\r\n     */\r\n    @NotNull\r\n    private String256 authorPerson;\r\n\r\n    /**\r\n     * <b>List(String256) authorInstitutions</b> - The institutions that the\r\n     * author is working for [Mandatory].<br>\r\n     * Type: List of {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see Author\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<String256> authorInstitutions;\r\n\r\n    /**\r\n     * <b>String256 authorRoles</b> - His roles [Mandatory].<br>\r\n     * Type: List of {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see Author\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<String256> authorRoles;\r\n\r\n    /**\r\n     * <b>List(String256) authorSpecialties</b> Specialties - his specialties\r\n     * [Mandatory].<br>\r\n     * Type: List of {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see Author\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<String256> authorSpecialties;\r\n\r\n    /**\r\n     * <b>List(String256) authorTelecommunications</b> - His name [Mandatory].<br>\r\n     * Type: {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see Author\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<String256> authorTelecommunications;\r\n\r\n    public Author() {\r\n        authorPerson = new String256();\r\n        authorInstitutions = new ArrayList<String256>();\r\n        authorRoles = new ArrayList<String256>();\r\n        authorSpecialties = new ArrayList<String256>();\r\n        authorTelecommunications = new ArrayList<String256>();\r\n    }\r\n\r\n    public String256 getAuthorPerson() {\r\n        return authorPerson;\r\n    }\r\n\r\n    public void setAuthorPerson(String256 authorPerson) {\r\n        this.authorPerson = authorPerson;\r\n    }\r\n\r\n    public List<String256> getAuthorInstitutions() {\r\n        return authorInstitutions;\r\n    }\r\n\r\n    public void setAuthorInstitutions(List<String256> authorInstitutions) {\r\n        this.authorInstitutions = authorInstitutions;\r\n    }\r\n\r\n    public List<String256> getAuthorRoles() {\r\n        return authorRoles;\r\n    }\r\n\r\n    public void setAuthorRoles(List<String256> authorRoles) {\r\n        this.authorRoles = authorRoles;\r\n    }\r\n\r\n    public List<String256> getAuthorSpecialties() {\r\n        return authorSpecialties;\r\n    }\r\n\r\n    public void setAuthorSpecialties(List<String256> authorSpecialties) {\r\n        this.authorSpecialties = authorSpecialties;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toString</b> <br>\r\n     * This method will be called to print author into a String </br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the author\r\n     * @see Author class Author\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        String author = \"Author: \" + authorPerson.toString() + \", AuthorInstitutions=\\\"\";\r\n\r\n        int counter=0;\r\n        for (String256 str : authorInstitutions) {\r\n            counter++;\r\n            author = author + str.toString();\r\n            if(counter<authorInstitutions.size()) {\r\n                author += \",\";\r\n            }\r\n        }\r\n        author = author + \"\\\", AuthorRoles=\\\"\";\r\n\r\n        counter=0;\r\n        for (String256 str : authorRoles) {\r\n            counter++;\r\n            author = author + str.toString();\r\n            if(counter<authorRoles.size()) {\r\n                author += \",\";\r\n            }\r\n        }\r\n        author = author + \"\\\", AuthorSpecialties=\\\"\";\r\n\r\n        counter=0;\r\n        for (String256 str : authorSpecialties) {\r\n            author = author + str.toString();\r\n            if (counter<authorSpecialties.size()) {\r\n                author += \",\";\r\n            }\r\n        }\r\n        author = author + \"\\\"\";\r\n\r\n        return author;\r\n    }\r\n\r\n    public List<String256> getAuthorTelecommunications() {\r\n        return authorTelecommunications;\r\n    }\r\n\r\n    public void setAuthorTelecommunications(List<String256> authorTelecommunications) {\r\n        this.authorTelecommunications = authorTelecommunications;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local Author.\r\n     * </br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the author in XML format\r\n     * @see Author class Author\r\n     */\r\n    public String toXML() {\r\n        String author = \"\\t\\t<author>\\n\";\r\n\r\n        author += \"\\t\\t\\t<authorPerson>\" + authorPerson.toString().replace(\"&\",\"&amp;\") + \"</authorPerson>\\n\";\r\n\r\n        if (!authorInstitutions.isEmpty()) {\r\n            author += \"\\t\\t\\t<authorInstitutions>\\n\";\r\n            for (String256 str : authorInstitutions) {\r\n                author = author + \"\\t\\t\\t\\t<authorInstitution>\" + str.toString().replace(\"&\",\"&amp;\") + \"</authorInstitution>\\n\";\r\n            }\r\n            author = author + \"\\t\\t\\t</authorInstitutions>\\n\";\r\n        }\r\n\r\n        if (!authorRoles.isEmpty()) {\r\n            author += \"\\t\\t\\t<authorRoles>\\n\";\r\n            for (String256 str : authorRoles) {\r\n                author = author + \"\\t\\t\\t\\t<authorRole>\" + str.toString().replace(\"&\", \"&amp;\") + \"</authorRole>\\n\";\r\n            }\r\n            author = author + \"\\t\\t\\t</authorRoles>\\n\";\r\n        }\r\n\r\n        if (!authorSpecialties.isEmpty()) {\r\n            author += \"\\t\\t\\t<authorSpecialties>\\n\";\r\n            for (String256 str : authorSpecialties) {\r\n                author = author + \"\\t\\t\\t\\t<authorSpecialty>\" + str.toString().replace(\"&\", \"&amp;\") + \"</authorSpecialty>\\n\";\r\n            }\r\n            author = author + \"\\t\\t\\t</authorSpecialties>\\n\";\r\n        }\r\n\r\n        if (!authorTelecommunications.isEmpty()) {\r\n            author = author + \"\\t\\t\\t<authorTelecommunications>\\n\";\r\n            for (String256 str : authorTelecommunications) {\r\n                author = author + \"\\t\\t\\t\\t<authorTelecommunication>\" + str.toString() + \"</authorTelecommunication>\\n\";\r\n            }\r\n            author = author + \"\\t\\t\\t</authorTelecommunications>\\n\";\r\n        }\r\n\r\n        author += \"\\t\\t</author>\\n\";\r\n\r\n        return author;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s Author is\r\n     * correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see Author class Author\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        // TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true; }\r\n        if (!(o instanceof Author)){return false;}\r\n\r\n        Author author = (Author) o;\r\n\r\n        if (authorInstitutions != null ? !authorInstitutions.equals(author.authorInstitutions) : author.authorInstitutions != null)\r\n            return false;\r\n        if (authorPerson != null ? !authorPerson.equals(author.authorPerson) : author.authorPerson != null)\r\n            return false;\r\n        if (authorRoles != null ? !authorRoles.equals(author.authorRoles) : author.authorRoles != null) return false;\r\n        if (authorSpecialties != null ? !authorSpecialties.equals(author.authorSpecialties) : author.authorSpecialties != null)\r\n            return false;\r\n        if (authorTelecommunications != null ? !authorTelecommunications.equals(author.authorTelecommunications) : author.authorTelecommunications != null)\r\n            return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = authorPerson.hashCode();\r\n        result = 31 * result + (authorInstitutions != null ? authorInstitutions.hashCode() : 0);\r\n        result = 31 * result + (authorRoles != null ? authorRoles.hashCode() : 0);\r\n        result = 31 * result + (authorSpecialties != null ? authorSpecialties.hashCode() : 0);\r\n        result = 31 * result + (authorTelecommunications != null ? authorTelecommunications.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public Author copy() {\r\n        Author cp = new Author();\r\n        cp.setAuthorPerson(this.authorPerson.copy());\r\n        for (String256 institution : this.authorInstitutions){\r\n            cp.getAuthorInstitutions().add(institution.copy());\r\n        }\r\n        for (String256 speciality : this.authorSpecialties){\r\n            cp.getAuthorSpecialties().add(speciality.copy());\r\n        }\r\n        for (String256 role : this.authorRoles){\r\n            cp.getAuthorRoles().add(role.copy());\r\n        }\r\n        for (String256 telecommunication : this.authorTelecommunications){\r\n            cp.getAuthorTelecommunications().add(telecommunication.copy());\r\n        }\r\n        return cp;\r\n    }\r\n}\r\n'),(4590,5720,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents a CodedTerm.</b>\r\n * </p>\r\n * <p>\r\n * A CodedTerm has the following parameters:\r\n * <ul>\r\n * <li>{@link #displayName}: The name of the CodedTerm ( {@link String256}) ;</li>\r\n * <li>{@link #code}: A suitable code ({@link String256}) ;</li>\r\n * <li>{@link #codingScheme}: A codingScheme which have to be respected (\r\n * {@link CodingScheme}) ;</li>\r\n * </ul>\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * It contains a toXML method to return the author in XML format and verify\r\n * method to check if syntax\'s CodedTerm is correct.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * This class also contains getters/setters.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below the method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class CodedTerm implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = 3881628246755015516L;\r\n\r\n    /**\r\n     * <b>String256 displayName</b> - The name of the CodedTerm [Mandatory].<br>\r\n     * Type: {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see CodedTerm\r\n     */\r\n    @NotNull\r\n    private String256 displayName;\r\n\r\n    /**\r\n     * <b>String256 code</b> - The code of the CodedTerm [Mandatory].<br>\r\n     * Type: {@link String256}</br> </p>\r\n     *\r\n     * @see String256\r\n     * @see CodedTerm\r\n     */\r\n    @NotNull\r\n    private String256 code;\r\n\r\n    /**\r\n     * <b>CodingScheme codingScheme</b> - The name of the CodedTerm [Mandatory].<br>\r\n     * Type: {@link CodingScheme}</br> </p>\r\n     *\r\n     * @see CodingScheme\r\n     * @see CodedTerm\r\n     */\r\n    @NotNull\r\n    private CodingScheme codingScheme;\r\n\r\n    public CodedTerm() {\r\n        displayName = new String256();\r\n        code = new String256();\r\n        codingScheme = new CodingScheme();\r\n    }\r\n\r\n    public CodedTerm(String code, String displayName, String codingScheme) {\r\n        this.displayName = new String256().setString(displayName);\r\n        this.code = new String256().setString(code);\r\n        this.codingScheme = new CodingScheme().setCodingScheme(new String256().setString(codingScheme));\r\n    }\r\n\r\n    public String256 getDisplayName() {\r\n        return displayName;\r\n    }\r\n\r\n    public void setDisplayName(String256 displayName) {\r\n        this.displayName = displayName;\r\n    }\r\n\r\n    public String256 getCode() {\r\n        return code;\r\n    }\r\n\r\n    public void setCode(String256 code) {\r\n        this.code = code;\r\n    }\r\n\r\n    public CodingScheme getCodingScheme() {\r\n        return codingScheme;\r\n    }\r\n\r\n    public void setCodingScheme(CodingScheme codingScheme) {\r\n        this.codingScheme = codingScheme;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * CodedTerm. </br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the CodedTerm in XML format\r\n     * @see CodedTerm class CodedTerm\r\n     */\r\n    public String toXML() {\r\n        String answer;\r\n        answer = \"\\t\\t<codedterm>\\n\\t\\t\\t<displayname>\" + displayName + \"</displayname>\\n\\t\\t\\t<code>\" + code + \"</code>\\n\\t\\t\\t<codingscheme>\"\r\n                + codingScheme.toString() + \"</codingscheme>\\n\\t\\t</codedterm>\\n\";\r\n        return answer;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"CodedTerm{\" +\r\n                \"displayName=\" + displayName +\r\n                \", code=\" + code +\r\n                \", codingScheme=\" + codingScheme +\r\n                \'}\';\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s CodedTerm is\r\n     * correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see CodedTerm class CodedTerm\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        //  TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true; }\r\n        if (o == null || getClass() != o.getClass()){ return false;}\r\n\r\n        CodedTerm codedTerm = (CodedTerm) o;\r\n\r\n        if (!code.equals(codedTerm.code)){ return false;}\r\n        if (!codingScheme.equals(codedTerm.codingScheme)){ return false;}\r\n        if (!displayName.equals(codedTerm.displayName)){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = displayName != null ? displayName.hashCode() : 0;\r\n        result = 31 * result + (code != null ? code.hashCode() : 0);\r\n        result = 31 * result + (codingScheme != null ? codingScheme.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public CodedTerm copy() {\r\n        return new CodedTerm(this.code.toString(),this.displayName.toString(),this.codingScheme.toString());\r\n    }\r\n\r\n    public boolean isOneFieldEmpty() {\r\n        return getCode().toString().isEmpty() && getCodingScheme().toString() != null && getDisplayName().toString() != null;\r\n    }\r\n}\r\n'),(4591,5721,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.annotation.MatchesPattern;\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents a CodingScheme.</b>\r\n * </p>\r\n * <p>\r\n * A CodedTerm has the following parameter:\r\n * <ul>\r\n * <li>{@link #codingScheme codingScheme}: The CodingScheme itself (\r\n * {@link String256}) ;</li>\r\n * </li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toString method to return the author in String format and\r\n * verify method to check if syntax\'s CodingScheme is correct.\r\n * </p>\r\n *\r\n * <p>\r\n * This class also contains getters/setters.\r\n * </p>\r\n *\r\n * <p>\r\n * <b>See below the method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toString() method toString} <br>\r\n * </p>\r\n *\r\n *\r\n * @see CodedTerm class CodedTerm\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement </p>\r\n *\r\n *\r\n *\r\n *\r\n */\r\npublic class CodingScheme implements ModelElement, Serializable {\r\n\r\n	private static final long serialVersionUID = 8715185246676630319L;\r\n	/**\r\n	 * <b>String256 codingScheme</b> - The codingScheme [Mandatory].<br>\r\n	 * Type: {@link String256}</br> </p>\r\n	 *\r\n	 *\r\n	 * @see String256\r\n	 * @see CodingScheme\r\n	 * @see CodedTerm\r\n	 */\r\n	@NotNull\r\n    // TODO Check that RegExp\r\n    @MatchesPattern(value = \"urn:uuid:[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}\")\r\n	private String256 codingScheme;\r\n\r\n	public CodingScheme() {\r\n		codingScheme = new String256();\r\n	}\r\n\r\n\r\n    public CodingScheme(String256 codingScheme) {\r\n        if (codingScheme.toString().length() < 257) {\r\n            this.codingScheme = codingScheme;\r\n        } else {\r\n            this.codingScheme = new String256();\r\n        }\r\n    }\r\n\r\n    public String256 getCodingScheme() {\r\n        return codingScheme;\r\n    }\r\n\r\n	public CodingScheme setCodingScheme(String256 codingScheme) {\r\n		this.codingScheme = codingScheme;return this;\r\n	}\r\n\r\n	/**\r\n	 *\r\n	 * <p>\r\n	 * <b>Method toString</b> <br>\r\n	 * This method will be called to build a XML file by the {@link CodedTerm}\r\n     * (called itself by the {@link XdsDocumentEntry}) with the information taken\r\n     * from the local {@link CodingScheme}.<br>\r\n     * </p>\r\n	 *\r\n	 * @return String which contains the CodingScheme\r\n	 *\r\n	 * @see CodingScheme\r\n	 */\r\n	@Override\r\n	public String toString() {\r\n		return codingScheme.toString();\r\n	}\r\n\r\n	/**\r\n	 * <p>\r\n	 * <b>Method verify</b> <br>\r\n	 * This method will be called to check whether the syntax\'s\r\n	 * {@link CodingScheme} is correct </br>\r\n	 * </p>\r\n	 *\r\n	 * @return boolean true if the syntax is correct, else return false\r\n	 * @throws String256Exception\r\n	 *             if there is a String256 with more than 256 characters\r\n	 *\r\n	 * @see CodingScheme\r\n	 *\r\n	 */\r\n	@Override\r\n	public boolean verify() throws String256Exception {\r\n        return codingScheme.verify();\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o) return true;\r\n        if (!(o instanceof CodingScheme)) return false;\r\n\r\n        CodingScheme that = (CodingScheme) o;\r\n\r\n        if (!codingScheme.equals(that.codingScheme)) return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return codingScheme.hashCode();\r\n    }\r\n}\r\n'),(4592,5722,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport com.google.gwt.i18n.shared.DateTimeFormat;\r\n\r\nimport javax.annotation.MatchesPattern;\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.Date;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents a DTM (special format\'s date).</b>\r\n * </p>\r\n * <p>\r\n * A DTM has the following parameter:\r\n * <ul>\r\n * <li>{@link #dtm}: The date as a String256 ( {@link String256}) ;</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toString method to return the DTM in String format.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * This class also contains getters/setters.<br>\r\n * In addition, it has verify method to check its syntax.</br>\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toString() method toString} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement </p>\r\n */\r\npublic class DTM implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = -3711731576590925716L;\r\n    /**\r\n     * <b>DTM dtm</b> - The date as a String256 [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see DTM\r\n     * @see XdsDocumentEntry\r\n     */\r\n    @NotNull\r\n    @MatchesPattern(value = \"[0-9]{4}([0-p]{2}){4,}\")// FIXME check regexp pattern I don\'t get it on first sight\r\n    private Date dtm;\r\n\r\n    public DTM() {\r\n        dtm = new Date();\r\n    }\r\n\r\n    public DTM(Date date) {\r\n        dtm = date;\r\n    }\r\n\r\n    public Date getDtm() {\r\n        return dtm;\r\n    }\r\n\r\n    public DTM setDtm(Date dtm) {\r\n        this.dtm = dtm;\r\n        return this;\r\n    }\r\n\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toString</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link NameValueDTM} (called itself by the {@link XdsDocumentEntry}) with\r\n     * the information taken from the local {@link DTM}.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the DTM\r\n     * @see DTM class DTM\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        DateTimeFormat dtf = DateTimeFormat.getFormat(\"yyyyMMddHHmmss\");\r\n        return dtf.format(dtm);\r\n    }\r\n\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s {@link DTM} is\r\n     * correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see DTM class DTM\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        if (dtm.toString().length() < 13) {\r\n            if (dtm.toString().matches(\"[0-9]*\")) {\r\n                return true;\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n\r\n    public DTM copy() {\r\n        return new DTM(new Date(this.dtm.getTime()));\r\n    }\r\n}\r\n'),(4593,5723,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents an Identifier.</b>\r\n * </p>\r\n * <p>\r\n * An Identifier has the following parameters:\r\n * <ul>\r\n * <li>{@link #value}: The value of the identifier ({@link String256}) ;</li>\r\n * <li>{@link #idType}: The id type ({@link OID});</li>\r\n * </li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the Identifier in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement <\r\n */\r\npublic class IdentifierOID implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = 6909154820202656532L;\r\n\r\n    /**\r\n     * <b>String256 value</b> - The value of the identifier [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see OID\r\n     * @see IdentifierOID\r\n     */\r\n    @NotNull\r\n    private OID value;\r\n\r\n    /**\r\n     * <b>OID idType</b> - The type of the identifier [Mandatory].<br>\r\n     * Type: {@link OID}</br>\r\n     *\r\n     * @see IdentifierOID\r\n     */\r\n    @NotNull\r\n    private String256 idType;\r\n\r\n    public IdentifierOID(OID string256, String256 idOID) {\r\n        value = string256;\r\n        idType = idOID;\r\n    }\r\n\r\n    public IdentifierOID() {\r\n        value = new OID();\r\n        idType = new String256();\r\n    }\r\n\r\n    public OID getValue() {\r\n        return value;\r\n    }\r\n\r\n    public void setValue(OID value) {\r\n        this.value = value;\r\n    }\r\n\r\n    public String256 getIdType() {\r\n        return idType;\r\n    }\r\n\r\n    public void setIdType(String256 element) {\r\n        idType = element;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * Identifier.<br/>\r\n     * </p>\r\n     *\r\n     * @return String which contains the Identifier in XML format\r\n     * @see IdentifierOID\r\n     */\r\n    public String toXML() {\r\n        String answer = null;\r\n        answer = \"\\t\\t<identifier>\\n\\t\\t\\t<value>\" + value.toString() + \"</value>\\n\\t\\t\\t<idtype>\" + idType.toString()\r\n                + \"</idtype>\\n\\t\\t</identifier>\\n\";\r\n\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link IdentifierOID} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see IdentifierOID\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        // TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"IdentifierOID{\" +\r\n                \"value=\" + value +\r\n                \", idType=\" + idType +\r\n                \'}\';\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof IdentifierOID)){ return false;}\r\n\r\n        IdentifierOID that = (IdentifierOID) o;\r\n\r\n        if (idType != null ? !idType.equals(that.idType) : that.idType != null){ return false;}\r\n        if (value != null ? !value.equals(that.value) : that.value != null){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = value != null ? value.hashCode() : 0;\r\n        result = 31 * result + (idType != null ? idType.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public IdentifierOID copy() {\r\n        return new IdentifierOID(this.value.copy(),this.idType.copy());\r\n    }\r\n}\r\n'),(4594,5724,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents an Identifier.</b>\r\n * </p>\r\n * <p>\r\n * An Identifier has the following parameters:\r\n * <ul>\r\n * <li>{@link #value}: The value of the identifier ({@link String256}) ;</li>\r\n * <li>{@link #idType}: The id type ({@link String256});</li>\r\n * </li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the Identifier in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement <\r\n */\r\npublic class IdentifierString256 implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = -1717453248217705389L;\r\n\r\n    /**\r\n     * <p>\r\n     * <p/>\r\n     * <b>String256 value</b> - The value of the identifier [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     * </p>\r\n     *\r\n     * @see String256 class String256\r\n     * @see IdentifierString256\r\n     */\r\n    @NotNull\r\n    private String256 value;\r\n\r\n    /**\r\n     * <b>String256 idType</b> - The type of the identifier [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see IdentifierString256\r\n     */\r\n    @NotNull\r\n    private String256 idType;\r\n\r\n    public IdentifierString256(String256 valueId, String256 idTypeId) {\r\n        value = valueId;\r\n        idType = idTypeId;\r\n    }\r\n\r\n    public IdentifierString256() {\r\n        value = new String256();\r\n        idType = new String256();\r\n    }\r\n\r\n    public String256 getValue() {\r\n        return value;\r\n    }\r\n\r\n    public void setValue(String256 value) {\r\n        this.value = value;\r\n    }\r\n\r\n    public String256 getIdType() {\r\n        return idType;\r\n    }\r\n\r\n    public void setIdType(String256 element) {\r\n        idType = element;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * Identifier.<br/>\r\n     * </p>\r\n     *\r\n     * @return String which contains the Identifier in XML format\r\n     * @see IdentifierString256\r\n     */\r\n    public String toXML() {\r\n        String answer = null;\r\n        answer = \"\\t\\t<identifier>\\n\\t\\t\\t<value>\" + value.getString().replace(\"&\",\"&amp;\") + \"</value>\\n\\t\\t\\t<idtype>\" + idType.toString()\r\n                + \"</idtype>\\n\\t\\t</identifier>\\n\";\r\n\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link IdentifierString256} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see IdentifierString256\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        // TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"IdentifierString256{\" +\r\n                \"value=\" + value +\r\n                \", idType=\" + idType +\r\n                \'}\';\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o) return true;\r\n        if (!(o instanceof IdentifierString256)) return false;\r\n\r\n        IdentifierString256 that = (IdentifierString256) o;\r\n\r\n        if (idType != null ? !idType.equals(that.idType) : that.idType != null) return false;\r\n        if (value != null ? !value.equals(that.value) : that.value != null) return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = value != null ? value.hashCode() : 0;\r\n        result = 31 * result + (idType != null ? idType.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public IdentifierString256 copy() {\r\n        return new IdentifierString256(this.value.copy(),this.getIdType().copy());\r\n    }\r\n}\r\n'),(4595,5725,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.annotation.MatchesPattern;\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents an InternationalString. </b>\r\n * </p>\r\n * <p/>\r\n * <p/>\r\n * <p>\r\n * It contains a toXML method to return the InternationalString in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class InternationalString implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = -25172629647304781L;\r\n    /**\r\n     * <p>\r\n     * <p/>\r\n     * <b>LanguageCode langCode</b> - the language code of the\r\n     * InternationalString [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     * </p>\r\n     *\r\n     * @see LanguageCode\r\n     * @see InternationalString\r\n     */\r\n    @NotNull\r\n    @MatchesPattern(value = \"[a-z]{2}-[A-Z]{2}\")\r\n    LanguageCode langCode;\r\n\r\n    /**\r\n     * <b>String256</b> - the value of the InternationalString [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see String256 class String256\r\n     * @see InternationalString\r\n     */\r\n    @NotNull\r\n    String256 value;\r\n\r\n    public InternationalString() {\r\n        // langCode = new String256();\r\n        value = new String256();\r\n    }\r\n\r\n    public InternationalString(LanguageCode langCode, String256 value) {\r\n        this.langCode = langCode;\r\n        this.value = value;\r\n    }\r\n\r\n    public LanguageCode getLangCode() {\r\n        return langCode;\r\n    }\r\n\r\n    public void setLangCode(LanguageCode langCode) {\r\n        this.langCode = langCode;\r\n    }\r\n\r\n    public String256 getValue() {\r\n        return value;\r\n    }\r\n\r\n    public void setValue(String256 value) {\r\n        this.value = value;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * InternationalString.</br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the InternationalString in XML format\r\n     * @see InternationalString class InternationalString\r\n     */\r\n    public String toXML() {\r\n        String answer = \"\\t\\t<internationalstring>\\n\\t\\t\\t<language>\" + langCode.toString() + \"</language>\\n\\t\\t\\t<information>\" + value.toString()\r\n                + \"</information>\\n\\t\\t</internationalstring>\\n\";\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link InternationalString} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see InternationalString class InternationalString\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        return value.verify();\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof InternationalString)){ return false;}\r\n\r\n        InternationalString that = (InternationalString) o;\r\n\r\n        if (langCode != that.langCode){ return false;}\r\n        if (value != null ? !value.equals(that.value) : that.value != null){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = langCode != null ? langCode.hashCode() : 0;\r\n        result = 31 * result + (value != null ? value.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public InternationalString copy() {\r\n        return new InternationalString(this.langCode,this.value.copy());\r\n    }\r\n}\r\n'),(4596,5726,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\n/**\r\n * <b>Enumeration of language codes regarding RFC 3066 standard</b> <a\r\n * href=http://www.i18nguy.com/unicode/language-identifiers.html> See RFC 3066\r\n * standard</a>\r\n */\r\n\r\npublic enum LanguageCode {\r\n    CATALAN(\"ca\"), FRENCH_ANDORRA(\"fr-AD\"), ARABIC_UNITED_ARAB_EMIRATES(\"ar-AE\"), PERSIAN_AFGHANISTAN(\r\n            \"fa-AF\"), PUSHTO(\"ps\"), UIGHUR(\"ug\"), UZBEK_AFGHANISTAN(\"uz-AF\"), ENGLISH_ANTIGUA_AND_BARBUDA(\r\n            \"en-AG\"), ENGLISH_ANGUILLA(\"en-Al\"), ALBANIAN(\"sq\"), ARMENIAN(\"hy\"), DUTCH_ANTILLES(\r\n            \"nl-AN\"), KONGO(\"kg\"), KUANYAMA(\"kj\"), PORTUGUESE_ANGOLA(\"pt-AO\"), WELSH_ARGENTINA(\r\n            \"cy-AR\"), SPANISH_ARGENTINA(\"es-AR\"), GUARANI(\"gn\"), ENGLISH_AMERICAN_SAMOA(\r\n            \"en-AS\"), SAMOAN(\"sm\"), GERMAN_AUSTRIA(\"de-AT\"), HUNGARIAN(\"hu\"), ENGLISH_AUSTRALIA(\r\n            \"en-AU\"), YIDDISH(\"yi\"), DUTCH_ARUBA(\"nl-AW\"), SWEDISH_ALAND_ISLANDS(\r\n            \"sv-AX\"), AVARIC(\"av\"), AZERBAIJANI(\"az\"), AZERBAIJANI_ARABIC(\r\n            \"ar-Arab\"), AZERBAIJANI_CYRL(\"az-Cyrl\"), AZERBAIJANI_LATN(\"az-Latn\"), OSSETIAN(\r\n            \"os\"), BOSNIAN(\"bs\"), CROATIAN_BOSIA_AND_HERZEGOVINA(\"hr-BA\"), SERBIAN_BOSIA_AND_HERZEGOVINA(\r\n            \"sr-BA\"), ENGLISH_BARBADOS(\"en-BB\"), BENGALI_BENGLADAESH(\"bn-BD\"), GERMAN_BELGIUM(\r\n            \"de-BE\"), ENGLISH_BELGIUM(\"en-BE\"), FRENCH_BELGIUM(\"fr-BE\"), DUTCH_BELGIUM(\r\n            \"nl-BE\"), WALLON(\"wa\"), BAMBARA(\"bm\"), FRENCH_BURKINA_FASO(\"fr-BF\"), HAUSA(\r\n            \"ha\"), BULGARIAN(\"bg\"), CHURCH_SLAVIC(\"cu\"), TURKISH_BULGARIA(\r\n            \"tr-BG\"), ARABIC_BAHRAIN(\"ar-BH\"), FRENCH_BURUNDI(\"fr-BI\"), RUNDI(\r\n            \"rn\"), FRENCH_BENIN(\"fr-BJ\"), ENGLISH_BERMUDA(\"en-BM\"), ENGLISH_DRUNEI_DARUSSALAM(\r\n            \"en-DN\"), MALAY_DRUNEI_DARUSSALAM(\"ms-BN\"), AYMARA(\"ay\"), SPANISH_BOLIVIA(\r\n            \"es-BO\"), PORTUGUESE_BRAZIL(\"pt-BR\"), ENGLISH_BAHAMAS(\"en-BS\"), DZONGKHA(\r\n            \"dz\"), NEPALI(\"ne\"), ENGLISH_BOTSWANA(\"en-BW\"), SHONA(\"sn\"), TSWANA_BOTSWANGA(\r\n            \"tn-BW\"), BELARUSIAN(\"be\"), ENGLISH_BELIZE(\"en-BZ\"), CREE(\"cr\"), ENGLISH_CANADA(\r\n            \"en-CA\"), FRENCH_CANADA(\"fr-CA\"), INUKTIKUT(\"iu\"), OJIBWA(\"oj\"), MALAY_COCOS_ISLANDS(\r\n            \"ms-CC\"), FRENCH_DEMOCRATIC_REPUBLIC_CONGO(\"fr-CD\"), LINGALA_DEMOCRATIC_REPUBLIC_CONGO(\r\n            \"ln-CD\"), LUBA_KATANGA(\"lu\"), FRENCH_CENTRAL_AFRICAN_REPUBLIC(\r\n            \"fr-CF\"), SANGO(\"sg\"), FRENCH_CONGO(\"fr-CG\"), LINGALA_CONGO(\"ln-CG\"), GERMAN_SWITZERLAN(\r\n            \"de-CH\"), FRENCH_SWITZERLAND(\"fr-CH\"), ITALIAN_SWITZERLAND(\"it-CH\"), RAETO_ROMANCE(\r\n            \"rm\"), AKAN(\"ak\"), FRENCH_COTE_IVOIRE(\"fr-CI\"), ENGLISH_COOK_ISLANDS(\r\n            \"en-CK\"), SPANISH_CHILE(\"es-CL\"), ENGLISH_CAMEROON(\"en-CM\"), FRENCH_CAMEROON(\r\n            \"fr-CM\"), TIBETAN(\"bo\"), HAKKA(\"i-hak\"), SICHUAN_YI(\"ii\"), ZHUANG(\r\n            \"za\"), CHINESE(\"zh-CN\"), CHINESE_GAN(\"zh-gan\"), CHINESE_GUOYU(\r\n            \"zh-guoyu\"), CHINESE_HAKKA(\"zh-hakka\"), CHINESE_HANS(\"zh-Hans\"), CHINESE_HANT(\r\n            \"zh-Hant\"), CHINESE_WUU(\"zh-wuu\"), CHINESE_XIANG(\"zh-xiang\"), CHINESE_YUE(\r\n            \"zh-yue\"), SPANISH_COLOMBIA(\"es-CO\"), SPANISH_COSTA_RICA(\"es-CR\"), SERBIAN(\r\n            \"sr\"), SERBIAN_CYRL(\"sr-Cyrl\"), SERBIAN_LATN(\"sr-Latn\"), SPANISH_CUBA(\r\n            \"es-CU\"), PORTUGUESE_CAPE_VERDE(\"pt-CV\"), GREEK_CYPRUS(\"el-CY\"), TURKISH_CYPRUS(\r\n            \"tr-CY\"), CZECH(\"cs\"), DANISH_GERMANY(\"da-DE\"), GERMAN(\"de-DE\"), LOWER_SORBIAN(\r\n            \"dsb\"), FRISIAN_GERMANY(\"fy-DE\"), UPPER_SORBIAN(\"hsb\"), LUXEMBOURGISH(\r\n            \"lb\"), LOW_GERMAN(\"nds\"), SORBIAN(\"wen\"), AFAR_DJIBOUTI(\"aa-DJ\"), FRENCH_DJIBOUTI(\r\n            \"fr-DJ\"), SOMALI_DJIBOUTI(\"so-DJ\"), DANISH(\"da-DK\"), GERMAN_DENMARK(\r\n            \"de-DK\"), ENGLISH_DOMINICA(\"en-DM\"), SPANISH_DOMONICAN_REPUBLIC(\r\n            \"es-DO\"), ARABIC_ALGERIA(\"ar-DZ\"), SPANISH_ECUADOR(\"es-EC\"), ESTONIAN(\r\n            \"et\"), ARABIC_EGYPT(\"ar-EG\"), AFAR_ERITREA(\"aa-ER\"), BLIN(\"byn\"), ENGLISH_ERITREA(\r\n            \"en-ER\"), GEEZ_ERITREA(\"gez-ER\"), TIGRINYA_ERITREA(\"ti-ER\"), TIGRE(\r\n            \"tig\"), ARAGONESE(\"an\"), SPANISH(\"es-ES\"), BASQUE(\"eu\"), GALICIAN(\r\n            \"gl\"), AFAR_ETHIPIA(\"aa-ET\"), AMHARIC(\"am\"), ENGLISH_ETHIOPIA(\r\n            \"en-ET\"), GEEZ_ETHIPIA(\"gez-ET\"), OROMO_ETHIOPIA(\"om-ET\"), SIDAMO(\r\n            \"sid\"), SOMALI_ETHIOPIA(\"so-ET\"), TIGRINYA_ETHIOPIA(\"ti-ET\"), WALAMO(\r\n            \"wal\"), FINNISH(\"fi-FI\"), INARI_SAMI(\"smn\"), SWEDISH_FINLAND(\r\n            \"sv-FI\"), ENGLISH_FIJI(\"en-FJ\"), FIJAN(\"fj\"), ENGLISH_FALKLAND_ISLANDS(\r\n            \"en-FK\"), ENGLISH_MICRONESIA(\"en-FM\"), DANISH_FAROE_ISLANDS(\"da-FO\"), FAROESE(\r\n            \"fo\"), BRETON(\"br\"), CORSICAN(\"co\"), GERMAN_FRANCE(\"de-FR\"), FRENCH_FRANCE(\r\n            \"fr-FR\"), OCCITAN(\"oc\"), FRENCH_GABON(\"fr-GA\"), WELSH_UNITED_KINGDOM(\r\n            \"cy-GB\"), ENGLISH(\"en-GB\"), FRENCH_UNITED_KINGDOM(\"fr-GB\"), IRISH_UNITED_KINGDOM(\r\n            \"ga-GB\"), GAELIC(\"gd\"), MANX(\"gv\"), CORNISH(\"kw\"), ENGLISH_GRENADA(\r\n            \"en-GD\"), ABKHAZIAN(\"ab\"), GEORGIAN(\"ka\"), FRENCH_GUIANA(\"fr-GF\"), EWE(\r\n            \"ee\"), ENGLISH_GHANA(\"en-GH\"), TWI(\"tw\"), ENGLISH_GIBRALTAR(\"en-GI\"), DANISH_GREENLAND(\r\n            \"de-GL\"), KALAALLISUT(\"kl\"), ENGLISH_GAMBIA(\"en-GM\"), WOLOF(\"wf\"), FRENCH_GUINEA(\r\n            \"fr-GN\"), FRENCH_GUADELOUPE(\"fr-GP\"), SPANISH_EQUTORIAL_GUINEA(\r\n            \"es-GQ\"), GREEK(\"el-GR\"), SPANISH_GUATEMALA(\"es-GT\"), CHAMORRO(\r\n            \"ch-GU\"), ENGLISH_GUAM(\"en-GU\"), PORTUGUESE_GUINEA_BISSAU(\"pt-GW\"), ENGLISH_GUYANA(\r\n            \"en-GY\"), ENGLISH_HONG_KONG(\"en-HK\"), CHINESE_HANT_HONG_KONG(\r\n            \"zh-Hant-HK\"), CHINESE_HONG_KONG(\"zh-HK\"), SPANISH_HONDURAS(\"es-HN\"), CROATIAN(\r\n            \"hr-HR\"), ITALIAN_CROTIA(\"it-HR\"), FRENCH_HAITI(\"fr-HT\"), HAITIAN(\r\n            \"ht\"), GERMAN_HUNGARY(\"de-HU\"), HUNGARIAN_HUNGARY(\"hu-HU\"), SLOVAK_HUNGARY(\r\n            \"sk-HU\"), SERBIAN_HUNGARY(\"sr-HU\"), INDONESIAN(\"id\"), JAVANESE(\"jv\"), SUNDANESE(\r\n            \"su\"), ENGLISH_IRELAND(\"en-IE\"), IRISH(\"ga-IE\"), ARABIC_ISRAEL(\r\n            \"ar-IL\"), ENGLISH_ISRAEL(\"en-IL\"), HEBREW(\"he\"), ARABIC_INDIA(\r\n            \"ar-IN\"), ASSAMESE(\"as\"), BIHARI(\"bh\"), BENGALI_INDIA(\"bn-IN\"), ENGLISH_INDIA(\r\n            \"en-IN\"), GUJARATI(\"gu\"), HINDI(\"hi\"), KANNADA(\"kn\"), KONKANI(\"kok\"), KASHMIRI(\r\n            \"ks\"), MALAYALAM(\"ml\"), MARATHI(\"mr\"), ORIYA(\"or\"), PANJABI(\"pa\"), PALI(\r\n            \"pi\"), SANSKRIT(\"sa\"), SINDHI_INDIA(\"sd-IN\"), TAMIL_INDIA(\"ta-IN\"), TELUGU(\r\n            \"te\"), URDU_INDIA(\"ur-IN\"), ENGLISH_INDIAN_OCEAN_TERRITORY(\"en-IO\"), ARABIC_IRAQ(\r\n            \"ar-IQ\"), KURDISH(\"ku\"), AVESTAN(\"ae\"), PERSIAN_IRAN(\"fa-IR\"), ICELANDIC(\r\n            \"is\"), GERMAN_ITALY(\"de-IT\"), FRENCH_ITALY(\"fr-IT\"), ITALIAN_ITALY(\r\n            \"it-IT\"), SARDINIAN(\"sc\"), ENGLIH_JAMAICA(\"en-JM\"), ARABIC_JORDAN(\r\n            \"ar-JO\"), JAPANESE(\"ja\"), ENGLISH_KENYA(\"en-KE\"), KIKUYU(\"ki\"), OROMO_KENYA(\r\n            \"om-KE\"), SOMALI_KENYA(\"so-KE\"), SWAHILI_KENYA(\"sw-KE\"), KIRGHIZ(\r\n            \"ky\"), KHMER(\"km\"), ENGLISH_KIRIBATI(\"en-KI\"), FRENCH_COMOROS(\r\n            \"fr-KM\"), ENGLISH_SAINT_KITTS_AND_NEVIS(\"en-KN\"), KOREAN_SOUTH(\r\n            \"ko-KP\"), KOREAN_NORTH(\"ko-KR\"), ARABIC_KUWAIT(\"ar-KW\"), ENGLISH_CAYMAN_ISLANDS(\r\n            \"en-KY\"), KAZAKH(\"kk\"), LAO(\"lo\"), ARABIC_LEBANON(\"ar-LB\"), FRENCH_LEBANON(\r\n            \"fr-LB\"), ENGLISH_SAINT_LUCIA(\"en-LC\"), GERMAN_LIECHTENSTEIN(\r\n            \"de-LI\"), SINHALA(\"si\"), ENGLISH_LIBERIA(\"en-LR\"), ENGLISH_LESOTO(\r\n            \"en-LS\"), SOUTHER_SOTP(\"st\"), XHOSA(\"xh\"), LITHUANIAN(\"lt\"), GERMAN_LUXEMBOURG(\r\n            \"de-LU\"), FRENCH_LUXEMBOURG(\"fr-LU\"), LATVIAN(\"lv\"), ARABIC_LIBYAN(\r\n            \"ar-LY\"), ARABIC_MOROCCO(\"ar-MA\"), FRENCH_MONACO(\"fr-MC\"), MOLDAVIAN(\r\n            \"mo\"), ROMANIAN(\"ro\"), TURKISH(\"tr\"), UKRAINIAN(\"uk\"), FRENCH_MADAGASCAR(\r\n            \"fr-MG\"), MALAGASY(\"mg\"), ENGLISH_MARSHALL_ISLANDS(\"en-MH\"), MARSHALLESE(\r\n            \"mh\"), MACEDONIAN(\"mk\"), FRENCH_MALI(\"fr-ML\"), BURMESE(\"my\"), MONGOLIAN(\r\n            \"mn\"), CHINESE_MACAO(\"zh-MO\"), CHAMORRO_NORTHERN_MARIANA_ISLANDS(\r\n            \"ch-MP\"), ENGLISH_NORTHERN_MARIANA_ISLANDS(\"en-MP\"), FRENCH_MARTINIQUE(\r\n            \"fr-MQ\"), ARABIC_MAURITANIA(\"ar-MR\"), ENGLISH_MONTSERRAT(\"en-MS\"), ENGLISH_MALTA(\r\n            \"en-MT\"), MALTESE(\"mt\"), ENGLISH_MAURITUS(\"en-MU\"), DIVEHI(\"dv\"), ENGLISH_MALAWI(\r\n            \"en-MW\"), CHICHEWA(\"ny\"), SPANISH_MEXICO(\"es-MX\"), MALAY(\"ms-MY\"), PORTUGUESE_MOZAMBIQUE(\r\n            \"pt-MZ\"), ENGLISH_NAMIBIA(\"en-NA\"), HERERO(\"hz\"), NDONGA(\"ng\"), FRENCH_NEW_CALEDONIA(\r\n            \"fr-NC\"), FULAK_NIGER(\"ff-NE\"), FRENCH_NIGER(\"ff-NG\"), KANURI(\"kr\"), YORUBA(\r\n            \"yo\"), SPANISH_NICARAGUA(\"es-NI\"), FRISIAN_NETHERLANDS(\"fy-NL\"), LIMBURGAN(\r\n            \"li\"), DUTCH(\"nl-NL\"), BOKMAL(\"nb\"), NYNORSK(\"nn\"), NORWEGIAN(\"no\"), ENGLISH_NAURU(\r\n            \"en-NR\"), NAURU(\"na\"), ENGLISH_NIUE(\"en-NU\"), ENGLISH_NEW_ZEALAND(\r\n            \"en-NZ\"), MAORI(\"mi\"), ARABIC_OMAN(\"ar-OM\"), SPANISH_PANAMA(\"es-PA\"), SPANISH_PERU(\r\n            \"es-PE\"), QUECHUA(\"qu\"), FRENCH_POLYNESIA(\"fr-PF\"), TAHITIAN(\"ty\"), ENGLISH_PAPUA_NEW_GUINEA(\r\n            \"en-PG\"), HORI_MOTU(\"ho\"), ENGLISH_PHILIPPINES(\"en-PH\"), TAGALOG(\r\n            \"tl\"), NGLISH_PAKISTAN(\"en-PK\"), SINDHI_PAKISTAN(\"sd-PK\"), URDU_PAKISTAN(\r\n            \"ur-PK\"), GERMAND_POLAND(\"de-PL\"), POLISH(\"pl\"), FRENCH_SAINT_PIERRE_AND_MIQUELON(\r\n            \"fr-PM\"), ENGLISH_PITCAIRN(\"en-PN\"), ENGLISH_PUERTO_RICO(\"en-PR\"), SPANISH_PUERTO_RICO(\r\n            \"es-PR\"), ARABIC_PALESTINIAN_TERRITORY(\"ar-PS\"), PORTUGUESE(\"pt-PT\"), ENGLISH_PALAU(\r\n            \"en-PW\"), SPANISH_PARAGUAY(\"es-PY\"), ARABIC_QATAR(\"ar-QA\"), FRENCH_REUNION(\r\n            \"fr-RE\"), BASHKIR(\"ba\"), CHECHEN(\"ce\"), CHUVASH(\"cv\"), KOMI(\"kv\"), RUSSIAN(\r\n            \"ru-RU\"), TATAR(\"tt\"), ENGLISH_RWANDA(\"en-RW\"), FRENCH_RWANDA(\r\n            \"fr-RW\"), KINYARWANDA(\"rw\"), ARABIC_SAUDI_ARABIA(\"ar-SA\"), ENGLISH_SOLOMON_ISLANDS(\r\n            \"en-SB\"), ENGLISH_SEYCHELLES(\"en-SC\"), FRENCH_SEYCHELELS(\"fr-SC\"), ARABIC_SUDAN(\r\n            \"ar-SD\"), DINKA(\"din\"), FINNISH_SWEDEN(\"fi-SE\"), NORTHERN_SAMI(\"se\"), S_SAMI(\r\n            \"sma\"), N_SAMI(\"sme\"), SWEDISH(\"sv-SE\"), BENGALI_SINGAPORE(\"bn-SG\"), ENGLISH_SINGAPORE(\r\n            \"en-SG\"), MALAY_SINGAPORE(\"ms-SG\"), TAMIL_SINGAPORE(\"ta-SG\"), CHINESE_HANS_SINGAPORE(\r\n            \"zh-Hans-SG\"), CHINESE_SINGAPORE(\"zh-SG\"), ENGLISH_SAINT_HELENA(\r\n            \"en-SH\"), HUNGARIAN_SLOVENIA(\"hu-SI\"), ITALIAN_SLOVENIA(\"it-SI\"), SLOVAK(\r\n            \"sk\"), ENGLISH_SIERRA_LEONE(\"en-SL\"), ITALIAN_SAN_MARINO(\"it-SM\"), FULAH_SENEGAL(\r\n            \"ff-SN\"), ARABIC_SOMALIA(\"ar-SO\"), ENGLISH_SOMALIA(\"en-SO\"), SOMALI(\r\n            \"so-SO\"), DUTCH_SURINAME(\"nl-SR\"), PORUTGUESE_SAO_TOME_AND_PRINCIPE(\r\n            \"pt-ST\"), SPANISH_SALVADOR(\"es-SV\"), ARABIC_SYRIA(\"ar-SY\"), SYRIAC(\r\n            \"syr\"), ENGLISH_SWAZILAND(\"en-SZ\"), SWATI_SWAZILAND(\"ss-SZ\"), ENGLISH_TURKS_AND_CAICOS_ISLANDS(\r\n            \"en-TC\"), ARABIC_CHAD(\"ar-TD\"), FRENCH_CHAD(\"fr-TD\"), FRENCH_TOGO(\r\n            \"fr-TG\"), THAI(\"th\"), TAJIK(\"tj\"), ENGLISH_TOKELAU(\"en-TK\"), TURKMEN(\r\n            \"tk\"), ARABIC_TUNISIA(\"ar-TN\"), ENGLISH_TONGA(\"en-TO\"), TONGAN(\"to\"), TURKISH_TURKEY(\r\n            \"tr-TR\"), ENGLISH_TRINIDAD_AND_TOBAGO(\"en-TT\"), GILBERTESE(\"gil\"), TUVALU(\r\n            \"tvl\"), CHINESE_TAIWAN(\"zh-TW\"), SWAHILI_TANZANIA(\"sw-TZ\"), RUSSIAN_UKRAINE(\r\n            \"ru-UA\"), ENGLISH_UGANDA(\"en-UG\"), GANDA(\"lg\"), ENGLISH_UNITED_STATES_MINOR_OUTLYING_ISLANDS(\r\n            \"en-UM\"), ENGLISH_UNITED_STATES(\"en-US\"), SPANISH_UNITED_STATES(\r\n            \"es-US\"), HAWAIIAN(\"haw\"), INUPIAQ(\"ik\"), NAVAJO(\"nv\"), SPANISH_URUGUAY(\r\n            \"es-UY\"), UZBEK_CYRL(\"uz-Cyrl\"), UZBEK_LATN(\"uz-Latn\"), UZBEK(\r\n            \"uz-UZ\"), FRENCH(\"fr\"), ITALIAN(\"it\"), LATIN(\"la\"), ENGLISH_SAINT_VINCENT_AND_THE_GRENADINES(\r\n            \"en-VC\"), SPANISH_VENEZUELA(\"es-VE\"), ENGLISH_VIRGIN_ISLANDS(\r\n            \"en-VI\"), VIETNAMESE(\"vi\"), BISLAMA(\"bi\"), ENGLISH_VANUATU(\"en-VU\"), FRENCH_VANUATU(\r\n            \"fr-VU\"), FRENCH_WALLIS_AND_FUTUNA(\"fr-WF\"), ENGLISH_SAMOA(\"en-WS\"), ARABIC_YEMEN(\r\n            \"ar-YE\"), FRENCH_MAYOTTE(\"fr-YT\"), AFRIKAANS(\"af\"), ENGLISH_SOUTH_AFRICA(\r\n            \"en-ZA\"), S_NDEBELE(\"nr\"), SWATI_SOUTH_AFRICA(\"ss-ZA\"), TSWANA_SOUTH_AFRICA(\r\n            \"tn-ZA\"), TSONGA(\"ts\"), VENDA(\"ve\"), ZULU(\"zu\"), ENGLISH_ZIMBABWE(\r\n            \"en-ZW\"), N_NDEBELE(\"nd\");\r\n\r\n	/**\r\n	 * RFC 3066 code for this language.\r\n	 */\r\n	private final String rfcCode;\r\n\r\n	private LanguageCode(String rfcCode) {\r\n		this.rfcCode = rfcCode;\r\n	}\r\n\r\n	private LanguageCode() {\r\n		rfcCode = this.name();\r\n	}\r\n\r\n    public static LanguageCode getValueOf(String languageCode) {\r\n        for (LanguageCode l : LanguageCode.values()) {\r\n            if (l.toString().toLowerCase().equals(languageCode.toLowerCase())) {\r\n                return l;\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return this.rfcCode;\r\n    }\r\n}\r\n'),(4597,5727,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\n/**\r\n * <p>\r\n * This class is an interface for each element from the model.\r\n * </p>\r\n * <p>\r\n *\r\n * <p>\r\n * A ModelElement contains ... TODO\r\n *\r\n *\r\n */\r\npublic interface ModelElement {\r\n	public boolean verify() throws String256Exception;\r\n}\r\n'),(4598,5728,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport org.hibernate.validator.constraints.NotEmpty;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents a NameValue.</b><br>\r\n * A NameValue depends on a type T which is implemented during the instantiation\r\n * </p>\r\n * <p>\r\n * An NameValue has the following parameters:\r\n * <ul>\r\n * <li>{@link #name}: The name of the NameValue ({@link String256}) ;</li>\r\n * <li>{@link #values}: A list of values (ArrayList of DTM) ;</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the NameValue in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class NameValueDTM implements ModelElement, Serializable {\r\n    private static final long serialVersionUID = 384235409232722676L;\r\n\r\n    /**\r\n     * <b>String256 name</b> - The name of the NameValue [Mandatory].<br>\r\n     * Type: {@link String256}</br> </p>\r\n     *\r\n     * @see String256 class String256\r\n     * @see NameValueDTM\r\n     */\r\n    @NotNull\r\n    private String256 name;\r\n\r\n    /**\r\n     * <b>ArrayList(DTM)</b> - A list of values [Mandatory].<br>\r\n     * Type: ArrayList of {@link DTM}\r\n     *\r\n     * @see NameValueDTM\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<DTM> values;\r\n\r\n    public NameValueDTM() {\r\n        name = new String256();\r\n        values = new ArrayList<DTM>();\r\n        values.add(new DTM());\r\n    }\r\n\r\n    public List<DTM> getValues() {\r\n        return values;\r\n    }\r\n\r\n    public void setValues(List<DTM> values) {\r\n        this.values = values;\r\n    }\r\n\r\n    public String256 getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String256 name) {\r\n        this.name = name;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * {@link NameValueDTM}.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the NameValue in XML format\r\n     * @see NameValueDTM class NameValue\r\n     */\r\n    public String toXML() {\r\n        String answer = \"\\t\\t<namevalue>\\n\\t\\t\\t<name>\" + name.toString() + \"</name>\\n\\t\\t\\t<values>\\n\";\r\n        for (DTM str : values) {\r\n            answer = answer + \"\\t\\t\\t\\t<value>\" + str.toString() + \"</value>\\n\";\r\n        }\r\n        answer = answer + \"\\t\\t\\t</values>\\n\\t\\t</namevalue>\\n\";\r\n\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link NameValueDTM} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see NameValueDTM\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        // TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof NameValueDTM)){ return false;}\r\n\r\n        NameValueDTM that = (NameValueDTM) o;\r\n        if (name != null ? !name.equals(that.name) : that.name != null){ return false;}\r\n        if (values != null && values.size() == that.getValues().size()) {\r\n            for (int i = 0; i < values.size(); i++) {\r\n                if (!values.get(i).getDtm().equals(that.getValues().get(i).getDtm())) {\r\n                    return false;\r\n                }\r\n            }\r\n        } else\r\n            return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = name != null ? name.hashCode() : 0;\r\n        result = 31 * result + (values != null ? values.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"NameValueDTM{\" +\r\n                \"name=\" + name +\r\n                \", values=\" + values +\r\n                \'}\';\r\n    }\r\n\r\n    public NameValueDTM copy() {\r\n        NameValueDTM cp = new NameValueDTM();\r\n        cp.setName(this.name.copy());\r\n        for(DTM vcp : this.values) {\r\n            cp.getValues().set(0,vcp.copy());\r\n        }\r\n        return cp;\r\n    }\r\n}\r\n'),(4599,5729,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport org.hibernate.validator.constraints.NotEmpty;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents a NameValue.</b><br>\r\n * A NameValue depends on a type T which is implemented during the instantiation\r\n * </p>\r\n * <p>\r\n * An NameValue has the following parameters:\r\n * <ul>\r\n * <li>{@link #name}: The name of the NameValue ({@link String256}) ;</li>\r\n * <li>{@link #values}: A list of values (ArrayList of Integer) ;</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the NameValue in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry\r\n * @see ModelElement\r\n */\r\npublic class NameValueInteger implements ModelElement, Serializable {\r\n    private static final long serialVersionUID = -8454362856443516728L;\r\n\r\n    /**\r\n     * <b>String256 name</b> - The name of the NameValue [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see String256\r\n     * @see NameValueInteger\r\n     */\r\n    @NotNull\r\n    private String256 name;\r\n\r\n    /**\r\n     * <b>ArrayList(Integer) values</b> - A list of values [Mandatory].<br>\r\n     * Type: ArrayList of {@link Integer}\r\n     *\r\n     * @see NameValueInteger\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<Integer> values;\r\n\r\n    public NameValueInteger() {\r\n        name = new String256();\r\n        values = new ArrayList<Integer>();\r\n        values.add(0);\r\n    }\r\n\r\n    public List<Integer> getValues() {\r\n        return values;\r\n    }\r\n\r\n    public void setValues(List<Integer> values) {\r\n        this.values = values;\r\n    }\r\n\r\n    public String256 getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String256 name) {\r\n        this.name = name;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * {@link NameValueInteger}.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the NameValue in XML format\r\n     * @see NameValueInteger\r\n     */\r\n    public String toXML() {\r\n        String answer = \"\\t\\t<namevalue>\\n\\t\\t\\t<name>\" + name.toString() + \"</name>\\n\\t\\t\\t<values>\\n\";\r\n        for (Integer str : values) {\r\n            answer = answer + \"\\t\\t\\t\\t<value>\" + str.toString() + \"</value>\\n\";\r\n        }\r\n        answer = answer + \"\\t\\t\\t</values>\\n\\t\\t</namevalue>\\n\";\r\n\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link NameValueInteger} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see NameValueInteger\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        return name.verify();\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"NameValueInteger{\" +\r\n                \"name=\" + name +\r\n                \", values=\" + values +\r\n                \'}\';\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof NameValueInteger)){ return false;}\r\n\r\n        NameValueInteger that = (NameValueInteger) o;\r\n\r\n        if (name != null ? !name.equals(that.name) : that.name != null){ return false;}\r\n        if (values != null ? !values.equals(that.values) : that.values != null){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = name != null ? name.hashCode() : 0;\r\n        result = 31 * result + (values != null ? values.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    public NameValueInteger copy() {\r\n        NameValueInteger cp = new NameValueInteger();\r\n        cp.setName(this.name.copy());\r\n        for (Integer i:this.values){\r\n            cp.getValues().set(0,new Integer(i));\r\n        }\r\n        return cp;\r\n    }\r\n}\r\n'),(4600,5730,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport org.hibernate.validator.constraints.NotEmpty;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents a NameValueString256.</b><br>\r\n * A NameValueString256 depends on a type T which is implemented during the\r\n * instantiation\r\n * </p>\r\n * <p>\r\n * An NameValueString256 has the following parameters:\r\n * <ul>\r\n * <li>{@link #name}: The name of the NameValueString256 ({@link String256}) ;</li>\r\n * <li>{@link #values}: A list of values (ArrayList of T) ;</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains a toXML method to return the NameValueString256 in XML format.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\r\n * </p>\r\n *\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class NameValueString256 implements ModelElement, Serializable {\r\n    private static final long serialVersionUID = -6036404246643751647L;\r\n\r\n    /**\r\n     * <b>String256 name</b> - The name of the NameValueString256 [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see String256 class String256\r\n     * @see NameValueString256\r\n     */\r\n    @NotNull\r\n    private String256 name;\r\n\r\n    /**\r\n     * <b>ArrayList(String256)</b> - A list of values [Mandatory].<br>\r\n     * Type: ArrayList of T</br> T could be {@link Integer} or {@link String256}\r\n     * or {@link DTM}\r\n     *\r\n     * @see NameValueString256\r\n     */\r\n    @NotNull\r\n    @NotEmpty\r\n    private List<String256> values = new ArrayList<String256>();\r\n\r\n    public NameValueString256() {\r\n        name = new String256();\r\n        values = new ArrayList<String256>();\r\n    }\r\n\r\n    public List<String256> getValues() {\r\n        return values;\r\n    }\r\n\r\n    public void setValues(List<String256> values) {\r\n        this.values = values;\r\n    }\r\n\r\n    public String256 getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String256 name) {\r\n        this.name = name;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b> <br>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * {@link NameValueString256}.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the NameValueString256 in XML format\r\n     * @see NameValueString256 class NameValueString256\r\n     */\r\n    public String toXML() {\r\n        String answer = \"\\t\\t<namevalue>\\n\\t\\t\\t<name>\" + name.toString() + \"</name>\\n\\t\\t\\t<values>\\n\";\r\n        for (String256 str : values) {\r\n            answer = answer + \"\\t\\t\\t\\t<value>\" + str.toString().replace(\"&\",\"&amp;\") + \"</value>\\n\";\r\n        }\r\n        answer = answer + \"\\t\\t\\t</values>\\n\\t\\t</namevalue>\\n\";\r\n\r\n        return answer;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b> <br>\r\n     * This method will be called to check whether the syntax\'s\r\n     * {@link NameValueString256} is correct </br>\r\n     * </p>\r\n     *\r\n     * @return boolean true if the syntax is correct, else return false\r\n     * @throws String256Exception if there is a String256 with more than 256 characters\r\n     * @see NameValueString256 class NameValueString256\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        // TODO\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o) return true;\r\n        if (!(o instanceof NameValueString256)) return false;\r\n\r\n        NameValueString256 that = (NameValueString256) o;\r\n\r\n        if (name != null ? !name.equals(that.name) : that.name != null) return false;\r\n        if (values != null && values.size() == that.getValues().size()) {\r\n            for (int i = 0; i < values.size(); i++) {\r\n                if (!values.get(i).equals(that.getValues().get(i))) {\r\n                    return false;\r\n                }\r\n            }\r\n        } else return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        int result = name != null ? name.hashCode() : 0;\r\n        result = 31 * result + (values != null ? values.hashCode() : 0);\r\n        return result;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"NameValueString256{\" +\r\n                \"name=\" + name +\r\n                \", values=\" + values +\r\n                \'}\';\r\n    }\r\n\r\n    public NameValueString256 copy() {\r\n        NameValueString256 cp = new NameValueString256();\r\n        cp.setName(this.getName().copy());\r\n        for (String256 s : this.values){\r\n            cp.getValues().add(s.copy());\r\n        }\r\n        return cp;\r\n    }\r\n}\r\n'),(4601,5731,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.annotation.MatchesPattern;\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b> This class represents an OID.</b>\r\n * </p>\r\n * <p>\r\n * An OID has the following parameter:\r\n * <ul>\r\n * <li>{@link #oid}: The oid ({@link String256}).</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * <p/>\r\n * It contains toString() method to return the OID.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toString() method toString} <br>\r\n * </p>\r\n *\r\n * @see String256 class String256\r\n * @see String256Exception class String256Exception\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class OID implements ModelElement, Serializable {\r\n\r\n    private static final long serialVersionUID = -7932949245243225415L;\r\n    /**\r\n     * <b>OID oid</b> - The oid [Mandatory].<br>\r\n     * Type: {@link String256}</br>\r\n     *\r\n     * @see String256 class String256\r\n     * @see OID class OID\r\n     */\r\n    @NotNull\r\n    @MatchesPattern(value = \"[0-9](\\\\.[0-9]+)*(\\\\^[0-9]+)?\")\r\n    private String256 oid;\r\n\r\n    public OID() {\r\n        oid = new String256();\r\n    }\r\n\r\n    public OID(String256 oid) {\r\n        this.oid = oid;\r\n    }\r\n\r\n    public String256 getOid() {\r\n        return oid;\r\n    }\r\n\r\n    public OID setOid(String256 oid) {\r\n        this.oid = oid;\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b><br>\r\n     * This method verify if the String respects the {@link OID} syntax given by\r\n     * the regular expression below\r\n     * </p>\r\n     *\r\n     * @return boolean: true if it\'s an OID else false\r\n     * @throws String256Exception if the String is larger than 256 characters\r\n     * @see String256Exception class String256Exception\r\n     * @see OID class OID\r\n     */\r\n    @Override\r\n    public boolean verify() throws String256Exception {\r\n        if (oid.verify()) {\r\n            if (oid.toString().matches(\"[0-9](\\\\.[0-9]+)*(\\\\^[0-9]+)?\")) {\r\n                return true;\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toXML</b></br>\r\n     * <p/>\r\n     * This method will be called to build a XML file by the\r\n     * {@link XdsDocumentEntry} with the information taken from the local\r\n     * {@link OID}.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the OID\r\n     * @see OID class OID\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return oid.toString();\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof OID)){ return false;}\r\n\r\n        OID oid1 = (OID) o;\r\n\r\n        if (oid != null ? !oid.equals(oid1.oid) : oid1.oid != null){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return oid.hashCode();\r\n    }\r\n\r\n    public OID copy() {\r\n        return new OID(this.oid.copy());\r\n    }\r\n}\r\n'),(4602,5732,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport javax.validation.constraints.Size;\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents a String256</b> <br>\r\n * A string256 is a String which contains less than 256 characters.</br>\r\n * </p>\r\n * <p>\r\n * An string256 has the following parameter:\r\n * <ul>\r\n * <li>{@link #string}: A String256;</li>\r\n * </ul>\r\n * </p>\r\n * <p>\r\n * It contains toString method to return the String256.<br>\r\n * This class also contains getters/setters.</br> In addition, it has verify\r\n * method to check its syntax.\r\n * </p>\r\n * <p/>\r\n * <p>\r\n * <b>See below each method mentioned above.</b> <br>\r\n * {@link #verify() method verify}</br> {@link #toString() method toString} <br>\r\n * </p>\r\n *\r\n * @see String256Exception class String256Exception\r\n * @see XdsDocumentEntry class DocumentModel\r\n * @see ModelElement class ModelElement\r\n */\r\npublic class String256 implements Serializable {\r\n\r\n    private static final long serialVersionUID = 4537891086390463367L;\r\n\r\n    // @Max(value = 2)\r\n    /**\r\n     * <b>String256 string<b/> - The string [Mandatory].<br>\r\n     * Type: String256</br>\r\n     *\r\n     * @see String256 class String256\r\n     */\r\n    @NotNull\r\n    @Size(max = 256)\r\n    private String string = new String();\r\n\r\n    public String256() {\r\n    }\r\n\r\n    public String256(String string) {\r\n        if (string.length() < 257) {\r\n            this.string = string;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method verify</b></br> This method verify if the String contains less\r\n     * than 256 characters.\r\n     * </p>\r\n     *\r\n     * @return boolean: true if it\'s a String256 else false\r\n     * @throws String256Exception if the String is larger than 256 characters\r\n     * @see String256Exception class String256Exception\r\n     * @see String256 class String256\r\n     */\r\n    public boolean verify() throws String256Exception {\r\n        if (string.length() > 256) {\r\n            throw new String256Exception();\r\n        } else {\r\n            return true;\r\n        }\r\n    }\r\n\r\n    public String getString() {\r\n        return string;\r\n    }\r\n\r\n    public String256 setString(String string) {\r\n        this.string = string;\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * <p>\r\n     * <b>Method toString</b> <br>\r\n     * This method will be called to build a XML file by the DocumentModel with\r\n     * the information taken from the local String256.<br>\r\n     * </p>\r\n     *\r\n     * @return String which contains the String256\r\n     * @see String256 class String256\r\n     */\r\n    @Override\r\n    public String toString() {\r\n        return string;\r\n    }\r\n\r\n    @Override\r\n    public boolean equals(Object o) {\r\n        if (this == o){ return true;}\r\n        if (!(o instanceof String256)){ return false;}\r\n\r\n        String256 string256 = (String256) o;\r\n\r\n        if (!string.equals(string256.string)){ return false;}\r\n\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public int hashCode() {\r\n        return string.hashCode();\r\n    }\r\n\r\n    public String256 copy() {\r\n       return new String256(new String(this.string));\r\n    }\r\n}\r\n'),(4603,5733,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\n/**\r\n * <p>\r\n * <b>This class represents a String256Exception</b> <br>\r\n * It throws when a String256 has more than 256 characters.</br>\r\n * </p>\r\n *\r\n * @see String256 class String256\r\n * @see XdsDocumentEntry class DocumentModel\r\n */\r\n@SuppressWarnings(\"serial\")\r\npublic class String256Exception extends Exception {\r\n\r\n    public String256Exception() {\r\n        super(\"This String shouldn\'t be larger than 256 characters.\\nCheck your xml document!\");\r\n    }\r\n}\r\n'),(4604,5734,'package gov.nist.hit.ds.docentryeditor.shared.model;\n\nimport org.hibernate.validator.constraints.NotEmpty;\n\nimport javax.annotation.Nullable;\nimport javax.validation.constraints.NotNull;\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * <b>This class represents the model which have to be respected by the xml\n * document</b>\n * <p/>\n * <p>\n * An XML document should have this different parameters\n * <ul>\n * <li>{@link #titles}: A title (ArrayList({@link InternationalString})) ;</li>\n * <li>{@link #comments}: Comments (ArrayList({@link InternationalString})) ;</li>\n * <li>{@link #authors}: One or several author(s) (ArrayList({@link Author})) ;</li>\n * <li>{@link #classCode}: A class code ({@link CodedTerm}) ;</li>\n * <li>{@link #confidentialityCodes}: A confidentiality code (ArrayList(\n * {@link CodedTerm})) ;</li>\n * <li>{@link #creationTime}: A creation time ({@link NameValueDTM}) ;</li>\n * <li>{@link #id}: An id ({@link String256}) ;</li>\n * <li>{@link #eventCode}: An event code (ArrayList({@link CodedTerm})) ;</li>\n * <li>{@link #formatCode}: A format code ({@link CodedTerm}) ;</li>\n * <li>{@link #hash}: An hash ({@link String256}) ;</li>\n * <li>{@link #healthcareFacilityType}: An health care facility type(\n * {@link CodedTerm}) ;</li>\n * <li>{@link #languageCode}: A language code {@link LanguageCode}) ;</li>\n * <li>{@link #legalAuthenticator}: A legal authenticator (\n * {@link NameValueString256}) ;</li>\n * <li>{@link #mimeType}: A mime type ({@link String256}) ;</li>\n * <li>{@link #patientID}: A patient id ({@link IdentifierString256}) ;</li>\n * <li>{@link #practiceSettingCode}: A practice setting code ({@link CodedTerm}\n * ) ;</li>\n * <li>{@link #repoUId}: A repository unique id ({@link String256}) ;</li>\n * <li>{@link #serviceStartTime}: A service start time ({@link NameValueDTM}) ;</li>\n * <li>{@link #serviceStopTime}: A service stop time ({@link NameValueDTM}) ;</li>\n * <li>{@link #size}: A size ({@link NameValueInteger}) ;</li>\n * <li>{@link #sourcePatientId}: A source patient id ({@link NameValueString256}\n * ) ;</li>\n * <li>{@link #typeCode}: A type code ({@link CodedTerm}) ;</li>\n * <li>{@link #uniqueId}: A unique id ({@link IdentifierOID}) ;</li>\n * <li>{@link #uri}: An uri ({@link String256}).</li>\n * </ul>\n * </p>\n * <p/>\n * <p>\n * This class also contains getters/setters, toXml() method to return\n * information in XML format and verify method to check syntax\'s document.\n * </p>\n * <p/>\n * <p/>\n * <p>\n * <b> See below each type of element you can find in this model</b><br>\n * {@link Author}</br> {@link CodedTerm} <br>\n * {@link IdentifierOID}</br> {@link IdentifierString256}<br>\n * {@link InternationalString} </br> {@link NameValueString256}<br>\n * {@link NameValueDTM}</br>{@link NameValueInteger}<br>\n * {@link String256} </br> {@link OID}<br>\n * {@link DTM}\n * </p>\n * <p/>\n * <p>\n * <b>See below each method mentioned above.</b> <br>\n * {@link #verify() method verify}</br> {@link #toXML() method toXML} <br>\n * </p>\n *\n * @see ModelElement class ModelElement\n */\npublic class XdsDocumentEntry implements XdsModelElement,Serializable {\n    private static final long serialVersionUID = 1L;\n    /**\n     * <b>ArrayList(ArrayList(String)) validationErrors</b> - The error(s) which\n     * occure(s) when verify() method is called.<br>\n     * Type: ArrayList<ArrayList<String>></br> </p>\n     * <p/>\n     * <p>\n     * This array represents ((\"document_variable_name\", errorMessage)\n     * </p>\n     *\n     * @see XdsDocumentEntry class DocumentModel\n     */\n    private ArrayList<ArrayList<String>> validationErrors = new ArrayList<ArrayList<String>>();\n    /**\n     * <b>ArrayList(Author) authors</b> - The author(s) of the document\n     * [Optional].<br>\n     * Type: ArrayList of {@link Author}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..n </p>\n     *\n     * @see Author\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private List<Author> authors;\n    /**\n     * <b>CodedTerm classCode</b> - The class code of the document [Mandatory].<br>\n     * Type: {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private CodedTerm classCode;\n    /**\n     * <b>ArrayList(InternationalString) comments</b> - The comments of the\n     * document [Optional].<br>\n     * Type: ArrayList of {@link InternationalString}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see InternationalString\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private List<InternationalString> comments;\n    /**\n     * <b>CodedTerm confidentialityCode</b> - The confidentiality code of the\n     * document [Mandatory].<br>\n     * Type: ArrayList of {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..n </p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    @NotEmpty\n    // FIXME should not be a list\n    private List<CodedTerm> confidentialityCodes;\n    /**\n     * <b>NameValueDTM creationTime</b> - The creation time of the document\n     * [Mandatory].<br>\n     * Type: {@link NameValueDTM}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see NameValueDTM\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private NameValueDTM creationTime;\n    /**\n     * <b>ArrayList(CodedTerm) eventCode</b> - The event code of the document\n     * [Optional].<br>\n     * Type: {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..n </p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private List<CodedTerm> eventCode;\n    /**\n     * <b>String256 fileName</b> - The name of the metadata file which will be generated.\n     * [Mandatory]<br/>\n     * <p/>\n     * <b>Cardinality:</b><br/>\n     * 1..1\n     */\n    @NotNull\n    @NotEmpty\n    private String256 fileName;\n    /**\n     * <b>CodedTerm formatCode</b> - The format code of the document\n     * [Mandatory].<br>\n     * Type: {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private CodedTerm formatCode;\n    /**\n     * <b>String256 hash</b> - The hash of the document [Optional].<br>\n     * Type: {@link String256}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see String256\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private String256 hash;\n    /**\n     * <b>CodedTerm healthcareFacilityType</b> - The health care facility type\n     * of the document [Mandatory].<br>\n     * Type: {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..n </p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    @NotEmpty\n    private CodedTerm healthcareFacilityType;\n    /**\n     * <b>String256 id</b> - The id of the document [Mandatory].<br>\n     * Type: {@link String256}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see String256\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private String256 id;\n    /**\n     * <b>LanguageCode languageCode</b> - The language code of the document\n     * [Mandatory].<br>\n     * Type: {@link LanguageCode}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see LanguageCode\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private LanguageCode languageCode;\n    /**\n     * <b>NameValueString256 legalAuthenticator</b> - The legal authenticator of\n     * the document [Optional].<br>\n     * Type: {@link NameValueString256}</br> </p>\n     * <p/>\n     * Represents a participant who has legally authenticated or attested the\n     * document within the authorInstitution. Legal authentication implies that\n     * a document has been signed manually or electronically by the\n     * legalAuthenticator. This attribute may be absent if not applicable. If\n     * present, shall have a single value\n     * <p/>\n     * <pre>\n     *     {@code\n     *     <rim:Slot name=\"legalAuthenticator\">\n     *            <rim:ValueList>\n     *               <rim:Value>^Welby^Marcus^^^Dr^MD</rim:Value>\n     *            </rim:ValueList>\n     *     </rim:Slot>\n     *     }\n     * </pre>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see NameValueString256\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueString256 legalAuthenticator;\n    /**\n     * <b>String256 mimeType</b> - The MIME Type of the document in the repository [Mandatory].<br>\n     * Type: {@link String256}</br> </p>\n     * <p/>\n     * <pre>\n     *     {@code\n     *        <rim:ExtrinsicObject mimeType=\"application/pdf\"\n     *              id=\"theDocument\"\n     *              objectType=\"urn:uuid:7edca82f-054d-47f2-a032-9b2a5b5186c1\">\n     *     }\n     * </pre>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1 </p>\n     *\n     * @see String256\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private String256 mimeType;\n    /**\n     * <b>IdentifierString256 patientID</b> - The patient id of the document\n     * [Mandatory].<br>\n     * Type: {@link IdentifierString256}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1\n     *\n     * @see IdentifierString256\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private IdentifierString256 patientID;\n    /**\n     * <b>CodedTerm practiceSettingCode</b> - The practice setting code of the\n     * document [Mandatory].<br>\n     * Type: {@link CodedTerm}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private CodedTerm practiceSettingCode;\n    /**\n     * <b>OID repositoryUId</b> - The repository unique id of the document\n     * [Optional].<br>\n     * Type: {@link String256}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see OID\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private OID repoUId;\n    /**\n     * <b>NameValueDTM serviceStartTime</b> - The service start time of the\n     * document [Optional].<br>\n     * Type: {@link NameValueDTM}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1\n     *\n     * @see NameValueDTM\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueDTM serviceStartTime;\n    /**\n     * <b>NameValueDTM serviceStopTime</b> - The service stop time of the\n     * document [Optional].<br>\n     * Type: {@link NameValueDTM}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see NameValueDTM\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueDTM serviceStopTime;\n    /**\n     * <b>NameValueInteger size</b> - The size of the document [Optional].<br>\n     * Type: {@link NameValueInteger}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see NameValueInteger\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueInteger size;\n    /**\n     * <b>NameValueString256 sourcePatientId</b> - The source patient id of the\n     * document [Optional].<br>\n     * <p/>\n     * Type: {@link NameValueString256}</br></p>\n     * <p/>\n     * <b>Cardinality:</b> 0..1</p>\n     *\n     * @see NameValueString256\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueString256 sourcePatientId;\n    /**\n     * <b>NameValueString256 sourcePatientInfo</b> - The source patient info of the\n     * document [Optional].<br>\n     * <br/>\n     * This attribute should contain demographics information of the patient to\n     * whose medical record this document belongs, as the Document Source knew it at the time of submission.\n     * <br/>\n     * This information typically includes: the patient first and last name, sex,\n     * and birth date. The Clinical XDS Affinity Domain policies may require\n     * more or less specific information and format.\n     * This patient information is not intended to be updated once the\n     * Document is registered (just as the Document content and metadata itself\n     * will not be updated without replacing the previous document). As\n     * sourcePatientInfo may have been updated by the source actor, it may no\n     * longer be in use within the Document Source (EHR-CR). It is only\n     * intended as an audit/checking mechanism and has occasional use for\n     * Document Consumer actors. Shall have a single value (only a single\n     * sourcePatientInfo slot may be present).\n     * <br/>\n     * <p/>\n     * XML Representation:\n     * <pre>\n     *     {@code\n     *     <rim:Slot name=\"sourcePatientInfo\">\n     *               <rim:ValueList>\n     *                   <rim:Value>PID-3|DTP-1^^^&amp;1.3.6.1.4.1.21367.2005.3.7&amp;ISO</rim:Value>\n     *                   <rim:Value>PID-5|DICTAPHONE^ONE^^^</rim:Value>\n     *                   <rim:Value>PID-7|19650120</rim:Value>\n     *                   <rim:Value>PID-8|M</rim:Value>\n     *                   <rim:Value>PID-11|100 MainSt^^BURLINGTON^MA^01803^USA</rim:Value>\n     *               </rim:ValueList>\n     *     </rim:Slot>\n     *     }\n     * </pre>\n     * <p/>\n     * PID-3 should include the source patient identifier.\n     * PID-5 should include the patient name.\n     * PID-8 should code the patient gender as\n     * M – Male F – Female\n     * O – OtherU – Unknown\n     * PID-7 should include the patient date of birth.\n     * PID-11 should include the patient address.\n     * PID-2, PID-4, PID-12 and PID-19 should not be used.\n     * <p/>\n     * <p/>\n     * Type: {@link NameValueString256}</br></p>\n     * <p/>\n     * <b>Cardinality:</b> 0..1</p>\n     *\n     * @see NameValueString256\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private NameValueString256 sourcePatientInfo;\n    /**\n     * <b>ArrayList(InternationalString title</b> - The title of the document\n     * [Optional].<br>\n     * Type: ArrayList of {@link InternationalString}</br> </p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1 </p>\n     *\n     * @see InternationalString\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    // FIXME Are you sure this is meant to be a list?\n    private List<InternationalString> titles;\n    /**\n     * <b>CodedTerm typeCode</b> - The type code of the document [Mandatory].<br>\n     * Type: {@link CodedTerm}</br></p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1</p>\n     *\n     * @see CodedTerm\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private CodedTerm typeCode;\n    /**\n     * <b> IdentifierOID uniqueId</b> - The unique id of the document\n     * [Mandatory].<br>\n     * Type: {@link IdentifierOID}</br></p>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 1..1</p>\n     *\n     * @see IdentifierOID\n     * @see XdsDocumentEntry\n     */\n    @NotNull\n    private IdentifierOID uniqueId;\n    /**\n     * <b>String256 uri</b> - The uri of the document [Optional].<br>\n     * Type: {@link String256}</br></p>\n     * <p/>\n     * For XDM the URI element shall point to the file containing the\n     * document.\n     * If present, shall have a single value.\n     * There are two formats for coding this attribute. If the string representing\n     * the URI is 128 characters or shorter, the short format may be used:\n     * <pre>\n     *     {@code\n     *      <rim:Slot name=\"URI\">\n     *          <rim:ValueList>\n     *              <rim:Value>http://www.ihe.net</rim:Value>\n     *          </rim:ValueList>\n     *      </rim:Slot>\n     *      }\n     * </pre>\n     * <p/>\n     * If the string is more than 128 characters long, the long format shall be\n     * used:\n     * <pre>\n     *     {@code\n     *     <rim:Slot name=\"URI\">\n     *          <rim:ValueList>\n     *              <rim:Value>1|http://www.ihe.net/IHERetrieveDocument?</rim:Value>\n     *              <rim:Value>2|requestType=DOCUMENT&documentUID=1.2.3</rim:Value>\n     *              <rim:Value>3|&preferredContentType=application%2fpdf</rim:Value>\n     *          </rim:ValueList>\n     *     </rim:Slot>\n     *     }\n     * </pre>\n     * <p/>\n     * Each Value is composed of an ordering prefix followed by a portion of\n     * the actual URI string. The ordering prefix shall be sequential starting at\n     * the value 1. When the long format is used, all Values shall have an\n     * ordering prefix.\n     * Each value is ordered by its ordering prefix:\n     * ordering-prefix :== digit vertical-bar\n     * digit :== ‘1’ | ‘2’ | ‘3’ | ‘4’ | ‘5’ | ‘6’ | ‘7’ | ‘8’ | ‘9’\n     * vertical-bar :== ‘|’\n     * The long version may be used for URIs of less than 129 characters. This\n     * profile does not specify how a URI is to be broken up into pieces. The\n     * following example is valid.\n     * <pre>\n     *     {@code\n     *      <rim:Slot name=\"URI\">\n     *          <rim:ValueList>\n     *              <rim:Value>1|http://www.ihe.net</rim:Value>\n     *          </rim:ValueList>\n     *      </rim:Slot>\n     *     }\n     * </pre>\n     * <p/>\n     * <b>Cardinality:</b><br>\n     * 0..1</p>\n     *\n     * @see String256\n     * @see XdsDocumentEntry\n     */\n    @Nullable\n    private String256 uri;\n\n    // TODO Use a map for validation purpose (Map<String,(String|XdsError)>\n    private Map<String, String> errorsMap = new HashMap<String, String>();\n    private String256 logicalId;\n    private String256 version;\n    private String256 availabilityStatus;\n    private String256 homeCommunityId;\n\n    public XdsDocumentEntry() {\n        languageCode=LanguageCode.ENGLISH_UNITED_STATES;\n        classCode = new CodedTerm();\n        creationTime = new NameValueDTM();\n        creationTime.setName(new String256().setString(\"creationTime\"));\n        id = new String256();\n        fileName = new String256();\n        formatCode = new CodedTerm();\n        hash = new String256();\n        healthcareFacilityType = new CodedTerm();\n        // languageCode = new String256();\n        legalAuthenticator = new NameValueString256();\n        legalAuthenticator.setName(new String256()\n                .setString(\"legalAuthenticator\"));\n        mimeType = new String256();\n        patientID = new IdentifierString256();\n        patientID.setIdType(new String256().setString(\"urn:uuid:6b5aeala-874d-4603-a4bc-96a0a7b38446\"));\n        practiceSettingCode = new CodedTerm();\n        repoUId = new OID();\n        serviceStartTime = new NameValueDTM();\n        serviceStartTime.setName(new String256().setString(\"serviceStartTime\"));\n        serviceStopTime = new NameValueDTM();\n        serviceStopTime.setName(new String256().setString(\"serviceStopTime\"));\n        size = new NameValueInteger();\n        size.setName(new String256().setString(\"size\"));\n        sourcePatientId = new NameValueString256();\n        sourcePatientId.setName(new String256().setString(\"sourcePatientId\"));\n        sourcePatientInfo = new NameValueString256();\n        sourcePatientInfo.setName(new String256().setString(\"sourcePatientInfo\"));\n        typeCode = new CodedTerm();\n        uniqueId = new IdentifierOID();\n        uniqueId.setIdType(new String256().setString(\"urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab\"));\n        uri = new String256();\n\n        titles = new ArrayList<InternationalString>();\n        comments = new ArrayList<InternationalString>();\n        authors = new ArrayList<Author>();\n        confidentialityCodes = new ArrayList<CodedTerm>();\n        eventCode = new ArrayList<CodedTerm>();\n    }\n\n    public String256 getAvailabilityStatus() {\n        return availabilityStatus;\n    }\n\n    public void setAvailabilityStatus(String256 availabilityStatus) {\n        this.availabilityStatus = availabilityStatus;\n    }\n\n    public List<InternationalString> getTitles() {\n        return titles;\n    }\n\n    public void setTitles(List<InternationalString> titles) {\n        this.titles = titles;\n    }\n\n    public List<InternationalString> getComments() {\n        return comments;\n    }\n\n    public void setComments(List<InternationalString> comments) {\n        this.comments = comments;\n    }\n\n    public List<Author> getAuthors() {\n        return authors;\n    }\n\n    public void setAuthors(List<Author> authors) {\n        this.authors = authors;\n    }\n\n    public CodedTerm getClassCode() {\n        return classCode;\n    }\n\n    public void setClassCode(CodedTerm classCode) {\n        this.classCode = classCode;\n    }\n\n    public List<CodedTerm> getConfidentialityCodes() {\n        return confidentialityCodes;\n    }\n\n    public void setConfidentialityCodes(List<CodedTerm> confidentialityCodes) {\n        this.confidentialityCodes = confidentialityCodes;\n    }\n\n    public NameValueDTM getCreationTime() {\n        return creationTime;\n    }\n\n    public void setCreationTime(NameValueDTM creationTime) {\n        this.creationTime = creationTime;\n    }\n\n    public String256 getId() {\n        return id;\n    }\n\n    public void setId(String256 id) {\n        this.id = id;\n    }\n\n    public List<CodedTerm> getEventCode() {\n        return eventCode;\n    }\n\n    public void setEventCode(List<CodedTerm> eventCode) {\n        this.eventCode = eventCode;\n    }\n\n    public CodedTerm getFormatCode() {\n        return formatCode;\n    }\n\n    public void setFormatCode(CodedTerm formatCode) {\n        this.formatCode = formatCode;\n    }\n\n    public String256 getHash() {\n        return hash;\n    }\n\n    public void setHash(String256 hash) {\n        this.hash = hash;\n    }\n\n    public CodedTerm getHealthcareFacilityType() {\n        return healthcareFacilityType;\n    }\n\n    public void setHealthcareFacilityType(CodedTerm healthcareFacilityType) {\n        this.healthcareFacilityType = healthcareFacilityType;\n    }\n\n    public LanguageCode getLanguageCode() {\n        return languageCode;\n    }\n\n    public void setLanguageCode(LanguageCode languageCode) {\n        this.languageCode = languageCode;\n    }\n\n    public NameValueString256 getLegalAuthenticator() {\n        return legalAuthenticator;\n    }\n\n    public void setLegalAuthenticator(NameValueString256 legalAuthenticator) {\n        this.legalAuthenticator = legalAuthenticator;\n    }\n\n    public String256 getFileName() {\n        return fileName;\n    }\n\n    public void setFileName(String256 fileName) {\n        this.fileName = fileName;\n    }\n\n    public String256 getHomeCommunityId(){\n        return homeCommunityId;\n    }\n\n    public void setHomeCommunityId(String256 homeCommunityId) {\n        this.homeCommunityId = homeCommunityId;\n    }\n\n    public String256 getLogicalId(){\n        return logicalId;\n    }\n\n    public void setLogicalId(String256 logicalId) {\n        this.logicalId = logicalId;\n    }\n\n    public String256 getMimeType() {\n        return mimeType;\n    }\n\n    public void setMimeType(String256 mimeType) {\n        this.mimeType = mimeType;\n    }\n\n    public IdentifierString256 getPatientID() {\n        return patientID;\n    }\n\n    public void setPatientID(IdentifierString256 patientID) {\n        this.patientID = patientID;\n    }\n\n    public CodedTerm getPracticeSettingCode() {\n        return practiceSettingCode;\n    }\n\n    public void setPracticeSettingCode(CodedTerm practiceSettingCode) {\n        this.practiceSettingCode = practiceSettingCode;\n    }\n\n    public OID getRepoUId() {\n        return repoUId;\n    }\n\n    public void setRepoUId(OID repoUId) {\n        this.repoUId = repoUId;\n    }\n\n    public NameValueDTM getServiceStartTime() {\n        return serviceStartTime;\n    }\n\n    public void setServiceStartTime(NameValueDTM serviceStartTime) {\n        this.serviceStartTime = serviceStartTime;\n    }\n\n    public NameValueDTM getServiceStopTime() {\n        return serviceStopTime;\n    }\n\n    public void setServiceStopTime(NameValueDTM serviceStopTime) {\n        this.serviceStopTime = serviceStopTime;\n    }\n\n    public NameValueInteger getSize() {\n        return size;\n    }\n\n    public void setSize(NameValueInteger size) {\n        this.size = size;\n    }\n\n    public NameValueString256 getSourcePatientId() {\n        return sourcePatientId;\n    }\n\n    public void setSourcePatientId(NameValueString256 sourcePatientId) {\n        this.sourcePatientId = sourcePatientId;\n    }\n\n    public NameValueString256 getSourcePatientInfo() {\n        return sourcePatientInfo;\n    }\n\n    public void setSourcePatientInfo(NameValueString256 sourcePatientInfo) {\n        this.sourcePatientInfo = sourcePatientInfo;\n    }\n\n    public CodedTerm getTypeCode() {\n        return typeCode;\n    }\n\n    public void setTypeCode(CodedTerm typeCode) {\n        this.typeCode = typeCode;\n    }\n\n    public IdentifierOID getUniqueId() {\n        return uniqueId;\n    }\n\n    public void setUniqueId(IdentifierOID uniqueId) {\n        this.uniqueId = uniqueId;\n    }\n\n    public String256 getUri() {\n        return uri;\n    }\n\n    public void setUri(String256 uri) {\n        this.uri = uri;\n    }\n\n    public String256 getVersion(){\n        return version;\n    }\n\n    public void setVersion(String256 version) {\n        this.version = version;\n    }\n\n    public XdsDocumentEntry copy(){\n        XdsDocumentEntry doc=new XdsDocumentEntry();\n        doc.setId(this.id!=null ? this.id.copy() : null);\n        doc.setHomeCommunityId(this.homeCommunityId!=null ? this.homeCommunityId.copy():null);\n        doc.setUri(this.uri.copy());\n        for (Author cp : this.authors) {\n            doc.getAuthors().add(cp.copy());\n        }\n        doc.setAvailabilityStatus(this.availabilityStatus!=null ? this.availabilityStatus.copy():null);\n        doc.setClassCode(this.classCode.copy());\n        for (InternationalString cp : this.comments) {\n            doc.getComments().add(cp.copy());\n        }\n        for (CodedTerm cp : this.confidentialityCodes) {\n            doc.getConfidentialityCodes().add(cp.copy());\n        }\n        doc.setCreationTime(this.creationTime.copy());\n        for (CodedTerm cp : this.eventCode){\n            doc.getEventCode().add(cp.copy());\n        }\n        doc.setFileName(new String256(this.fileName.getString()));\n        doc.setFormatCode(this.formatCode.copy());\n        doc.setHash(this.hash.copy());\n        doc.setHealthcareFacilityType(this.healthcareFacilityType.copy());\n        doc.setLanguageCode(this.languageCode);\n        doc.setLegalAuthenticator(this.legalAuthenticator.copy());\n        doc.setLogicalId(this.logicalId!=null?this.logicalId.copy():null);\n        doc.setMimeType(this.mimeType.copy());\n        doc.setPatientID(this.patientID.copy());\n        doc.setPracticeSettingCode(this.practiceSettingCode.copy());\n        doc.setRepoUId(this.repoUId.copy());\n        doc.setServiceStartTime(this.serviceStartTime.copy());\n        doc.setServiceStopTime(this.serviceStopTime.copy());\n        doc.setSize(this.size.copy());\n        doc.setSourcePatientId(this.sourcePatientId.copy());\n        doc.setSourcePatientInfo(this.sourcePatientInfo.copy());\n        doc.setTypeCode(this.typeCode.copy());\n        for (InternationalString cp:this.titles) {\n            doc.getTitles().add(cp.copy());\n        }\n        doc.setUniqueId(this.uniqueId.copy());\n        doc.setVersion(this.version!=null?this.version.copy():null);\n        return doc;\n    }\n\n    /**\n     * <p>\n     * <b>Method verify</b> <br>\n     * This method will be called to check syntax\'s document<br>\n     * It uses methods verify() from each model class</br>\n     * </p>\n     *\n     * @return boolean true if all the document is available, else return false\n     * @see XdsDocumentEntry\n     * @see #validationErrors\n     */\n    @Override\n    public boolean verify()  {\n        // TODO\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"XdsDocumentEntry[\" +\n                \"authors={\" + authors +\n                \"}, classCode=\" + classCode +\n                \", comments={\" + comments +\n                \"}, confidentialityCodes={\" + confidentialityCodes +\n                \"}, creationTime=\" + creationTime +\n                \", eventCode={\" + eventCode +\n                \"}, fileName=\" + fileName +\n                \", formatCode=\" + formatCode +\n                \", hash=\" + hash +\n                \", healthcareFacilityType=\" + healthcareFacilityType +\n                \", id=\" + id +\n                \", languageCode=\" + languageCode +\n                \", legalAuthenticator=\" + legalAuthenticator +\n                \", mimeType=\" + mimeType +\n                \", patientID=\" + patientID +\n                \", practiceSettingCode=\" + practiceSettingCode +\n                \", repoUId=\" + repoUId +\n                \", serviceStartTime=\" + serviceStartTime +\n                \", serviceStopTime=\" + serviceStopTime +\n                \", size=\" + size +\n                \", sourcePatientId=\" + sourcePatientId +\n                \", sourcePatientInfo={\" + sourcePatientInfo +\n                \"}, titles={\" + titles +\n                \"}, typeCode=\" + typeCode +\n                \", uniqueId=\" + uniqueId +\n                \", uri=\" + uri +\n                \", logicalId=\" + logicalId +\n                \", version=\" + version +\n                \", availabilityStatus=\" + availabilityStatus +\n                \", homeCommunityId=\" + homeCommunityId +\n                \']\';\n    }\n\n}\n'),(4605,5735,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * Class made to gather all information of a Metadata document\r\n * (Submission set, Document entries, Associations and Folders).\r\n *\r\n * @See XdsSubmissionSet\r\n * @See XdsDocumentEntry\r\n * Created by onh2 on 2/19/2015.\r\n */\r\npublic class XdsMetadata implements Serializable{\r\n    private static final long serialVersionUID = 1L;\r\n\r\n    private XdsSubmissionSet submissionSet;\r\n    private List<XdsDocumentEntry> documentEntries;\r\n\r\n    public XdsMetadata(){\r\n        documentEntries=new ArrayList<XdsDocumentEntry>();\r\n    }\r\n\r\n    public XdsSubmissionSet getSubmissionSet() {\r\n        return submissionSet;\r\n    }\r\n\r\n    public void setSubmissionSet(XdsSubmissionSet submissionSet) {\r\n        this.submissionSet = submissionSet;\r\n    }\r\n\r\n    public List<XdsDocumentEntry> getDocumentEntries(){return documentEntries;}\r\n\r\n    public void setDocumentEntries(List<XdsDocumentEntry> documentEntries){this.documentEntries=documentEntries;}\r\n}\r\n'),(4606,5736,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\n/**\r\n * Created by onh2 on 3/9/2015.\r\n */\r\npublic interface XdsModelElement {\r\n    public String toString();\r\n    public boolean verify();\r\n    public XdsModelElement copy();\r\n}\r\n'),(4607,5737,'package gov.nist.hit.ds.docentryeditor.shared.model;\r\n\r\nimport javax.validation.constraints.NotNull;\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * The SubmissionSet represents a collection of Folders, Documents and Associations\r\n * submitted together.\r\n *\r\n * Created by onh2 on 2/24/2015.\r\n */\r\npublic class XdsSubmissionSet  implements XdsModelElement,Serializable {\r\n    /**\r\n     * The humans and/or machines that created the submission set.\r\n     * This attribute contains the subattributes:\r\n     *      authorInstitution, authorPerson,\r\n     *      authorRole, authorSpecialty,\r\n     *      authorTelecommunication.\r\n     * [Required if known R2] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    private List<Author> authors;\r\n\r\n    /**\r\n     * The lifecycle status of the SubmissionSet.\r\n     * [Optional] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    // TODO replace by a enum\r\n    private String256 availabilityStatus;\r\n\r\n    /**\r\n     * Comments associated with the SubmissionSet.\r\n     * [Optional] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    private List<InternationalString> comments;\r\n\r\n    /**\r\n     * The code specifying the type of clinical activity\r\n     * that resulted in placing the documents in this SubmissionSet.\r\n     * [Required R] in XDS (DS and DR) and in XDS DS.\r\n     * [Required if known R2] in XDM MC and XDR MS.\r\n     */\r\n    private CodedTerm contentTypeCode;\r\n\r\n    /**\r\n     * A globally unique identifier used to identify the SubmissionSet.\r\n     * [Required R] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    @NotNull\r\n    private String256 entryUUID;\r\n\r\n    /**\r\n     * A globally unique identifier for a community.\r\n     * [Optional] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    // FIXME Possibly an OID, IdentifierOID...?\r\n    private String256 homeCommunityId;\r\n\r\n    /**\r\n     * The organization(s) or person(s) for whom the SubmissionSet is intended.\r\n     * [Optional] in XDS (DS and DR).\r\n     * [Required if known R2] in XDM MC, XDR DS and XDR MS.\r\n     */\r\n    private NameValueString256 intendedRecipient;\r\n\r\n    /**\r\n     * The patientId represents the subject of care\r\n     * whose longitudinal record is being reflected in this SubmissionSet.\r\n     * [Required R] in XDS (DS and DR) and in XDS DS.\r\n     * [Required if known R2] in XDM MC and XDR MS.\r\n     */\r\n    private IdentifierString256 patientId;\r\n\r\n    /**\r\n     * OID identifying the instance of the creating entity\r\n     * that contributed the SubmissionSet.\r\n     * [Required R] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    @NotNull\r\n    private IdentifierOID sourceId;\r\n\r\n    /**\r\n     * Point in time at the creating entity when the SubmissionSet was created.\r\n     * [Required R] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    @NotNull\r\n    private NameValueDTM submissionTime;\r\n\r\n    /**\r\n     * The title of the SubmissionSet.\r\n     * [Optional] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    // FIXME List or not?\r\n    private List<InternationalString> title;\r\n\r\n    /**\r\n     * A globally unique identifier for the SubmissionSet\r\n     * assigned by the creating entity.\r\n     * [Required R] regardless the standard (XDS DS, XDS DR, XDM MC, XDR DS, XDR MS).\r\n     */\r\n    @NotNull\r\n    private IdentifierOID uniqueId;\r\n\r\n    /**\r\n     * Default constructor.\r\n     */\r\n    public XdsSubmissionSet(){\r\n        authors=new ArrayList<Author>();\r\n        availabilityStatus=new String256();\r\n        comments=new ArrayList<InternationalString>();\r\n        contentTypeCode=new CodedTerm();\r\n        entryUUID=new String256();\r\n        homeCommunityId=new String256();\r\n        intendedRecipient=new NameValueString256();\r\n        intendedRecipient.setName(new String256(\"intendedRecipient\"));\r\n        patientId=new IdentifierString256();\r\n        sourceId=new IdentifierOID();\r\n        submissionTime=new NameValueDTM();\r\n        title=new ArrayList<InternationalString>();\r\n        uniqueId=new IdentifierOID();\r\n    }\r\n\r\n    //////////////////////////////////////////////////////////////////////////////\r\n    //-------------------------\\/ GETTERS & SETTERS \\/--------------------------//\r\n    public List<Author> getAuthors() {\r\n        return authors;\r\n    }\r\n\r\n    public void setAuthors(List<Author> authors) {\r\n        this.authors = authors;\r\n    }\r\n\r\n    public String256 getAvailabilityStatus() {\r\n        return availabilityStatus;\r\n    }\r\n\r\n    public void setAvailabilityStatus(String256 availabilityStatus) {\r\n        this.availabilityStatus = availabilityStatus;\r\n    }\r\n\r\n    public List<InternationalString> getComments() {\r\n        return comments;\r\n    }\r\n\r\n    public void setComments(List<InternationalString> comments) {\r\n        this.comments = comments;\r\n    }\r\n\r\n    public CodedTerm getContentTypeCode() {\r\n        return contentTypeCode;\r\n    }\r\n\r\n    public void setContentTypeCode(CodedTerm contentTypeCode) {\r\n        this.contentTypeCode = contentTypeCode;\r\n    }\r\n\r\n    public String256 getEntryUUID() {\r\n        return entryUUID;\r\n    }\r\n\r\n    public void setEntryUUID(String256 entryUUID) {\r\n        this.entryUUID = entryUUID;\r\n    }\r\n\r\n    public String256 getHomeCommunityId() {\r\n        return homeCommunityId;\r\n    }\r\n\r\n    public void setHomeCommunityId(String256 homeCommunityId) {\r\n        this.homeCommunityId = homeCommunityId;\r\n    }\r\n\r\n    public NameValueString256 getIntendedRecipient() {\r\n        return intendedRecipient;\r\n    }\r\n\r\n    public void setIntendedRecipient(NameValueString256 intendedRecipient) {\r\n        this.intendedRecipient = intendedRecipient;\r\n    }\r\n\r\n    public IdentifierString256 getPatientId() {\r\n        return patientId;\r\n    }\r\n\r\n    public void setPatientId(IdentifierString256 patientId) {\r\n        this.patientId = patientId;\r\n    }\r\n\r\n    public IdentifierOID getSourceId() {\r\n        return sourceId;\r\n    }\r\n\r\n    public void setSourceId(IdentifierOID sourceId) {\r\n        this.sourceId = sourceId;\r\n    }\r\n\r\n    public NameValueDTM getSubmissionTime() {\r\n        return submissionTime;\r\n    }\r\n\r\n    public void setSubmissionTime(NameValueDTM submissionTime) {\r\n        this.submissionTime = submissionTime;\r\n    }\r\n\r\n    public List<InternationalString> getTitle() {\r\n        return title;\r\n    }\r\n\r\n    public void setTitle(List<InternationalString> title) {\r\n        this.title = title;\r\n    }\r\n\r\n    /**\r\n     * This methods returns a globally unique identifier for the\r\n     * SubmissionSet assigned by the creating entity.\r\n     * @return uniqueId\r\n     */\r\n    public IdentifierOID getUniqueId() {\r\n        return uniqueId;\r\n    }\r\n\r\n    /**\r\n     * This methods sets a globally unique identifier for the\r\n     * SubmissionSet assigned by the creating entity.\r\n     * @param  uniqueId\r\n     */\r\n    public void setUniqueId(IdentifierOID uniqueId) {\r\n        this.uniqueId = uniqueId;\r\n    }\r\n    //-------------------------/\\ GETTERS & SETTERS /\\--------------------------//\r\n    //////////////////////////////////////////////////////////////////////////////\r\n\r\n    public void populate(){\r\n        entryUUID.setString(\"SubmissionSet01\");\r\n        uniqueId.setValue(new OID(new String256(\"2009.9.1.2456\")));\r\n        sourceId.setValue(new OID(new String256(\"1.3.6.1.4.1.21367.2009.1.2.1\")));\r\n        patientId.setValue(new String256(\"6578946^^^&1.3.6.1.4.1.21367.2005.3.7&ISO\"));\r\n        contentTypeCode=new CodedTerm(\"11502-2\",\"LABORATORY REPORT.TOTAL\",\"2.16.840.1.113883.6.1\");\r\n        availabilityStatus.setString(\"urn:oasis:names:tc:ebxml-regrep:StatusType:Approved\");\r\n        homeCommunityId.setString(\"urn:oid:1.2.3\");\r\n        Author author1=new Author();\r\n        author1.setAuthorPerson(new String256(\"Jack Scelere\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Cleveland Clinic\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Parma Community\"));\r\n        author1.getAuthorRoles().add(new String256(\"attending\"));\r\n        author1.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        Author author2=new Author();\r\n        author2.setAuthorPerson(new String256(\"D12398^Doe^John^^^^^^&1.2.3.4.5.6.7.8.9.1789.45.1&ISO\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Cleveland Clinic^^^^^^^^^1.2.3.4.5.6.7.8.9.1789.45\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Berea Community\"));\r\n        author2.getAuthorRoles().add(new String256(\"Primary Surgeon\"));\r\n        author2.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        authors.add(author1);\r\n        authors.add(author2);\r\n        intendedRecipient.getValues().add(new String256(\"SomeHospital^^^^^^^^^1.2.3.9.1789.45|^Wel^Marcus^^^Dr^MD|^^Internet^mwel@healthcare.example.org\"));\r\n        intendedRecipient.getValues().add(new String256(\"Some Hospital^^^^^^^^^1.2.3.9.1789.45|^Peirre^LaPointe^^^Dr^MD\"));\r\n        intendedRecipient.getValues().add(new String256(\"|12345^LaShawn^James^^Dr^MD\"));\r\n        intendedRecipient.getValues().add(new String256(\"MainHospital^^^^^^^^^1.2.3.4.5.6.7.8.9.1789.2364\"));\r\n        intendedRecipient.getValues().add(new String256(\"||^^Internet^dr.oz@healthcare.example.org\"));\r\n        title.add(new InternationalString(LanguageCode.ENGLISH_UNITED_STATES, new String256(\"Example Submission Set Title\")));\r\n        comments.add(new InternationalString(LanguageCode.ENGLISH_UNITED_STATES, new String256(\"comment associated with SubmissionSet\")));\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"SubmissionSet{\" +\r\n                \"authors=\" + authors +\r\n                \", availabilityStatus=\" + availabilityStatus +\r\n                \", comments=\" + comments +\r\n                \", contentTypeCode=\" + contentTypeCode +\r\n                \", entryUUID=\" + entryUUID +\r\n                \", homeCommunityId=\" + homeCommunityId +\r\n                \", intendedRecipient=\" + intendedRecipient +\r\n                \", patientId=\" + patientId +\r\n                \", sourceId=\" + sourceId +\r\n//                \", submissionTime=\" + submissionTime +\r\n                \", title=\" + title +\r\n                \", uniqueId=\" + uniqueId +\r\n                \'}\';\r\n    }\r\n\r\n    @Override\r\n    public boolean verify() {\r\n        return true;\r\n    }\r\n\r\n    public XdsSubmissionSet copy() {\r\n        XdsSubmissionSet subSet=new XdsSubmissionSet();\r\n        subSet.setContentTypeCode(this.getContentTypeCode());\r\n        subSet.setSubmissionTime(this.getSubmissionTime());\r\n        subSet.setHomeCommunityId(this.getHomeCommunityId());\r\n        subSet.setUniqueId(this.getUniqueId());\r\n        subSet.setAuthors(this.getAuthors());\r\n        subSet.setAvailabilityStatus(this.getAvailabilityStatus());\r\n        subSet.setComments(this.getComments());\r\n        subSet.setEntryUUID(this.getEntryUUID());\r\n        subSet.setIntendedRecipient(this.getIntendedRecipient());\r\n        subSet.setPatientId(this.getPatientId());\r\n        subSet.setSourceId(this.getSourceId());\r\n        subSet.setTitle(this.getTitle());\r\n        return subSet;\r\n    }\r\n}\r\n'),(4608,5739,'package gov.nist.hit.ds.docentryeditor.client;\r\n\r\nimport com.google.gwt.i18n.client.DateTimeFormat;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.*;\r\n\r\n/**\r\n * Created by onh2 on 10/2/2014.\r\n */\r\npublic class ClientTestHelper {\r\n    public final static ClientTestHelper instance = new ClientTestHelper();\r\n    private XdsDocumentEntry docentry;\r\n\r\n    private ClientTestHelper() {\r\n        initDocEntry();\r\n    }\r\n\r\n    private void initDocEntry() {\r\n        docentry = new XdsDocumentEntry();\r\n        // ---- TITLES\r\n        docentry.getTitles().add(new InternationalString(LanguageCode.getValueOf(\"en-GB\"), new String256(\"Health record\")));\r\n        docentry.getTitles().add(new InternationalString(LanguageCode.getValueOf(\"fr-FR\"), new String256(\"Carnet de sante\")));\r\n        // ---- COMMENTS\r\n        docentry.getComments().add(new InternationalString(LanguageCode.getValueOf(\"en-GB\"), new String256(\"Health record metadata\")));\r\n        docentry.getComments().add(new InternationalString(LanguageCode.getValueOf(\"fr-FR\"), new String256(\"Metadonnees du carnet de sante\")));\r\n        // ---- AUTHORS\r\n        Author author1 = new Author();\r\n        author1.setAuthorPerson(new String256(\"Jack Scelere\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Cleveland Clinic\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Parma Community\"));\r\n        author1.getAuthorRoles().add(new String256(\"attending\"));\r\n        author1.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        author1.getAuthorTelecommunications().add(new String256(\"^^Internet^Jack.Scelere@healthcare.example.org\"));\r\n        Author author2 = new Author();\r\n        author2.setAuthorPerson(new String256(\"D12398^Doe^John^^^^^^&1.2.3.4.5.6.7.8.9.1789.45.1&ISO\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Cleveland Clinic^^^^^^^^^1.2.3.4.5.6.7.8.9.1789.45\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Berea Community\"));\r\n        author2.getAuthorRoles().add(new String256(\"Primary Surgon\"));\r\n        author2.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        author2.getAuthorTelecommunications().add(new String256(\"^^Internet^john.doe@healthcare.example.org\"));\r\n        docentry.getAuthors().add(author1);\r\n        docentry.getAuthors().add(author2);\r\n        // ---- CLASS CODE\r\n        docentry.setClassCode(new CodedTerm(\"H25l\", \"test\", \"Connect-a-thon contentTypeCodes\"));\r\n        // ---- CONFIDENTIALITY CODES\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.102\", \"Clinical-Staff\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f\"));\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.103\", \"Clinical-Staff-Allowed\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840a\"));\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.104\", \"Clinical-Staff-Priority\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840b\"));\r\n        // ---- CREATION TIME\r\n        NameValueDTM creation = new NameValueDTM();\r\n        creation.setName(new String256(\"creationTime\"));\r\n        creation.getValues().clear();\r\n        creation.getValues().add(new DTM((DateTimeFormat.getFormat(\"yyyyMMddHHmmss\").parse(\"20131126214203\"))));\r\n        docentry.setCreationTime(creation);\r\n        // ---- EVENT CODES\r\n        docentry.getEventCode().add(new CodedTerm(\"Op-1\", \"Operations\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705395555d\"));\r\n        docentry.getEventCode().add(new CodedTerm(\"HEv-1.3.5\", \"Health Events\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705395555e\"));\r\n        // ---- FORMAT CODE\r\n        docentry.setFormatCode(new CodedTerm(\"CDAR2/IHE 1.0\", \"CDAR2/IHE 1.0\", \"urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d\"));\r\n        // ---- HEALTHCARE FACILITY TYPE\r\n        docentry.setHealthcareFacilityType(new CodedTerm(\"Outpatient\", \"Outpatient\", \"urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1\"));\r\n        // ---- LANGUAGE CODE\r\n        docentry.setLanguageCode(LanguageCode.getValueOf(\"en-GB\"));\r\n        // ---- LEGAL AUTHENTICATOR\r\n        docentry.getLegalAuthenticator().getValues().clear();\r\n        docentry.getLegalAuthenticator().getValues().add(new String256(\"11375^Welby^Marcus^J^Jr. MD^Dr^^^&1.2.840.113619.6.197&ISO\"));\r\n        // ---- MIME TYPE\r\n        docentry.setMimeType(new String256(\"application/pdf\"));\r\n        // ---- PATIENT ID\r\n        docentry.setPatientID(new IdentifierString256(new String256(\"6578946^^^&1.3.6.1.4.1.21367.2005.3.7&ISO\"), new String256(\"urn:uuid:6b5aea1a-874d-4603-a4bc-96a0a7b38446\")));\r\n        // ---- PRACTICE SETTING CODE\r\n        docentry.setPracticeSettingCode(new CodedTerm(\"General Medicine\", \"General Medicine\", \"urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead\"));\r\n        // ---- REPOSITORY UNIQUE ID\r\n        docentry.setRepoUId(new OID(new String256(\"1.3.6.1.4.1.28867.2006.3.1\")));\r\n        // ---- SERVICE START TIME\r\n        NameValueDTM start = new NameValueDTM();\r\n        start.setName(new String256(\"startTime\"));\r\n        start.getValues().clear();\r\n        start.getValues().add(new DTM((DateTimeFormat.getFormat(\"yyyyMMddHHmmss\").parse(\"20131202201000\"))));\r\n        docentry.setServiceStartTime(start);\r\n        // ---- SERVICE STOP TIME\r\n        NameValueDTM stop = new NameValueDTM();\r\n        stop.setName(new String256(\"stopTime\"));\r\n        stop.getValues().clear();\r\n        stop.getValues().add(new DTM((DateTimeFormat.getFormat(\"yyyyMMddHHmmss\").parse(\"20140213101500\"))));\r\n        docentry.setServiceStopTime(stop);\r\n        // ---- SIZE\r\n        docentry.getSize().setName(new String256(\"size\"));\r\n        docentry.getSize().getValues().clear();\r\n        docentry.getSize().getValues().add(65);\r\n        // ---- SOURCE PATIENT ID\r\n        docentry.getSourcePatientId().setName(new String256(\"SourcePatientID\"));\r\n        docentry.getSourcePatientId().getValues().clear();\r\n        docentry.getSourcePatientId().getValues().add(new String256(\"j98789^^^&1.2.3.4.343.1&ISO\"));\r\n        // ---- SOURCE PATIENT INFO\r\n        docentry.getSourcePatientInfo().setName(new String256(\"SourcePatientInfo\"));\r\n        docentry.getSourcePatientInfo().getValues().clear();\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-3|DTP-1^^^&j98789^^^&1.2.3.4.343.1&ISO\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-5|DICTAPHONE^ONE^^^\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-7|19650120\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-8|M\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-11|100 MainSt^^BURLINGTON^MA^01803^USA\"));\r\n        // ---- TYPE CODE\r\n        docentry.setTypeCode(new CodedTerm(\"History and Physical\", \"History and Physical\", \"urn:uuid:aa543740-bdda-424e-8c96-df4873be8500\"));\r\n        // ---- UNIQUE ID\r\n        docentry.setUniqueId(new IdentifierOID(new OID(new String256(\"1.3.6.1.4.1.21367.2005.3.7^11379\")), new String256(\"urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab\")));\r\n        // ---- URI\r\n        docentry.setUri(new String256(\"http://www.ihe.net\"));\r\n        // ---- DocEntryUUID\r\n        docentry.setId(new String256(\"123456789\"));\r\n        // ---- HASH\r\n        docentry.setHash(new String256(\"da39a3ee5e6b4b0d3255bfef95601890afd80709\"));\r\n\r\n\r\n    }\r\n\r\n    public XdsDocumentEntry getDocEntry() {\r\n        return docentry;\r\n    }\r\n}\r\n'),(4609,5740,'package gov.nist.hit.ds.docentryeditor.client;\r\n\r\nimport com.google.gwt.junit.client.GWTTestCase;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.PreParse;\r\nimport gov.nist.hit.ds.docentryeditor.client.parser.XdsParser;\r\nimport gov.nist.hit.ds.docentryeditor.client.resources.AppResources;\r\nimport gov.nist.hit.ds.docentryeditor.client.utils.MetadataEditorGinInjector;\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.XdsDocumentEntry;\r\n\r\npublic class XdsParsingTest extends GWTTestCase {\r\n\r\n    @Override\r\n    public String getModuleName() {\r\n        return \"gov.nist.hit.ds.docentryeditor.XDSMetadataEditor\";\r\n    }\r\n\r\n    public void testRun() {\r\n        assertTrue(true);\r\n    }\r\n\r\n    public void testLoadedDocEntry() {\r\n        final String docentry = AppResources.INSTANCE.xdsPrefill().getText();\r\n        assertNotNull(\"DocEntry File is null\", docentry);\r\n        assertTrue(\"DocEntry File is empty\", !docentry.isEmpty());\r\n    }\r\n\r\n    public void testLoadedCodedTerms() {\r\n        final String codedTerms = AppResources.INSTANCE.xdsPrefill().getText();\r\n        assertNotNull(\"CodedTerms File is null\", codedTerms);\r\n        assertTrue(\"CodedTerms File is empty\", !codedTerms.isEmpty());\r\n    }\r\n\r\n    public void testPreParseDocEntry() {\r\n        final String docentry = AppResources.INSTANCE.xdsPrefill().getText();\r\n        PreParse preParser = PreParse.getInstance();\r\n        String preParsedDocentry = preParser.doPreParse(docentry);\r\n        assertNotSame(\"PreParse did not clean escape characters\", docentry, preParsedDocentry);\r\n        String preParsedUTF8Docentry = preParser.doPreParseUTF8(docentry);\r\n        assertNotSame(\"PreParse UTF8 character encoding problem\", docentry, preParsedUTF8Docentry);\r\n        assertNotSame(\"PreParse UTF8 character encoding problem\", preParsedDocentry, preParsedUTF8Docentry);\r\n        assertFalse(\"PreParse UTF8 \'&\' character encoding problem\", preParsedUTF8Docentry.contains(\"&amp;\"));\r\n    }\r\n\r\n    public void testParseDocEntry() {\r\n        final String docentry = AppResources.INSTANCE.xdsPrefill().getText();\r\n        MetadataEditorGinInjector injector = MetadataEditorGinInjector.INSTANCE;\r\n        XdsParser xdsParser = injector.getXdsParser();\r\n        XdsDocumentEntry model = xdsParser.parse(PreParse.getInstance().doPreParse(docentry));\r\n        assertNotNull(\"Parsed Document Entry is null\", model);\r\n        assertEquals(\"There has been a problem while parsing authors\", model.getAuthors(), ClientTestHelper.instance.getDocEntry().getAuthors());\r\n        assertEquals(\"There has been a problem while parsing class code\", ClientTestHelper.instance.getDocEntry().getClassCode(), model.getClassCode());\r\n        assertEquals(\"There has been a problem while parsing format code\", ClientTestHelper.instance.getDocEntry().getFormatCode(), model.getFormatCode());\r\n        assertEquals(\"There has been a problem while parsing healthcare facility type\", ClientTestHelper.instance.getDocEntry().getHealthcareFacilityType(), model.getHealthcareFacilityType());\r\n        assertEquals(\"There has been a problem while parsing comments\", ClientTestHelper.instance.getDocEntry().getComments(), model.getComments());\r\n        assertEquals(\"There has been a problem while parsing titles\", ClientTestHelper.instance.getDocEntry().getTitles(), model.getTitles());\r\n        assertEquals(\"There has been a problem while parsing confidentiality codes\", ClientTestHelper.instance.getDocEntry().getConfidentialityCodes(), model.getConfidentialityCodes());\r\n        assertEquals(\"There has been a problem while parsing creation time\", ClientTestHelper.instance.getDocEntry().getCreationTime(), model.getCreationTime());\r\n        assertEquals(\"There has been a problem while parsing service start time\", ClientTestHelper.instance.getDocEntry().getServiceStartTime(), model.getServiceStartTime());\r\n        assertEquals(\"There has been a problem while parsing service stop time\", ClientTestHelper.instance.getDocEntry().getServiceStopTime(), model.getServiceStopTime());\r\n        assertEquals(\"There has been a problem while parsing event codes\", ClientTestHelper.instance.getDocEntry().getEventCode(), model.getEventCode());\r\n        assertEquals(\"There has been a problem while parsing uuid\", ClientTestHelper.instance.getDocEntry().getId(), model.getId());\r\n        assertEquals(\"There has been a problem while parsing mime type\", ClientTestHelper.instance.getDocEntry().getMimeType(), model.getMimeType());\r\n        assertEquals(\"There has been a problem while parsing language code\", ClientTestHelper.instance.getDocEntry().getLanguageCode(), model.getLanguageCode());\r\n        assertEquals(\"There has been a problem while parsing legal authenticator\", ClientTestHelper.instance.getDocEntry().getLegalAuthenticator(), model.getLegalAuthenticator());\r\n        assertEquals(\"There has been a problem while parsing patient id\", ClientTestHelper.instance.getDocEntry().getPatientID(), model.getPatientID());\r\n        assertEquals(\"There has been a problem while parsing practice setting code\", ClientTestHelper.instance.getDocEntry().getPracticeSettingCode(), model.getPracticeSettingCode());\r\n        assertEquals(\"There has been a problem while parsing repository unique id\", ClientTestHelper.instance.getDocEntry().getRepoUId(), model.getRepoUId());\r\n        assertEquals(\"There has been a problem while parsing size\", ClientTestHelper.instance.getDocEntry().getSize(), model.getSize());\r\n        assertEquals(\"There has been a problem while parsing source patient id\", ClientTestHelper.instance.getDocEntry().getSourcePatientId(), model.getSourcePatientId());\r\n        assertEquals(\"There has been a problem while parsing source patient info\", ClientTestHelper.instance.getDocEntry().getSourcePatientInfo(), model.getSourcePatientInfo());\r\n        assertEquals(\"There has been a problem while parsing type code\", ClientTestHelper.instance.getDocEntry().getTypeCode(), model.getTypeCode());\r\n        assertEquals(\"There has been a problem while parsing uri\", ClientTestHelper.instance.getDocEntry().getUri(), model.getUri());\r\n        assertEquals(\"There has been a problem while parsing unique id\", ClientTestHelper.instance.getDocEntry().getUniqueId(), model.getUniqueId());\r\n        assertEquals(\"There has been a problem while parsing hash\", ClientTestHelper.instance.getDocEntry().getHash(), model.getHash());\r\n    }\r\n\r\n    public void testSaveFile() {\r\n        final String docentry = AppResources.INSTANCE.xdsPrefill().getText();\r\n        MetadataEditorGinInjector injector = MetadataEditorGinInjector.INSTANCE;\r\n        XdsParser xdsParser = injector.getXdsParser();\r\n        XdsDocumentEntry model = xdsParser.parse(PreParse.getInstance().doPreParse(docentry));\r\n    }\r\n\r\n\r\n}\r\n'),(4610,5742,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\n\r\nimport junit.framework.TestCase;\r\nimport org.junit.Test;\r\n\r\nimport java.io.File;\r\n\r\n/**\r\n * Created by onh2 on 10/2/2014.\r\n */\r\npublic class SaveFileTest extends TestCase {\r\n\r\n    @Test\r\n    public void testSave() {\r\n        SaveFileService service = new SaveFileService();\r\n        String filename = service.saveAsXMLFile(\"test.xml\", ServerTestHelper.instance.docEntryToXML(ServerTestHelper.instance.getDocEntry()));\r\n        assertNotNull(\"No written filename return from server.\", filename);\r\n        assertFalse(\"Filename returned from server is empty\", filename.isEmpty());\r\n        assertTrue(\"Filename\'s extension is wrong (not .xml)\", filename.contains(\".xml\"));\r\n        String rootDirPath = System.getProperty(\"user.dir\");\r\n        assertNotNull(\"Impossible to locate file directory\", rootDirPath);\r\n        assertFalse(\"Impossible to locate file directory\", rootDirPath.isEmpty());\r\n        File fileFolder = new File(new File(rootDirPath), \"/files/\");\r\n        File file = new File(fileFolder + \"/test.xml\");\r\n        assertNotNull(\"File is not found on server\", file);\r\n        assertTrue(\"File does not exists on server\", file.exists());\r\n    }\r\n}\r\n'),(4611,5743,'package gov.nist.hit.ds.docentryeditor.server;\r\n\r\nimport gov.nist.hit.ds.docentryeditor.shared.model.*;\r\n\r\nimport java.text.SimpleDateFormat;\r\n\r\n/**\r\n * Created by onh2 on 10/2/2014.\r\n */\r\npublic class ServerTestHelper {\r\n    public final static ServerTestHelper instance = new ServerTestHelper();\r\n    private XdsDocumentEntry docentry;\r\n    private SimpleDateFormat format = new SimpleDateFormat(\"yyyyMMddHHmmss\");\r\n\r\n    private ServerTestHelper() {\r\n        initDocEntry();\r\n    }\r\n\r\n    private void initDocEntry() {\r\n        docentry = new XdsDocumentEntry();\r\n        // ---- TITLES\r\n        docentry.getTitles().add(new InternationalString(LanguageCode.getValueOf(\"en-GB\"), new String256(\"Health record\")));\r\n        docentry.getTitles().add(new InternationalString(LanguageCode.getValueOf(\"fr-FR\"), new String256(\"Carnet de sante\")));\r\n        // ---- COMMENTS\r\n        docentry.getComments().add(new InternationalString(LanguageCode.getValueOf(\"en-GB\"), new String256(\"Health record metadata\")));\r\n        docentry.getComments().add(new InternationalString(LanguageCode.getValueOf(\"fr-FR\"), new String256(\"Metadonnees du carnet de sante\")));\r\n        // ---- AUTHORS\r\n        Author author1 = new Author();\r\n        author1.setAuthorPerson(new String256(\"Jack Scelere\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Cleveland Clinic\"));\r\n        author1.getAuthorInstitutions().add(new String256(\"Parma Community\"));\r\n        author1.getAuthorRoles().add(new String256(\"attending\"));\r\n        author1.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        author1.getAuthorTelecommunications().add(new String256(\"^^Internet^Jack.Scelere@healthcare.example.org\"));\r\n        Author author2 = new Author();\r\n        author2.setAuthorPerson(new String256(\"D12398^Doe^John^^^^^^&1.2.3.4.5.6.7.8.9.1789.45.1&ISO\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Cleveland Clinic^^^^^^^^^1.2.3.4.5.6.7.8.9.1789.45\"));\r\n        author2.getAuthorInstitutions().add(new String256(\"Berea Community\"));\r\n        author2.getAuthorRoles().add(new String256(\"Primary Surgon\"));\r\n        author2.getAuthorSpecialties().add(new String256(\"Orthopedic\"));\r\n        author2.getAuthorTelecommunications().add(new String256(\"^^Internet^john.doe@healthcare.example.org\"));\r\n        docentry.getAuthors().add(author1);\r\n        docentry.getAuthors().add(author2);\r\n        // ---- CLASS CODE\r\n        docentry.setClassCode(new CodedTerm(\"H25l\", \"test\", \"Connect-a-thon contentTypeCodes\"));\r\n        // ---- CONFIDENTIALITY CODES\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.102\", \"Clinical-Staff\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f\"));\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.103\", \"Clinical-Staff-Allowed\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840a\"));\r\n        docentry.getConfidentialityCodes().add(new CodedTerm(\"1.3.6.1.4.1.21367.2006.7.104\", \"Clinical-Staff-Priority\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840b\"));\r\n        // ---- CREATION TIME\r\n        NameValueDTM creation = new NameValueDTM();\r\n        creation.setName(new String256(\"creationTime\"));\r\n        creation.getValues().clear();\r\n        try {\r\n            creation.getValues().add(new DTM((format.parse(\"20131126214203\"))));\r\n        } catch (Exception e) {\r\n            System.err.println(\"Error while parsing date to format yyyyMMddHHmmss\");\r\n            System.err.println(e.getStackTrace());\r\n        }\r\n        docentry.setCreationTime(creation);\r\n        // ---- EVENT CODES\r\n        docentry.getEventCode().add(new CodedTerm(\"Op-1\", \"Operations\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705395555d\"));\r\n        docentry.getEventCode().add(new CodedTerm(\"HEv-1.3.5\", \"Health Events\", \"urn:uuid:f4f85eac-e6cb-4883-b524-f2705395555e\"));\r\n        // ---- FORMAT CODE\r\n        docentry.setFormatCode(new CodedTerm(\"CDAR2/IHE 1.0\", \"CDAR2/IHE 1.0\", \"urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d\"));\r\n        // ---- HEALTHCARE FACILITY TYPE\r\n        docentry.setHealthcareFacilityType(new CodedTerm(\"Outpatient\", \"Outpatient\", \"urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1\"));\r\n        // ---- LANGUAGE CODE\r\n        docentry.setLanguageCode(LanguageCode.getValueOf(\"en-GB\"));\r\n        // ---- LEGAL AUTHENTICATOR\r\n        docentry.getLegalAuthenticator().getValues().clear();\r\n        docentry.getLegalAuthenticator().getValues().add(new String256(\"11375^Welby^Marcus^J^Jr. MD^Dr^^^&1.2.840.113619.6.197&ISO\"));\r\n        // ---- MIME TYPE\r\n        docentry.setMimeType(new String256(\"application/pdf\"));\r\n        // ---- PATIENT ID\r\n        docentry.setPatientID(new IdentifierString256(new String256(\"6578946^^^&1.3.6.1.4.1.21367.2005.3.7&ISO\"), new String256(\"urn:uuid:6b5aea1a-874d-4603-a4bc-96a0a7b38446\")));\r\n        // ---- PRACTICE SETTING CODE\r\n        docentry.setPracticeSettingCode(new CodedTerm(\"General Medicine\", \"General Medicine\", \"urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead\"));\r\n        // ---- REPOSITORY UNIQUE ID\r\n        docentry.setRepoUId(new OID(new String256(\"1.3.6.1.4.1.28867.2006.3.1\")));\r\n        // ---- SERVICE START TIME\r\n        NameValueDTM start = new NameValueDTM();\r\n        start.setName(new String256(\"startTime\"));\r\n        start.getValues().clear();\r\n        try {\r\n            start.getValues().add(new DTM((format.parse(\"20131202201000\"))));\r\n        } catch (Exception e) {\r\n            System.err.println(\"Error while parsing date to format yyyyMMddHHmmss\");\r\n            System.err.println(e.getStackTrace());\r\n        }\r\n        docentry.setServiceStartTime(start);\r\n        // ---- SERVICE STOP TIME\r\n        NameValueDTM stop = new NameValueDTM();\r\n        stop.setName(new String256(\"stopTime\"));\r\n        stop.getValues().clear();\r\n        try {\r\n            start.getValues().add(new DTM((format.parse(\"20140213101500\"))));\r\n        } catch (Exception e) {\r\n            System.err.println(\"Error while parsing date to format yyyyMMddHHmmss\");\r\n            System.err.println(e.getStackTrace());\r\n        }\r\n        docentry.setServiceStopTime(stop);\r\n        // ---- SIZE\r\n        docentry.getSize().setName(new String256(\"size\"));\r\n        docentry.getSize().getValues().clear();\r\n        docentry.getSize().getValues().add(65);\r\n        // ---- SOURCE PATIENT ID\r\n        docentry.getSourcePatientId().setName(new String256(\"SourcePatientID\"));\r\n        docentry.getSourcePatientId().getValues().clear();\r\n        docentry.getSourcePatientId().getValues().add(new String256(\"j98789^^^&1.2.3.4.343.1&ISO\"));\r\n        // ---- SOURCE PATIENT INFO\r\n        docentry.getSourcePatientInfo().setName(new String256(\"SourcePatientInfo\"));\r\n        docentry.getSourcePatientInfo().getValues().clear();\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-3|DTP-1^^^&j98789^^^&1.2.3.4.343.1&ISO\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-5|DICTAPHONE^ONE^^^\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-7|19650120\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-8|M\"));\r\n        docentry.getSourcePatientInfo().getValues().add(new String256(\"PID-11|100 MainSt^^BURLINGTON^MA^01803^USA\"));\r\n        // ---- TYPE CODE\r\n        docentry.setTypeCode(new CodedTerm(\"History and Physical\", \"History and Physical\", \"urn:uuid:aa543740-bdda-424e-8c96-df4873be8500\"));\r\n        // ---- UNIQUE ID\r\n        docentry.setUniqueId(new IdentifierOID(new OID(new String256(\"1.3.6.1.4.1.21367.2005.3.7^11379\")), new String256(\"urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab\")));\r\n        // ---- URI\r\n        docentry.setUri(new String256(\"http://www.ihe.net\"));\r\n        // ---- DocEntryUUID\r\n        docentry.setId(new String256(\"123456789\"));\r\n        // ---- HASH\r\n        docentry.setHash(new String256(\"da39a3ee5e6b4b0d3255bfef95601890afd80709\"));\r\n    }\r\n\r\n    public String docEntryToXML(XdsDocumentEntry docentry) {\r\n        StringBuilder xml = new StringBuilder();\r\n        xml.append(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<Document>\\n\");\r\n        System.out.println(docentry.getTitles());\r\n        if (docentry.getTitles() != null && docentry.getTitles().size() > 0) {\r\n            xml.append(\"\\t<titles>\\n\");\r\n            for (InternationalString str : docentry.getTitles()) {\r\n                xml.append(str.toXML());\r\n            }\r\n            xml.append(\"\\t</titles>\\n\");\r\n        }\r\n        if (docentry.getComments() != null && docentry.getComments().size() > 0) {\r\n            xml.append(\"\\t<comments>\\n\");\r\n            for (InternationalString str : docentry.getComments()) {\r\n                xml.append(str.toXML());\r\n            }\r\n            xml.append(\"\\t</comments>\\n\");\r\n        }\r\n\r\n        if (docentry.getAuthors() != null && docentry.getAuthors().size() > 0) {\r\n            xml.append(\"\\t<authors>\\n\");\r\n            for (Author auth : docentry.getAuthors()) {\r\n                xml.append(auth.toXML());\r\n            }\r\n            xml.append(\"\\t</authors>\\n\");\r\n        }\r\n\r\n        if (docentry.getClassCode() != null && !docentry.getClassCode().getCode().equals(\"\")) {\r\n            xml.append(\"\\t<classcode>\\n\");\r\n            xml.append(docentry.getClassCode().toXML());\r\n            xml.append(\"\\t</classcode>\\n\");\r\n        }\r\n        if (docentry.getConfidentialityCodes().size() > 0) {\r\n            xml.append(\"\\t<confidentialitycode>\\n\");\r\n            for (CodedTerm ct : docentry.getConfidentialityCodes()) {\r\n                xml.append(ct.toXML());\r\n            }\r\n            xml.append(\"\\t</confidentialitycode>\\n\");\r\n        }\r\n        if (docentry.getCreationTime() != null) {\r\n            xml.append(\"\\t<creationtime>\\n\");\r\n            xml.append(new SimpleDateFormat(\"yyyyMMddHHmmss\").format(docentry.getCreationTime().getValues().get(0).getDtm()));\r\n            xml.append(\"\\t</creationtime>\\n\");\r\n        }\r\n        if (docentry.getId() != null && !docentry.getId().equals(\"\")) {\r\n            xml.append(\"\\t<id>\");\r\n            xml.append(docentry.getId().toString());\r\n            xml.append(\"</id>\\n\");\r\n        }\r\n        if (docentry.getEventCode() != null && docentry.getEventCode().size() > 0) {\r\n            xml.append(\"\\t<eventcode>\\n\");\r\n            for (CodedTerm ct : docentry.getEventCode()) {\r\n                xml.append(ct.toXML());\r\n            }\r\n            xml.append(\"\\t</eventcode>\\n\");\r\n        }\r\n\r\n        if (docentry.getFormatCode() != null && !docentry.getFormatCode().equals(\"\")) {\r\n            xml.append(\"\\t<formatcode>\\n\");\r\n            xml.append(docentry.getFormatCode().toXML());\r\n            xml.append(\"\\t</formatcode>\\n\");\r\n        }\r\n        if (docentry.getHash() != null && !docentry.getHash().equals(\"\")) {\r\n            xml.append(\"\\t<hash>\");\r\n            xml.append(docentry.getHash().toString());\r\n            xml.append(\"</hash>\\n\");\r\n        }\r\n\r\n        if (!docentry.getHealthcareFacilityType().getCode().getString().equals(\"\")) {\r\n            xml.append(\"\\t<healthcarefacilitytype>\\n\");\r\n            xml.append(docentry.getHealthcareFacilityType().toXML());\r\n            xml.append(\"\\t</healthcarefacilitytype>\\n\");\r\n        }\r\n\r\n        if (docentry.getLanguageCode() != null) {\r\n            xml.append(\"\\t<languagecode>\");\r\n            xml.append(docentry.getLanguageCode().toString());\r\n            xml.append(\"</languagecode>\\n\");\r\n        }\r\n        if (docentry.getLegalAuthenticator() != null && docentry.getLegalAuthenticator().getValues().size() > 0) {\r\n            xml.append(\"\\t<legalauthenticator>\\n\");\r\n            xml.append(docentry.getLegalAuthenticator().toXML());\r\n            xml.append(\"\\t</legalauthenticator>\\n\");\r\n        }\r\n        if (docentry.getMimeType() != null && !docentry.getMimeType().equals(\"\")) {\r\n            xml.append(\"\\t<mimetype>\");\r\n            xml.append(docentry.getMimeType().toString());\r\n            xml.append(\"</mimetype>\\n\");\r\n        }\r\n        if (docentry.getPatientID() != null && docentry.getPatientID().getValue() != null && !docentry.getPatientID().getValue().getString().equals(\"\")) {\r\n            xml.append(\"\\t<patientid>\\n\");\r\n            xml.append(docentry.getPatientID().toXML());\r\n            xml.append(\"\\t</patientid>\\n\");\r\n        }\r\n        if (docentry.getPracticeSettingCode() != null && !docentry.getPracticeSettingCode().getCode().getString().equals(\"\")) {\r\n            xml.append(\"\\t<practicesettingcode>\\n\");\r\n            xml.append(docentry.getPracticeSettingCode().toXML());\r\n            xml.append(\"\\t</practicesettingcode>\\n\");\r\n        }\r\n        if (docentry.getRepoUId() != null && !docentry.getRepoUId().getOid().getString().equals(\"\")) {\r\n            xml.append(\"\\t<repositoryuniqueid>\");\r\n            xml.append(docentry.getRepoUId().toString());\r\n            xml.append(\"</repositoryuniqueid>\\n\");\r\n        }\r\n\r\n        if (docentry.getServiceStartTime() != null) {\r\n            xml.append(\"\\t<servicestarttime>\\n\");\r\n            xml.append(new SimpleDateFormat(\"yyyyMMddHHmmss\").format(docentry.getServiceStartTime().getValues().get(0).getDtm()));\r\n            xml.append(\"\\t</servicestarttime>\\n\");\r\n        }\r\n\r\n        if (docentry.getServiceStopTime() != null && !docentry.getServiceStopTime().getValues().isEmpty()) {\r\n            xml.append(\"\\t<servicestoptime>\\n\");\r\n            xml.append(new SimpleDateFormat(\"yyyyMMddHHmmss\").format(docentry.getServiceStopTime().getValues().get(0).getDtm()));\r\n            xml.append(\"\\t</servicestoptime>\\n\");\r\n        }\r\n\r\n        if (docentry.getSize() != null) {\r\n            xml.append(\"\\t<size>\\n\");\r\n            xml.append(docentry.getSize().toXML());\r\n            xml.append(\"\\t</size>\\n\");\r\n        }\r\n\r\n        if (docentry.getSourcePatientId() != null && docentry.getSourcePatientId().getValues().size() > 0) {\r\n            xml.append(\"\\t<sourcepatientid>\\n\");\r\n            xml.append(docentry.getSourcePatientId().toXML());\r\n            xml.append(\"\\t</sourcepatientid>\\n\");\r\n        }\r\n\r\n        if (docentry.getSourcePatientInfo() != null && docentry.getSourcePatientInfo().getValues().size() > 0) {\r\n            xml.append(\"\\t<sourcepatientinfo>\\n\");\r\n            xml.append(docentry.getSourcePatientInfo().toXML());\r\n            xml.append(\"\\t</sourcepatientinfo>\\n\");\r\n        }\r\n\r\n        if (docentry.getTypeCode() != null && docentry.getTypeCode().getCode() != null && !docentry.getTypeCode().getCode().getString().equals(\"\")) {\r\n            xml.append(\"\\t<typecode>\\n\");\r\n            xml.append(docentry.getTypeCode().toXML());\r\n            xml.append(\"\\t</typecode>\\n\");\r\n        }\r\n        if (docentry.getUniqueId() != null && !docentry.getUniqueId().getValue().getOid().getString().equals(\"\")) {\r\n            xml.append(\"\\t<uniqueid>\\n\");\r\n            xml.append(docentry.getUniqueId().toXML());\r\n            xml.append(\"\\t</uniqueid>\\n\");\r\n        }\r\n        if (docentry.getUri() != null && !docentry.getUri().getString().equals(\"\")) {\r\n            xml.append(\"\\t<uri>\");\r\n            xml.append(docentry.getUri().toString());\r\n            xml.append(\"</uri>\\n\");\r\n        }\r\n\r\n        xml.append(\"</Document>\");\r\n\r\n        String newXmlFile = xml.toString().replaceAll(\"&\", \"&amp;\");\r\n        return newXmlFile;\r\n    }\r\n\r\n    public XdsDocumentEntry getDocEntry() {\r\n        return docentry;\r\n    }\r\n}\r\n');
