Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix lookups and namespacing

Oliver Güntherd93fee38a47b
diff --git a/Gemfile.lock b/Gemfile.lock
index a8aaa7e1ac4..f3d945ac967 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -102,18 +102,12 @@ PATH
openproject-pdf_export
PATH
- remote: modules/bcf
+ remote: modules/bim
specs:
- openproject-bcf (1.0.0)
+ openproject-bim (1.0.0)
activerecord-import
rubyzip (~> 1.2)
-PATH
- remote: modules/bim_seeder
- specs:
- openproject-bim_seeder (1.0.0)
- openproject-bcf
-
PATH
remote: modules/boards
specs:
@@ -151,13 +145,6 @@ PATH
specs:
grids (1.0.0)
-PATH
- remote: modules/ifc_models
- specs:
- openproject-ifc_models (1.0.0)
- activerecord-import
- rubyzip (~> 1.2)
-
PATH
remote: modules/ldap_groups
specs:
@@ -1046,14 +1033,12 @@ DEPENDENCIES
openproject-auth_saml!
openproject-avatars!
openproject-backlogs!
- openproject-bcf!
- openproject-bim_seeder!
+ openproject-bim!
openproject-boards!
openproject-costs!
openproject-documents!
openproject-github_integration!
openproject-global_roles!
- openproject-ifc_models!
openproject-ldap_groups!
openproject-meeting!
openproject-openid_connect!
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index 08ef333ed84..df006aba880 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -43,5 +43,4 @@
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'OAuth'
inflect.acronym 'OpenID'
- inflect.acronym 'IFC'
end
diff --git a/modules/bim/app/cells/bim/ifc_models/row_cell.rb b/modules/bim/app/cells/bim/ifc_models/row_cell.rb
index 5a5c58314df..1744777d14b 100644
--- a/modules/bim/app/cells/bim/ifc_models/row_cell.rb
+++ b/modules/bim/app/cells/bim/ifc_models/row_cell.rb
@@ -1,5 +1,5 @@
module Bim
- module IFCModels
+ module IfcModels
class RowCell < ::RowCell
include ::IconsHelper
include ::AvatarHelper
diff --git a/modules/bim/app/cells/bim/ifc_models/table_cell.rb b/modules/bim/app/cells/bim/ifc_models/table_cell.rb
index 279e89c9254..4d52216380c 100644
--- a/modules/bim/app/cells/bim/ifc_models/table_cell.rb
+++ b/modules/bim/app/cells/bim/ifc_models/table_cell.rb
@@ -1,5 +1,5 @@
module Bim
- module IFCModels
+ module IfcModels
class TableCell < ::TableCell
include ::IconsHelper
columns :title, :default?, :created_at, :updated_at, :uploader, :processing
@@ -26,11 +26,11 @@ module Bim
def headers
[
- ['title', caption: IFCModel.human_attribute_name(:title)],
- ['is_default', caption: IFCModel.human_attribute_name(:is_default)],
- ['created_at', caption: IFCModel.human_attribute_name(:created_at)],
- ['updated_at', caption: IFCModel.human_attribute_name(:updated_at)],
- ['uploader', caption: IFCModel.human_attribute_name(:uploader)],
+ ['title', caption: IfcModel.human_attribute_name(:title)],
+ ['is_default', caption: IfcModel.human_attribute_name(:is_default)],
+ ['created_at', caption: IfcModel.human_attribute_name(:created_at)],
+ ['updated_at', caption: IfcModel.human_attribute_name(:updated_at)],
+ ['uploader', caption: IfcModel.human_attribute_name(:uploader)],
['processing', caption: I18n.t('ifc_models.processing_state.label')]
]
end
diff --git a/modules/bim/app/contracts/bim/ifc_models/base_contract.rb b/modules/bim/app/contracts/bim/ifc_models/base_contract.rb
index 2dff8290d5f..f613fc727a3 100644
--- a/modules/bim/app/contracts/bim/ifc_models/base_contract.rb
+++ b/modules/bim/app/contracts/bim/ifc_models/base_contract.rb
@@ -27,7 +27,7 @@
#++
module Bim
- module IFCModels
+ module IfcModels
class BaseContract < ::ModelContract
delegate :project,
:new_record?,
@@ -38,7 +38,7 @@ module Bim
attribute :project
def self.model
- ::IFCModels::IFCModel
+ ::Bim::IfcModels::IfcModel
end
def validate
diff --git a/modules/bim/app/contracts/bim/ifc_models/create_contract.rb b/modules/bim/app/contracts/bim/ifc_models/create_contract.rb
index 2eb016781a2..0062df31778 100644
--- a/modules/bim/app/contracts/bim/ifc_models/create_contract.rb
+++ b/modules/bim/app/contracts/bim/ifc_models/create_contract.rb
@@ -27,7 +27,7 @@
#++
module Bim
- module IFCModels
+ module IfcModels
class CreateContract < BaseContract
end
end
diff --git a/modules/bim/app/contracts/bim/ifc_models/update_contract.rb b/modules/bim/app/contracts/bim/ifc_models/update_contract.rb
index 6c4e9ac9bce..338982f7422 100644
--- a/modules/bim/app/contracts/bim/ifc_models/update_contract.rb
+++ b/modules/bim/app/contracts/bim/ifc_models/update_contract.rb
@@ -27,7 +27,7 @@
#++
module Bim
- module IFCModels
+ module IfcModels
class UpdateContract < BaseContract
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/root.rb b/modules/bim/app/controllers/bim/bcf/api/root.rb
index 5c7dfee8c72..987a01b840b 100644
--- a/modules/bim/app/controllers/bim/bcf/api/root.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/root.rb
@@ -36,22 +36,22 @@ module Bim::Bcf
module API
class Root < ::API::RootAPI
format :json
- formatter :json, API::Formatter.new
+ formatter :json, ::API::Formatter.new
default_format :json
- error_representer ::Bcf::API::V2_1::Errors::ErrorRepresenter, :json
- error_formatter :json, ::Bcf::API::ErrorFormatter::Json
+ error_representer ::Bim::Bcf::API::V2_1::Errors::ErrorRepresenter, :json
+ error_formatter :json, ::Bim::Bcf::API::ErrorFormatter::Json
authentication_scope OpenProject::Authentication::Scope::BCF_V2_1
version '2.1', using: :path do
# /auth
- mount ::Bcf::API::V2_1::AuthAPI
+ mount ::Bim::Bcf::API::V2_1::AuthAPI
# /current-user
- mount ::Bcf::API::V2_1::CurrentUserAPI
+ mount ::Bim::Bcf::API::V2_1::CurrentUserAPI
# /projects
- mount ::Bcf::API::V2_1::ProjectsAPI
+ mount ::Bim::Bcf::API::V2_1::ProjectsAPI
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/auth_api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/auth_api.rb
index b1e92aabce2..1334e0fcd2d 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/auth_api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/auth_api.rb
@@ -32,7 +32,7 @@ module Bim::Bcf::API::V2_1
class AuthAPI < ::API::OpenProjectAPI
resources :auth do
get do
- ::Bcf::API::V2_1::Auth::SingleRepresenter.new(nil)
+ ::Bim::Bcf::API::V2_1::Auth::SingleRepresenter.new(nil)
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/current_user_api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/current_user_api.rb
index bae5a03834e..aec0f5b64a9 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/current_user_api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/current_user_api.rb
@@ -28,10 +28,10 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class CurrentUserAPI < ::API::OpenProjectAPI
resources :'current-user' do
- get &::Bcf::API::V2_1::Endpoints::Show.new(model: User,
+ get &::Bim::Bcf::API::V2_1::Endpoints::Show.new(model: User,
instance_generator: ->(*) { current_user }).mount
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/create.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/create.rb
index 6c9718423e1..b1e9d2c254a 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/create.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/create.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
class Create < API::Utilities::Endpoints::Create
include ModifyMixin
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/delete.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/delete.rb
index 9c2f9fc1189..c3ab719391e 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/delete.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/delete.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
class Delete < API::Utilities::Endpoints::Delete
include ModifyMixin
@@ -40,11 +40,11 @@ module Bim::BcfAPI::V2_1::Endpoints
private
def render_representer
- "::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
+ "::Bim::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
end
def deduce_process_service
- "::Bcf::#{deduce_backend_namespace}::DeleteService".constantize
+ "::Bim::Bcf::#{deduce_backend_namespace}::DeleteService".constantize
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/index.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/index.rb
index 97effc91889..15d5e9facba 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/index.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/index.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
class Index < API::Utilities::Endpoints::Index
def mount
index = self
@@ -51,7 +51,7 @@ module Bim::BcfAPI::V2_1::Endpoints
private
def deduce_render_representer
- "::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
+ "::Bim::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/modify_mixin.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/modify_mixin.rb
index 80ee53afa8d..1202ffd7c09 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/modify_mixin.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/modify_mixin.rb
@@ -28,20 +28,20 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
module ModifyMixin
private
def deduce_parse_service
- Bcf::API::V2_1::ParseResourceParamsService
+ ::Bim::Bcf::API::V2_1::ParseResourceParamsService
end
def deduce_process_service
- "::Bcf::#{deduce_backend_namespace}::#{update_or_create}Service".constantize
+ "::Bim::Bcf::#{deduce_backend_namespace}::#{update_or_create}Service".constantize
end
def deduce_in_and_out_representer
- "::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
+ "::Bim::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
end
alias_method :deduce_parse_representer, :deduce_in_and_out_representer
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/show.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/show.rb
index 82cf845b46f..0a8f2219671 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/show.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/show.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
class Show < API::Utilities::Endpoints::Show
def render(instance)
render_representer
@@ -38,7 +38,7 @@ module Bim::BcfAPI::V2_1::Endpoints
private
def deduce_render_representer
- "::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
+ "::Bim::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/update.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/update.rb
index 9578afc0c47..1af7d1c9c83 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/update.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/endpoints/update.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Endpoints
+module Bim::Bcf::API::V2_1::Endpoints
class Update < API::Utilities::Endpoints::Update
include ModifyMixin
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/project_extensions/api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/project_extensions/api.rb
index d3b931d70de..ab69c2b3938 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/project_extensions/api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/project_extensions/api.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
module ProjectExtensions
class API < ::API::OpenProjectAPI
get :extensions do
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/projects_api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/projects_api.rb
index 1c0243d07f2..48f280c14a1 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/projects_api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/projects_api.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class ProjectsAPI < ::API::OpenProjectAPI
resources :projects do
helpers do
@@ -39,7 +39,7 @@ module Bim::BcfAPI::V2_1
end
end
- get &::Bcf::API::V2_1::Endpoints::Index.new(model: Project,
+ get &::Bim::Bcf::API::V2_1::Endpoints::Index.new(model: Project,
scope: -> { visible_projects })
.mount
@@ -49,14 +49,14 @@ module Bim::BcfAPI::V2_1
.find(params[:id])
end
- get &::Bcf::API::V2_1::Endpoints::Show.new(model: Project).mount
- put &::Bcf::API::V2_1::Endpoints::Update
+ get &::Bim::Bcf::API::V2_1::Endpoints::Show.new(model: Project).mount
+ put &::Bim::Bcf::API::V2_1::Endpoints::Update
.new(model: Project,
process_service: ::Projects::UpdateService)
.mount
- mount Bcf::API::V2_1::TopicsAPI
- mount Bcf::API::V2_1::ProjectExtensions::API
+ mount ::Bim::Bcf::API::V2_1::TopicsAPI
+ mount ::Bim::Bcf::API::V2_1::ProjectExtensions::API
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
index 429d6259dff..58b0bddb196 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
@@ -28,22 +28,22 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class TopicsAPI < ::API::OpenProjectAPI
resources :topics do
helpers do
def topics
- Bcf::Issue.of_project(@project)
+ ::Bim::Bcf::Issue.of_project(@project)
end
def transform_attributes(attributes)
- wp_attributes = Bcf::Issues::TransformAttributesService
+ wp_attributes = ::Bim::Bcf::Issues::TransformAttributesService
.new(@project)
.call(attributes)
.result
attributes
- .slice(*Bcf::Issue::SETTABLE_ATTRIBUTES)
+ .slice(*::Bim::Bcf::Issue::SETTABLE_ATTRIBUTES)
.merge(wp_attributes)
end
@@ -68,14 +68,14 @@ module Bim::BcfAPI::V2_1
authorize :view_linked_issues, context: @project
end
- get &::Bcf::API::V2_1::Endpoints::Index
- .new(model: Bcf::Issue,
+ get &::Bim::Bcf::API::V2_1::Endpoints::Index
+ .new(model: Bim::Bcf::Issue,
api_name: 'Topics',
scope: -> { topics })
.mount
- post &::Bcf::API::V2_1::Endpoints::Create
- .new(model: Bcf::Issue,
+ post &::Bim::Bcf::API::V2_1::Endpoints::Create
+ .new(model: Bim::Bcf::Issue,
api_name: 'Topics',
params_modifier: ->(attributes) {
transform_attributes(attributes)
@@ -88,13 +88,13 @@ module Bim::BcfAPI::V2_1
@issue = topics.find_by_uuid!(params[:topic_uuid])
end
- get &::Bcf::API::V2_1::Endpoints::Show
- .new(model: Bcf::Issue,
+ get &::Bim::Bcf::API::V2_1::Endpoints::Show
+ .new(model: Bim::Bcf::Issue,
api_name: 'Topics')
.mount
- put &::Bcf::API::V2_1::Endpoints::Update
- .new(model: Bcf::Issue,
+ put &::Bim::Bcf::API::V2_1::Endpoints::Update
+ .new(model: Bim::Bcf::Issue,
api_name: 'Topics',
params_modifier: ->(attributes) {
transform_attributes(attributes)
@@ -102,12 +102,12 @@ module Bim::BcfAPI::V2_1
})
.mount
- delete &::Bcf::API::V2_1::Endpoints::Delete
- .new(model: Bcf::Issue,
+ delete &::Bim::Bcf::API::V2_1::Endpoints::Delete
+ .new(model: Bim::Bcf::Issue,
api_name: 'Topics')
.mount
- mount Bcf::API::V2_1::Viewpoints::API
+ mount ::Bim::Bcf::API::V2_1::Viewpoints::API
end
end
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
index 878498c8e67..ff9c215862c 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
module Viewpoints
class API < ::API::OpenProjectAPI
resources :viewpoints do
@@ -38,8 +38,8 @@ module Bim::BcfAPI::V2_1
.pluck(:json_viewpoint)
end
- post &::Bcf::API::V2_1::Endpoints::Create
- .new(model: Bcf::Viewpoint,
+ post &::Bim::Bcf::API::V2_1::Endpoints::Create
+ .new(model: Bim::Bcf::Viewpoint,
params_modifier: ->(attributes) {
{
json_viewpoint: attributes,
@@ -52,16 +52,16 @@ module Bim::BcfAPI::V2_1
%i[/ selection coloring visibility].each do |key|
namespace = key == :/ ? :Full : key.to_s.camelize
- get key, &::Bcf::API::V2_1::Endpoints::Show
- .new(model: Bcf::Viewpoint,
+ get key, &::Bim::Bcf::API::V2_1::Endpoints::Show
+ .new(model: Bim::Bcf::Viewpoint,
api_name: 'Viewpoints',
- render_representer: "::Bcf::API::V2_1::Viewpoints::#{namespace}Representer".constantize,
+ render_representer: "::Bim::Bcf::API::V2_1::Viewpoints::#{namespace}Representer".constantize,
instance_generator: ->(*) { @issue.viewpoints.where(uuid: params[:viewpoint_uuid]) })
.mount
end
- delete &::Bcf::API::V2_1::Endpoints::Delete
- .new(model: Bcf::Viewpoint,
+ delete &::Bim::Bcf::API::V2_1::Endpoints::Delete
+ .new(model: Bim::Bcf::Viewpoint,
api_name: 'Viewpoints',
instance_generator: ->(*) { @issue.viewpoints.find_by!(uuid: params[:viewpoint_uuid]) })
.mount
diff --git a/modules/bim/app/controllers/bim/bcf/issues_controller.rb b/modules/bim/app/controllers/bim/bcf/issues_controller.rb
index fcaf4166916..c7bcffb6fff 100644
--- a/modules/bim/app/controllers/bim/bcf/issues_controller.rb
+++ b/modules/bim/app/controllers/bim/bcf/issues_controller.rb
@@ -143,7 +143,7 @@ module Bim
raise(StandardError.new(I18n.t('bcf.exceptions.file_invalid')))
end
- @issues = ::Bcf::Issue
+ @issues = ::Bim::Bcf::Issue
.includes(work_package: %i[status priority assigned_to])
.where(uuid: @listing.map { |e| e[:uuid] }, project: @project)
render 'bcf/issues/diff_on_work_packages'
@@ -200,7 +200,7 @@ module Bim
end
def build_importer
- @importer = ::OpenProject::Bcf::BcfXml::Importer.new @bcf_xml_file, @project, current_user: current_user
+ @importer = ::OpenProject::Bim::BcfXml::Importer.new @bcf_xml_file, @project, current_user: current_user
end
def get_persisted_file
diff --git a/modules/bim/app/controllers/bim/ifc_models/base_controller.rb b/modules/bim/app/controllers/bim/ifc_models/base_controller.rb
index 76b13efc6fa..f284840b6a8 100644
--- a/modules/bim/app/controllers/bim/ifc_models/base_controller.rb
+++ b/modules/bim/app/controllers/bim/ifc_models/base_controller.rb
@@ -1,5 +1,5 @@
module Bim
- module IFCModels
+ module IfcModels
class BaseController < ApplicationController
end
end
diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
index 4a50f141f08..d31a8b75e2e 100644
--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
@@ -29,8 +29,8 @@
#++
module Bim
- module IFCModels
- class IFCModelsController < BaseController
+ module IfcModels
+ class IfcModelsController < BaseController
helper_method :gon
before_action :find_project_by_project_id, only: %i[index new create show defaults edit update destroy]
@@ -69,7 +69,7 @@ module Bim
.to_h
.reverse_merge(project: @project)
- call = ::IFCModels::CreateService
+ call = ::Bim::IfcModels::CreateService
.new(user: current_user)
.call(combined_params)
@@ -89,7 +89,7 @@ module Bim
.to_h
.reverse_merge(project: @project)
- call = ::IFCModels::UpdateService
+ call = ::Bim::IfcModels::UpdateService
.new(user: current_user, model: @ifc_model)
.call(combined_params)
@@ -120,12 +120,12 @@ module Bim
def permitted_model_params
params
- .require(:ifc_models_ifc_model)
+ .require(:bim_ifc_models_ifc_model)
.permit('title', 'ifc_attachment', 'is_default')
end
def find_ifc_model_object
- @ifc_model = IFCModels::IFCModel.find_by(id: params[:id])
+ @ifc_model = Bim::IfcModels::IfcModel.find_by(id: params[:id])
end
end
end
diff --git a/modules/bim/app/formatters/bim/bcf/api/error_formatter/json.rb b/modules/bim/app/formatters/bim/bcf/api/error_formatter/json.rb
index 4afcc011483..691e9d8a666 100644
--- a/modules/bim/app/formatters/bim/bcf/api/error_formatter/json.rb
+++ b/modules/bim/app/formatters/bim/bcf/api/error_formatter/json.rb
@@ -29,7 +29,7 @@
#++
module Bim::Bcf
- module Api
+ module API
module ErrorFormatter
module Json
extend Grape::ErrorFormatter::Base
diff --git a/modules/bim/app/helpers/bim/bcf_application_helper.rb b/modules/bim/app/helpers/bcf_application_helper.rb
similarity index 85%
rename from modules/bim/app/helpers/bim/bcf_application_helper.rb
rename to modules/bim/app/helpers/bcf_application_helper.rb
index 45c27c937d4..59e6feb9a85 100644
--- a/modules/bim/app/helpers/bim/bcf_application_helper.rb
+++ b/modules/bim/app/helpers/bcf_application_helper.rb
@@ -26,13 +26,11 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim
- module BcfApplicationHelper
- def body_css_classes
- classes = super
- classes = classes + " bcf-#{@project&.module_enabled?(:bcf) ? 'activated' : 'deactivated'}"
+module BcfApplicationHelper
+ def body_css_classes
+ classes = super
+ classes = classes + " bcf-#{@project&.module_enabled?(:bim) ? 'activated' : 'deactivated'}"
- classes
- end
+ classes
end
end
diff --git a/modules/bim/app/helpers/bim/bcf_work_packages_filter_helper.rb b/modules/bim/app/helpers/bcf_work_packages_filter_helper.rb
similarity index 77%
rename from modules/bim/app/helpers/bim/bcf_work_packages_filter_helper.rb
rename to modules/bim/app/helpers/bcf_work_packages_filter_helper.rb
index 599ecb25bac..c17defd0a2d 100644
--- a/modules/bim/app/helpers/bim/bcf_work_packages_filter_helper.rb
+++ b/modules/bim/app/helpers/bcf_work_packages_filter_helper.rb
@@ -28,21 +28,19 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim
- module BcfWorkPackagesFilterHelper
- include WorkPackagesFilterHelper
+module BcfWorkPackagesFilterHelper
+ include WorkPackagesFilterHelper
- def project_work_packages_bcf_issues_path(project)
- query = {
- f: [
- filter_object('status_id', 'o')
- ],
- hi: true,
- hl: 'priority',
- dr: 'card'
- }
+ def project_work_packages_bcf_issues_path(project)
+ query = {
+ f: [
+ filter_object('status_id', 'o')
+ ],
+ hi: true,
+ hl: 'priority',
+ dr: 'card'
+ }
- project_work_packages_with_query_path(project, query)
- end
+ project_work_packages_with_query_path(project, query)
end
end
diff --git a/modules/bim/app/helpers/bim/ifc_models_helper.rb b/modules/bim/app/helpers/bim/ifc_models_helper.rb
deleted file mode 100644
index 4a5c60b6524..00000000000
--- a/modules/bim/app/helpers/bim/ifc_models_helper.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-module Bim
- module IFCModelsHelper
- def provision_gon_for_ifc_model(all_models, models_to_load = [])
- all_converted_models = converted_ifc_models(all_models)
-
- gon.ifc_models = {
- models: gon_ifc_model_models(all_converted_models, models_to_load),
- default_models: gon_ifc_default_models(all_converted_models, models_to_load),
- projects: [{id: @project.identifier, name: @project.name}],
- xkt_attachment_ids: gon_ifc_model_xkt_attachment_ids(all_converted_models),
- metadata_attachment_ids: gon_ifc_model_metadata_attachment_ids(all_converted_models),
- permissions: {
- manage: User.current.allowed_to?(:manage_ifc_models, @project)
- }
- }
- end
-
- def converted_ifc_models(ifc_models)
- ifc_models.select(&:converted?)
- end
-
- def gon_ifc_model_models(all_models, models_to_load)
- all_converted_models = converted_ifc_models(all_models)
-
- all_converted_models.map do |ifc_model|
- {
- id: ifc_model.id,
- name: ifc_model.title,
- saoEnabled: models_to_load.include?(ifc_model)
- }
- end
- end
-
- def gon_ifc_default_models(all_models, models_to_load)
- all_converted_models = converted_ifc_models(all_models)
- default_models = []
-
- all_converted_models.map do |ifc_model|
- default_models << ifc_model.id.to_s if models_to_load.include?(ifc_model)
- end
- default_models
- end
-
- def gon_ifc_model_xkt_attachment_ids(models)
- Hash[models.map { |model| [model.id, model.xkt_attachment.id] }]
- end
-
- def gon_ifc_model_metadata_attachment_ids(models)
- Hash[
- models.map do |model|
- [model.id,
- model.metadata_attachment.id]
- end
- ]
- end
- end
-end
diff --git a/modules/bim/app/helpers/ifc_models_helper.rb b/modules/bim/app/helpers/ifc_models_helper.rb
new file mode 100644
index 00000000000..fba541aa6d3
--- /dev/null
+++ b/modules/bim/app/helpers/ifc_models_helper.rb
@@ -0,0 +1,55 @@
+module IfcModelsHelper
+ def provision_gon_for_ifc_model(all_models, models_to_load = [])
+ all_converted_models = converted_ifc_models(all_models)
+
+ gon.ifc_models = {
+ models: gon_ifc_model_models(all_converted_models, models_to_load),
+ default_models: gon_ifc_default_models(all_converted_models, models_to_load),
+ projects: [{id: @project.identifier, name: @project.name}],
+ xkt_attachment_ids: gon_ifc_model_xkt_attachment_ids(all_converted_models),
+ metadata_attachment_ids: gon_ifc_model_metadata_attachment_ids(all_converted_models),
+ permissions: {
+ manage: User.current.allowed_to?(:manage_ifc_models, @project)
+ }
+ }
+ end
+
+ def converted_ifc_models(ifc_models)
+ ifc_models.select(&:converted?)
+ end
+
+ def gon_ifc_model_models(all_models, models_to_load)
+ all_converted_models = converted_ifc_models(all_models)
+
+ all_converted_models.map do |ifc_model|
+ {
+ id: ifc_model.id,
+ name: ifc_model.title,
+ saoEnabled: models_to_load.include?(ifc_model)
+ }
+ end
+ end
+
+ def gon_ifc_default_models(all_models, models_to_load)
+ all_converted_models = converted_ifc_models(all_models)
+ default_models = []
+
+ all_converted_models.map do |ifc_model|
+ default_models << ifc_model.id.to_s if models_to_load.include?(ifc_model)
+ end
+ default_models
+ end
+
+ def gon_ifc_model_xkt_attachment_ids(models)
+ Hash[models.map { |model| [model.id, model.xkt_attachment.id] }]
+ end
+
+ def gon_ifc_model_metadata_attachment_ids(models)
+ Hash[
+ models.map do |model|
+ [model.id,
+ model.metadata_attachment.id]
+ end
+ ]
+ end
+end
diff --git a/modules/bim/app/models/bim/bcf/comment.rb b/modules/bim/app/models/bim/bcf/comment.rb
index 16c6e7bebb8..9c9bb9cea73 100644
--- a/modules/bim/app/models/bim/bcf/comment.rb
+++ b/modules/bim/app/models/bim/bcf/comment.rb
@@ -1,10 +1,10 @@
-module Bcf
+module Bim::Bcf
class Comment < ActiveRecord::Base
include InitializeWithUuid
belongs_to :journal
- belongs_to :issue, foreign_key: :issue_id, class_name: "Bcf::Issue"
- belongs_to :viewpoint, foreign_key: :viewpoint_id, class_name: "Bcf::Viewpoint", optional: true
+ belongs_to :issue, foreign_key: :issue_id, class_name: "Bim::Bcf::Issue"
+ belongs_to :viewpoint, foreign_key: :viewpoint_id, class_name: "Bim::Bcf::Viewpoint", optional: true
validates_presence_of :uuid
validates_uniqueness_of :uuid, scope: [:issue_id]
diff --git a/modules/bim/app/models/bim/bcf/initialize_with_uuid.rb b/modules/bim/app/models/bim/bcf/initialize_with_uuid.rb
index 2afb49468af..2df5ec0b55e 100644
--- a/modules/bim/app/models/bim/bcf/initialize_with_uuid.rb
+++ b/modules/bim/app/models/bim/bcf/initialize_with_uuid.rb
@@ -1,4 +1,4 @@
-module Bcf
+module Bim::Bcf
##
# Module to set an initial UUID on the model
# whenever it is created
diff --git a/modules/bim/app/models/bim/bcf/issue.rb b/modules/bim/app/models/bim/bcf/issue.rb
index 60be43bc69e..a44434ae82e 100644
--- a/modules/bim/app/models/bim/bcf/issue.rb
+++ b/modules/bim/app/models/bim/bcf/issue.rb
@@ -1,4 +1,4 @@
-module Bcf
+module Bim::Bcf
class Issue < ActiveRecord::Base
include InitializeWithUuid
include ::Concerns::VirtualAttribute
@@ -7,8 +7,8 @@ module Bcf
belongs_to :work_package
has_one :project, through: :work_package
- has_many :viewpoints, foreign_key: :issue_id, class_name: "Bcf::Viewpoint", dependent: :destroy
- has_many :comments, foreign_key: :issue_id, class_name: "Bcf::Comment", dependent: :destroy
+ has_many :viewpoints, foreign_key: :issue_id, class_name: "Bim::Bcf::Viewpoint", dependent: :destroy
+ has_many :comments, foreign_key: :issue_id, class_name: "Bim::Bcf::Comment", dependent: :destroy
after_update :invalidate_markup_cache
diff --git a/modules/bim/app/models/bim/bcf/viewpoint.rb b/modules/bim/app/models/bim/bcf/viewpoint.rb
index 76995f053f1..165625ac1fd 100644
--- a/modules/bim/app/models/bim/bcf/viewpoint.rb
+++ b/modules/bim/app/models/bim/bcf/viewpoint.rb
@@ -1,4 +1,4 @@
-module Bcf
+module Bim::Bcf
class Viewpoint < ActiveRecord::Base
include InitializeWithUuid
@@ -11,8 +11,8 @@ module Bcf
where(uuid: uuid).exists?
end
- belongs_to :issue, foreign_key: :issue_id, class_name: "Bcf::Issue"
- has_many :comments, foreign_key: :viewpoint_id, class_name: "Bcf::Comment"
+ belongs_to :issue, foreign_key: :issue_id, class_name: "Bim::Bcf::Issue"
+ has_many :comments, foreign_key: :viewpoint_id, class_name: "Bim::Bcf::Comment"
delegate :project, :project_id, to: :issue, allow_nil: true
validates :issue, presence: true
diff --git a/modules/bim/app/models/bim/ifc_models/ifc_model.rb b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
index da864fca0fc..cdb30ced64a 100644
--- a/modules/bim/app/models/bim/ifc_models/ifc_model.rb
+++ b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
@@ -1,6 +1,6 @@
module Bim
- module IFCModels
- class IFCModel < ActiveRecord::Base
+ module IfcModels
+ class IfcModel < ActiveRecord::Base
acts_as_attachable delete_permission: :manage_ifc_models, view_permission: :view_ifc_models
belongs_to :project
diff --git a/modules/bim/app/representers/bcf/api/v2_1/auth/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/auth/single_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/auth/single_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/auth/single_representer.rb
index bb65531fe68..6dc9116ab27 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/auth/single_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/auth/single_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Auth::SingleRepresenter < BaseRepresenter
include OpenProject::StaticRouting::UrlHelpers
diff --git a/modules/bim/app/representers/bcf/api/v2_1/base_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/base_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/base_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/base_representer.rb
index 081ec3cda27..36dd5aad0a1 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/base_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/base_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class BaseRepresenter < Roar::Decorator
include Representable::JSON
diff --git a/modules/bim/app/representers/bcf/api/v2_1/errors/error_mapper.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_mapper.rb
similarity index 95%
rename from modules/bim/app/representers/bcf/api/v2_1/errors/error_mapper.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_mapper.rb
index 887ce976dfa..a18cbbbbfa6 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/errors/error_mapper.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_mapper.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Errors
+module Bim::Bcf::API::V2_1::Errors
class ErrorMapper
extend ActiveModel::Naming
extend ActiveModel::Translation
@@ -40,7 +40,7 @@ module Bim::BcfAPI::V2_1::Errors
# In case the error lookups collide, we need to provide
# separate error mappers for every class.
def self.lookup_ancestors
- [::Bcf::Issue, ::Bcf::Viewpoint]
+ [::Bim::Bcf::Issue, ::Bim::Bcf::Viewpoint]
end
def self.map(original_errors)
diff --git a/modules/bim/app/representers/bcf/api/v2_1/errors/error_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_representer.rb
similarity index 97%
rename from modules/bim/app/representers/bcf/api/v2_1/errors/error_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_representer.rb
index 1ec9d419ffa..a14853309ba 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/errors/error_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/errors/error_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1::Errors
+module Bim::Bcf::API::V2_1::Errors
class ErrorRepresenter < BaseRepresenter
property :message,
getter: ->(*) {
diff --git a/modules/bim/app/representers/bcf/api/v2_1/project_extensions/representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/project_extensions/representer.rb
similarity index 99%
rename from modules/bim/app/representers/bcf/api/v2_1/project_extensions/representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/project_extensions/representer.rb
index 4acbbdfcea6..b9b9741038b 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/project_extensions/representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/project_extensions/representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class ProjectExtensions::Representer < BaseRepresenter
property :topic_type,
getter: ->(decorator:, **) {
diff --git a/modules/bim/app/representers/bcf/api/v2_1/projects/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/projects/single_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/projects/single_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/projects/single_representer.rb
index 2fd181ba5a8..ec3f7c48ca0 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/projects/single_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/projects/single_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Projects::SingleRepresenter < BaseRepresenter
property :id,
as: :project_id
diff --git a/modules/bim/app/representers/bcf/api/v2_1/topics/authorization_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/topics/authorization_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/topics/authorization_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/topics/authorization_representer.rb
index 30e9172f685..ab2153dedeb 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/topics/authorization_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/topics/authorization_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Topics::AuthorizationRepresenter < BaseRepresenter
property :topic_actions,
getter: ->(decorator:, **) {
diff --git a/modules/bim/app/representers/bcf/api/v2_1/topics/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/topics/single_representer.rb
similarity index 99%
rename from modules/bim/app/representers/bcf/api/v2_1/topics/single_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/topics/single_representer.rb
index ce3aad2b9db..c35449710f4 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/topics/single_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/topics/single_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Topics::SingleRepresenter < BaseRepresenter
include API::V3::Utilities::PathHelper
diff --git a/modules/bim/app/representers/bcf/api/v2_1/users/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/users/single_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/users/single_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/users/single_representer.rb
index 6df069028ce..edf9d341755 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/users/single_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/users/single_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Users::SingleRepresenter < BaseRepresenter
property :mail,
as: :id
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/base_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/base_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb
index 703c9f98323..08945eecc03 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/base_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Viewpoints::BaseRepresenter < BaseRepresenter
attr_reader :base_scope
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/coloring_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb
similarity index 97%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/coloring_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb
index 310dac54e97..fa607ffc410 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/coloring_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb
@@ -30,7 +30,7 @@
require_relative 'base_representer'
-module Bim::BcfAPI::V2_1::Viewpoints
+module Bim::Bcf::API::V2_1::Viewpoints
class ColoringRepresenter < BaseRepresenter
protected
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/full_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb
similarity index 97%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/full_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb
index 0c4d4398fbe..1b5777aca66 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/full_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb
@@ -29,7 +29,7 @@
#++
require_relative 'base_representer'
-module Bim::BcfAPI::V2_1::Viewpoints
+module Bim::Bcf::API::V2_1::Viewpoints
class FullRepresenter < BaseRepresenter
protected
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/selection_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb
similarity index 97%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/selection_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb
index 2e731e677d4..4e3e2a944f1 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/selection_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb
@@ -30,7 +30,7 @@
require_relative 'base_representer'
-module Bim::BcfAPI::V2_1::Viewpoints
+module Bim::Bcf::API::V2_1::Viewpoints
class SelectionRepresenter < BaseRepresenter
protected
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb
similarity index 98%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/single_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb
index c71ecbed251..9b7ec955298 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/single_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfAPI::V2_1
+module Bim::Bcf::API::V2_1
class Viewpoints::SingleRepresenter < BaseRepresenter
property :lines
diff --git a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/visibility_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb
similarity index 97%
rename from modules/bim/app/representers/bcf/api/v2_1/viewpoints/visibility_representer.rb
rename to modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb
index 9fd67c0d252..b2c40925f2a 100644
--- a/modules/bim/app/representers/bcf/api/v2_1/viewpoints/visibility_representer.rb
+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb
@@ -30,7 +30,7 @@
require_relative 'base_representer'
-module Bim::BcfAPI::V2_1::Viewpoints
+module Bim::Bcf::API::V2_1::Viewpoints
class VisibilityRepresenter < BaseRepresenter
protected
diff --git a/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rb b/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rb
index 189a1e4b7a9..7c348372298 100644
--- a/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rb
+++ b/modules/bim/app/seeders/bim/demo_data/bcf_xml_seeder.rb
@@ -52,7 +52,7 @@ module Bim
}
bcf_xml_file = File.new(File.join(Rails.root, 'modules/bim_seeder/files', filename))
- importer = ::OpenProject::Bcf::BcfXml::Importer.new(bcf_xml_file, project, current_user: user)
+ importer = ::OpenProject::Bim::BcfXml::Importer.new(bcf_xml_file, project, current_user: user)
importer.import!(import_options).flatten
end
end
diff --git a/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb b/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb
index 3a40e505979..b8b2c134f02 100644
--- a/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb
+++ b/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb
@@ -71,7 +71,7 @@ module Bim
end
def create_model_container(project, user, title, default)
- model_container = IFCModels::IFCModel.new
+ model_container = Bim::IfcModels::IfcModel.new
model_container.title = title
model_container.project = project
model_container.uploader = user
diff --git a/modules/bim/app/services/bcf/issues/transform_attributes_service.rb b/modules/bim/app/services/bcf/issues/transform_attributes_service.rb
deleted file mode 100644
index db88a7104bb..00000000000
--- a/modules/bim/app/services/bcf/issues/transform_attributes_service.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-#-- encoding: UTF-8
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2020 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2017 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-module Bim::BcfIssues
- class TransformAttributesService
- def initialize(project)
- self.project = project
- end
-
- def call(attributes)
- ServiceResult.new success: true,
- result: work_package_attributes(attributes)
- end
-
- private
-
- attr_accessor :project
-
- ##
- # BCF issues might have empty titles. OP needs one.
- def title(attributes)
- if attributes[:title]
- attributes[:title]
- elsif attributes[:import_options]
- '(Imported BCF issue contained no title)'
- end
- end
-
- def author(project, attributes)
- find_user_in_project(project, attributes[:author]) || User.system
- end
-
- def assignee(attributes)
- assignee = find_user(attributes[:assignee])
-
- return assignee if assignee.present?
-
- missing_assignee(attributes[:assignee], attributes[:import_options] || {})
- end
-
- ##
- # Try to find the given user by mail in the project
- def find_user(mail)
- project.users.find_by(mail: mail)
- end
-
- def type(attributes)
- type_name = attributes[:type]
- type = project.types.find_by(name: type_name)
-
- return type if type.present?
-
- missing_type(type_name, attributes[:import_options] || {})
- end
-
- ##
- # Handle unknown statuses during import
- def status(attributes)
- status_name = attributes[:status]
- status = ::Status.find_by(name: status_name)
-
- return status if status.present?
-
- missing_status(status_name, attributes[:import_options] || {})
- end
-
- ##
- # Handle unknown priorities during import
- def priority(attributes)
- priority_name = attributes[:priority]
- priority = ::IssuePriority.find_by(name: priority_name)
-
- return priority if priority.present?
-
- missing_priority(priority_name, attributes[:import_options] || {})
- end
-
- ##
- # Get mapped and raw attributes from MarkupExtractor
- # and return all values that are non-nil
- def work_package_attributes(attributes)
- {
- type: type(attributes),
-
- # Native attributes from the extractor
- subject: title(attributes),
- description: attributes[:description],
- due_date: attributes[:due_date],
- start_date: attributes[:start_date],
-
- # Mapped attributes
- assigned_to: assignee(attributes),
- status: status(attributes),
- priority: priority(attributes)
- }.compact
- end
-
- def missing_status(status_name, import_options)
- if import_options[:unknown_statuses_action] == 'use_default'
- ::Status.default
- elsif import_options[:unknown_statuses_action] == 'chose' &&
- import_options[:unknown_statuses_chose_ids].any?
- ::Status.find_by(id: import_options[:unknown_statuses_chose_ids].first)
- elsif status_name
- Status::InexistentStatus.new
- end
- end
-
- def missing_priority(priority_name, import_options)
- if import_options[:unknown_priorities_action] == 'use_default'
- # NOP The 'use_default' case gets already covered by OP.
- elsif import_options[:unknown_priorities_action] == 'chose' &&
- import_options[:unknown_priorities_chose_ids].any?
- ::IssuePriority.find_by(id: import_options[:unknown_priorities_chose_ids].first)
- elsif priority_name
- Priority::InexistentPriority.new
- end
- end
-
- def missing_type(type_name, import_options)
- types = project.types
-
- if import_options[:unknown_types_action] == 'use_default'
- types.default&.first
- elsif import_options[:unknown_types_action] == 'chose' &&
- import_options[:unknown_types_chose_ids].any?
- types.find_by(id: import_options[:unknown_types_chose_ids].first)
- elsif type_name
- Type::InexistentType.new
- end
- end
-
- def missing_assignee(assignee_name, import_options)
- if import_options[:invalid_people_action] != 'anonymize' && assignee_name
- User::InexistentUser.new
- end
- end
- end
-end
diff --git a/modules/bim/app/services/bcf/viewpoints/set_attributes_service.rb b/modules/bim/app/services/bcf/viewpoints/set_attributes_service.rb
deleted file mode 100644
index bc276a68a7c..00000000000
--- a/modules/bim/app/services/bcf/viewpoints/set_attributes_service.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-#-- encoding: UTF-8
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2020 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2017 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-module Bim::BcfViewpoints
- class SetAttributesService < ::BaseServices::SetAttributes
- def set_attributes(params)
- super
-
- set_snapshot
- end
-
- def set_default_attributes(_params)
- model.json_viewpoint['guid'] = model.uuid
- end
-
- def set_snapshot
- return unless snapshot_data_complete? && snapshot_content_type
-
- file = OpenProject::Files
- .create_uploaded_file(name: "snapshot.#{snapshot_extension}",
- content_type: snapshot_content_type,
- content: snapshot_binary_contents,
- binary: true)
-
- # This might break once the service is also used
- # to update existing viewpoints as the snapshot method will
- # delete any existing snapshot right away while the expectation
- # on a SetAttributesService is to not perform persisted changes.
- model.snapshot = file
- end
-
- def snapshot_data_complete?
- model.json_viewpoint['snapshot'] &&
- model.json_viewpoint['snapshot']['snapshot_type'] &&
- model.json_viewpoint['snapshot']['snapshot_data']
- end
-
- def snapshot_content_type
- # Return nil when the extension is not within the specified set
- # which will lead to the snapshot not being created.
- # The contract will catch the error.
- return unless model.json_viewpoint['snapshot']
-
- case model.json_viewpoint['snapshot']['snapshot_type']
- when 'png'
- 'image/png'
- when 'jpg'
- 'image/jpeg'
- end
- end
-
- def snapshot_extension
- model.json_viewpoint['snapshot']['snapshot_type']
- end
-
- def snapshot_binary_contents
- Base64.decode64 model.json_viewpoint['snapshot']['snapshot_data']
- end
- end
-end
diff --git a/modules/bim/app/services/bcf/api/v2_1/parse_resource_params_service.rb b/modules/bim/app/services/bim/bcf/api/v2_1/parse_resource_params_service.rb
similarity index 98%
rename from modules/bim/app/services/bcf/api/v2_1/parse_resource_params_service.rb
rename to modules/bim/app/services/bim/bcf/api/v2_1/parse_resource_params_service.rb
index 72dcd2d3d12..7ab6fc575f9 100644
--- a/modules/bim/app/services/bcf/api/v2_1/parse_resource_params_service.rb
+++ b/modules/bim/app/services/bim/bcf/api/v2_1/parse_resource_params_service.rb
@@ -26,7 +26,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bcf
+module Bim::Bcf
module API
module V2_1
class ParseResourceParamsService < ::API::ParseResourceParamsService
diff --git a/modules/bim/app/services/bcf/issues/create_service.rb b/modules/bim/app/services/bim/bcf/issues/create_service.rb
similarity index 73%
rename from modules/bim/app/services/bcf/issues/create_service.rb
rename to modules/bim/app/services/bim/bcf/issues/create_service.rb
index 941eee9a034..fd47148fc0d 100644
--- a/modules/bim/app/services/bcf/issues/create_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/create_service.rb
@@ -28,23 +28,25 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfIssues
- class CreateService < ::BaseServices::Create
- private
+module Bim::Bcf
+ module Issues
+ class CreateService < ::BaseServices::Create
+ private
- def before_perform(params)
- wp_call = WorkPackages::CreateService
- .new(user: user)
- .call(params)
+ def before_perform(params)
+ wp_call = WorkPackages::CreateService
+ .new(user: user)
+ .call(params)
- if wp_call.success?
- issue_params = {
- work_package: wp_call.result
- }.merge(params.slice(*Bcf::Issue::SETTABLE_ATTRIBUTES))
+ if wp_call.success?
+ issue_params = {
+ work_package: wp_call.result
+ }.merge(params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES))
- super(issue_params)
- else
- wp_call
+ super(issue_params)
+ else
+ wp_call
+ end
end
end
end
diff --git a/modules/bim/app/services/bcf/issues/delete_service.rb b/modules/bim/app/services/bim/bcf/issues/delete_service.rb
similarity index 69%
rename from modules/bim/app/services/bcf/issues/delete_service.rb
rename to modules/bim/app/services/bim/bcf/issues/delete_service.rb
index ff23b0a706c..d3eb727a059 100644
--- a/modules/bim/app/services/bcf/issues/delete_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/delete_service.rb
@@ -28,26 +28,28 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfIssues
- class DeleteService < ::BaseServices::Delete
- private
+module Bim::Bcf
+ module Issues
+ class DeleteService < ::BaseServices::Delete
+ private
- def before_perform(params)
- associated_wp = WorkPackage.find(model.work_package_id)
- # Load the project association as AR fails do do so once the work package
- # is destroyed.
- model.project
+ def before_perform(params)
+ associated_wp = WorkPackage.find(model.work_package_id)
+ # Load the project association as AR fails do do so once the work package
+ # is destroyed.
+ model.project
- wp_call = WorkPackages::DeleteService
- .new(user: user,
- model: associated_wp.reload)
- .call(params)
+ wp_call = WorkPackages::DeleteService
+ .new(user: user,
+ model: associated_wp.reload)
+ .call(params)
- if wp_call.success?
- super(params)
- else
- wp_call
+ if wp_call.success?
+ super(params)
+ else
+ wp_call
+ end
end
end
end
-end
+end
\ No newline at end of file
diff --git a/modules/bim/app/services/bcf/issues/set_attributes_service.rb b/modules/bim/app/services/bim/bcf/issues/set_attributes_service.rb
similarity index 92%
rename from modules/bim/app/services/bcf/issues/set_attributes_service.rb
rename to modules/bim/app/services/bim/bcf/issues/set_attributes_service.rb
index 8e95fb29579..2d15eb7d65b 100644
--- a/modules/bim/app/services/bcf/issues/set_attributes_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/set_attributes_service.rb
@@ -28,7 +28,9 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfIssues
- class SetAttributesService < ::BaseServices::SetAttributes
+module Bim::Bcf
+ module Issues
+ class SetAttributesService < ::BaseServices::SetAttributes
+ end
end
end
diff --git a/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb b/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
new file mode 100644
index 00000000000..77e6fd5e8cb
--- /dev/null
+++ b/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
@@ -0,0 +1,168 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+module Bim::Bcf
+ module Issues
+ class TransformAttributesService
+ def initialize(project)
+ self.project = project
+ end
+
+ def call(attributes)
+ ServiceResult.new success: true,
+ result: work_package_attributes(attributes)
+ end
+
+ private
+
+ attr_accessor :project
+
+ ##
+ # BCF issues might have empty titles. OP needs one.
+ def title(attributes)
+ if attributes[:title]
+ attributes[:title]
+ elsif attributes[:import_options]
+ '(Imported BCF issue contained no title)'
+ end
+ end
+
+ def author(project, attributes)
+ find_user_in_project(project, attributes[:author]) || User.system
+ end
+
+ def assignee(attributes)
+ assignee = find_user(attributes[:assignee])
+
+ return assignee if assignee.present?
+
+ missing_assignee(attributes[:assignee], attributes[:import_options] || {})
+ end
+
+ ##
+ # Try to find the given user by mail in the project
+ def find_user(mail)
+ project.users.find_by(mail: mail)
+ end
+
+ def type(attributes)
+ type_name = attributes[:type]
+ type = project.types.find_by(name: type_name)
+
+ return type if type.present?
+
+ missing_type(type_name, attributes[:import_options] || {})
+ end
+
+ ##
+ # Handle unknown statuses during import
+ def status(attributes)
+ status_name = attributes[:status]
+ status = ::Status.find_by(name: status_name)
+
+ return status if status.present?
+
+ missing_status(status_name, attributes[:import_options] || {})
+ end
+
+ ##
+ # Handle unknown priorities during import
+ def priority(attributes)
+ priority_name = attributes[:priority]
+ priority = ::IssuePriority.find_by(name: priority_name)
+
+ return priority if priority.present?
+
+ missing_priority(priority_name, attributes[:import_options] || {})
+ end
+
+ ##
+ # Get mapped and raw attributes from MarkupExtractor
+ # and return all values that are non-nil
+ def work_package_attributes(attributes)
+ {
+ type: type(attributes),
+
+ # Native attributes from the extractor
+ subject: title(attributes),
+ description: attributes[:description],
+ due_date: attributes[:due_date],
+ start_date: attributes[:start_date],
+
+ # Mapped attributes
+ assigned_to: assignee(attributes),
+ status: status(attributes),
+ priority: priority(attributes)
+ }.compact
+ end
+
+ def missing_status(status_name, import_options)
+ if import_options[:unknown_statuses_action] == 'use_default'
+ ::Status.default
+ elsif import_options[:unknown_statuses_action] == 'chose' &&
+ import_options[:unknown_statuses_chose_ids].any?
+ ::Status.find_by(id: import_options[:unknown_statuses_chose_ids].first)
+ elsif status_name
+ Status::InexistentStatus.new
+ end
+ end
+
+ def missing_priority(priority_name, import_options)
+ if import_options[:unknown_priorities_action] == 'use_default'
+ # NOP The 'use_default' case gets already covered by OP.
+ elsif import_options[:unknown_priorities_action] == 'chose' &&
+ import_options[:unknown_priorities_chose_ids].any?
+ ::IssuePriority.find_by(id: import_options[:unknown_priorities_chose_ids].first)
+ elsif priority_name
+ Priority::InexistentPriority.new
+ end
+ end
+
+ def missing_type(type_name, import_options)
+ types = project.types
+
+ if import_options[:unknown_types_action] == 'use_default'
+ types.default&.first
+ elsif import_options[:unknown_types_action] == 'chose' &&
+ import_options[:unknown_types_chose_ids].any?
+ types.find_by(id: import_options[:unknown_types_chose_ids].first)
+ elsif type_name
+ Type::InexistentType.new
+ end
+ end
+
+ def missing_assignee(assignee_name, import_options)
+ if import_options[:invalid_people_action] != 'anonymize' && assignee_name
+ User::InexistentUser.new
+ end
+ end
+ end
+ end
+end
diff --git a/modules/bim/app/services/bcf/issues/update_service.rb b/modules/bim/app/services/bim/bcf/issues/update_service.rb
similarity index 71%
rename from modules/bim/app/services/bcf/issues/update_service.rb
rename to modules/bim/app/services/bim/bcf/issues/update_service.rb
index 816cd073e4f..3467ad28261 100644
--- a/modules/bim/app/services/bcf/issues/update_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/update_service.rb
@@ -28,23 +28,25 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfIssues
- class UpdateService < ::BaseServices::Update
- private
+module Bim::Bcf
+ module Issues
+ class UpdateService < ::BaseServices::Update
+ private
- def before_perform(params)
- wp_call = ::WorkPackages::UpdateService
- .new(model: model.work_package,
- user: user,
- contract_class: Bcf::WorkPackages::UpdateContract)
- .call(params)
+ def before_perform(params)
+ wp_call = ::WorkPackages::UpdateService
+ .new(model: model.work_package,
+ user: user,
+ contract_class: Bcf::WorkPackages::UpdateContract)
+ .call(params)
- if wp_call.success?
- issue_params = params.slice(*Bcf::Issue::SETTABLE_ATTRIBUTES)
+ if wp_call.success?
+ issue_params = params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES)
- super(issue_params)
- else
- wp_call
+ super(issue_params)
+ else
+ wp_call
+ end
end
end
end
diff --git a/modules/bim/app/services/bcf/viewpoints/create_service.rb b/modules/bim/app/services/bim/bcf/viewpoints/create_service.rb
similarity index 93%
rename from modules/bim/app/services/bcf/viewpoints/create_service.rb
rename to modules/bim/app/services/bim/bcf/viewpoints/create_service.rb
index 303d071e101..9e676ae54e9 100644
--- a/modules/bim/app/services/bcf/viewpoints/create_service.rb
+++ b/modules/bim/app/services/bim/bcf/viewpoints/create_service.rb
@@ -28,7 +28,9 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfViewpoints
- class CreateService < ::BaseServices::Create
+module Bim::Bcf
+ module Viewpoints
+ class CreateService < ::BaseServices::Create
+ end
end
end
diff --git a/modules/bim/app/services/bcf/viewpoints/delete_service.rb b/modules/bim/app/services/bim/bcf/viewpoints/delete_service.rb
similarity index 92%
rename from modules/bim/app/services/bcf/viewpoints/delete_service.rb
rename to modules/bim/app/services/bim/bcf/viewpoints/delete_service.rb
index 3e8d9649f83..2d6deb4c188 100644
--- a/modules/bim/app/services/bcf/viewpoints/delete_service.rb
+++ b/modules/bim/app/services/bim/bcf/viewpoints/delete_service.rb
@@ -28,7 +28,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
-module Bim::BcfViewpoints
- class DeleteService < ::BaseServices::Delete
+module Bim::Bcf
+ module Viewpoints
+ class DeleteService < ::BaseServices::Delete
+ end
end
end
diff --git a/modules/bim/app/services/bim/bcf/viewpoints/set_attributes_service.rb b/modules/bim/app/services/bim/bcf/viewpoints/set_attributes_service.rb
new file mode 100644
index 00000000000..72e2221834f
--- /dev/null
+++ b/modules/bim/app/services/bim/bcf/viewpoints/set_attributes_service.rb
@@ -0,0 +1,89 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+module Bim::Bcf
+ module Viewpoints
+ class SetAttributesService < ::BaseServices::SetAttributes
+ def set_attributes(params)
+ super
+
+ set_snapshot
+ end
+
+ def set_default_attributes(_params)
+ model.json_viewpoint['guid'] = model.uuid
+ end
+
+ def set_snapshot
+ return unless snapshot_data_complete? && snapshot_content_type
+
+ file = OpenProject::Files
+ .create_uploaded_file(name: "snapshot.#{snapshot_extension}",
+ content_type: snapshot_content_type,
+ content: snapshot_binary_contents,
+ binary: true)
+
+ # This might break once the service is also used
+ # to update existing viewpoints as the snapshot method will
+ # delete any existing snapshot right away while the expectation
+ # on a SetAttributesService is to not perform persisted changes.
+ model.snapshot = file
+ end
+
+ def snapshot_data_complete?
+ model.json_viewpoint['snapshot'] &&
+ model.json_viewpoint['snapshot']['snapshot_type'] &&
+ model.json_viewpoint['snapshot']['snapshot_data']
+ end
+
+ def snapshot_content_type
+ # Return nil when the extension is not within the specified set
+ # which will lead to the snapshot not being created.
+ # The contract will catch the error.
+ return unless model.json_viewpoint['snapshot']
+
+ case model.json_viewpoint['snapshot']['snapshot_type']
+ when 'png'
+ 'image/png'
+ when 'jpg'
+ 'image/jpeg'
+ end
+ end
+
+ def snapshot_extension
+ model.json_viewpoint['snapshot']['snapshot_type']
+ end
+
+ def snapshot_binary_contents
+ Base64.decode64 model.json_viewpoint['snapshot']['snapshot_data']
+ end
+ end
+ end
+end
diff --git a/modules/bim/app/services/ifc_models/create_service.rb b/modules/bim/app/services/bim/ifc_models/create_service.rb
similarity index 92%
rename from modules/bim/app/services/ifc_models/create_service.rb
rename to modules/bim/app/services/bim/ifc_models/create_service.rb
index 1c319c2b2b7..ca4c0232030 100644
--- a/modules/bim/app/services/ifc_models/create_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/create_service.rb
@@ -27,20 +27,20 @@
#+
module Bim
- module IFCModels
+ module IfcModels
class CreateService < ::BaseServices::Create
protected
def after_perform(call)
if call.success?
- IFCConversionJob.perform_later(call.result)
+ IfcConversionJob.perform_later(call.result)
end
call
end
def instance(_params)
- ::IFCModels::IFCModel.new
+ ::Bim::IfcModels::IfcModel.new
end
end
end
diff --git a/modules/bim/app/services/ifc_models/set_attributes_service.rb b/modules/bim/app/services/bim/ifc_models/set_attributes_service.rb
similarity index 99%
rename from modules/bim/app/services/ifc_models/set_attributes_service.rb
rename to modules/bim/app/services/bim/ifc_models/set_attributes_service.rb
index ac4f9a05685..2f65b6d1d57 100644
--- a/modules/bim/app/services/ifc_models/set_attributes_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/set_attributes_service.rb
@@ -29,7 +29,7 @@
#++
module Bim
- module IFCModels
+ module IfcModels
class SetAttributesService < ::BaseServices::SetAttributes
protected
diff --git a/modules/bim/app/services/ifc_models/update_service.rb b/modules/bim/app/services/bim/ifc_models/update_service.rb
similarity index 96%
rename from modules/bim/app/services/ifc_models/update_service.rb
rename to modules/bim/app/services/bim/ifc_models/update_service.rb
index 03360b98625..d3f66fed662 100644
--- a/modules/bim/app/services/ifc_models/update_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/update_service.rb
@@ -27,7 +27,7 @@
#+
module Bim
- module IFCModels
+ module IfcModels
class UpdateService < ::BaseServices::Update
protected
@@ -44,7 +44,7 @@ module Bim
model.attachments.select(&:marked_for_destruction?).each(&:destroy)
if @ifc_attachment_replaced
- IFCConversionJob.perform_later(call.result)
+ IfcConversionJob.perform_later(call.result)
end
end
diff --git a/modules/bim/app/services/ifc_models/view_converter_service.rb b/modules/bim/app/services/bim/ifc_models/view_converter_service.rb
similarity index 99%
rename from modules/bim/app/services/ifc_models/view_converter_service.rb
rename to modules/bim/app/services/bim/ifc_models/view_converter_service.rb
index 3af5786af63..321634581d5 100644
--- a/modules/bim/app/services/ifc_models/view_converter_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/view_converter_service.rb
@@ -28,7 +28,7 @@
require 'open3'
module Bim
- module IFCModels
+ module IfcModels
class ViewConverterService
attr_reader :ifc_model, :errors
diff --git a/modules/bim/app/views/bim/ifc_models/_form.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/_form.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/_no_default_notice.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_no_default_notice.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/_no_default_notice.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/_no_default_notice.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/_panels.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/_panels.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/_show_headers.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_show_headers.html.erb
similarity index 72%
rename from modules/bim/app/views/bim/ifc_models/_show_headers.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/_show_headers.html.erb
index f5b7aa5a065..d0d864696dc 100644
--- a/modules/bim/app/views/bim/ifc_models/_show_headers.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/_show_headers.html.erb
@@ -1,5 +1,5 @@
<% content_for :header_tags do %>
- <%= stylesheet_link_tag "ifc_viewer/generic", media: 'all' %>
+ <%= stylesheet_link_tag "bim/ifc_viewer/generic", media: 'all' %>
<% provision_gon_for_ifc_model(all_models, selected_models) %>
<%= include_gon(nonce: content_security_policy_script_nonce) %>
<% end %>
diff --git a/modules/bim/app/views/bim/ifc_models/_unconverted_notice.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_unconverted_notice.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/_unconverted_notice.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/_unconverted_notice.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/defaults.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/defaults.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/defaults.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/defaults.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/edit.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
similarity index 96%
rename from modules/bim/app/views/bim/ifc_models/edit.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
index 4901c91bfd6..2cd4e863006 100644
--- a/modules/bim/app/views/bim/ifc_models/edit.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/edit.html.erb
@@ -30,7 +30,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
-<%= toolbar title: IFCModels::IFCModel.model_name.human %>
+<%= toolbar title: IfcModels::IfcModel.model_name.human %>
<%= labelled_tabular_form_for @ifc_model, url: ifc_models_project_ifc_model_path(@project, @ifc_model), method: 'PATCH' do |f| -%>
<%= error_messages_for_contract @ifc_model, @errors %>
diff --git a/modules/bim/app/views/bim/ifc_models/index.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
similarity index 94%
rename from modules/bim/app/views/bim/ifc_models/index.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
index 9b7affc6426..eafa0da2cc6 100644
--- a/modules/bim/app/views/bim/ifc_models/index.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb
@@ -36,7 +36,7 @@ See docs/COPYRIGHT.rdoc for more details.
aria: { label: t(:'ifc_models.label_new_ifc_model') },
title: t(:'ifc_models.label_new_ifc_model') } do %>
<%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= ::IFCModels::IFCModel.model_name.human %></span>
+ <span class="button--text"><%= ::Bim::IfcModels::IfcModel.model_name.human %></span>
<% end %>
</li>
<% end %>
@@ -57,4 +57,4 @@ See docs/COPYRIGHT.rdoc for more details.
<%= render partial: 'no_default_notice', locals: { project: @project } %>
<% end %>
-<%= cell ::IFCModels::Models::TableCell, @ifc_models %>
+<%= cell ::Bim::IfcModels::TableCell, @ifc_models %>
diff --git a/modules/bim/app/views/bim/ifc_models/new.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/new.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/new.html.erb
diff --git a/modules/bim/app/views/bim/ifc_models/show.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/show.html.erb
similarity index 100%
rename from modules/bim/app/views/bim/ifc_models/show.html.erb
rename to modules/bim/app/views/bim/ifc_models/ifc_models/show.html.erb
diff --git a/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb b/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
index c478eff237c..c983bb63793 100644
--- a/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
+++ b/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
@@ -1,6 +1,6 @@
module Bim
- module IFCModels
- class IFCConversionJob < ::ApplicationJob
+ module IfcModels
+ class IfcConversionJob < ::ApplicationJob
queue_as :ifc_conversion
##
diff --git a/modules/bim/config/locales/en.yml b/modules/bim/config/locales/en.yml
index b958ab0ef75..e0ccb135022 100644
--- a/modules/bim/config/locales/en.yml
+++ b/modules/bim/config/locales/en.yml
@@ -76,8 +76,10 @@ en:
bcf_v2_1_text: "Application will receive full read & write access to the OpenProject BCF API v2.1 to perform actions on your behalf."
activerecord:
+ models:
+ bim/ifc_models/ifc_model: "IFC model"
attributes:
- ifc_models/ifc_model:
+ bim/ifc_models/ifc_model:
ifc_attachment: "IFC file"
is_default: "Default model"
attachments: "IFC file"
diff --git a/modules/bim/config/routes.rb b/modules/bim/config/routes.rb
index 9f665ee6b85..10dabeb038e 100644
--- a/modules/bim/config/routes.rb
+++ b/modules/bim/config/routes.rb
@@ -28,25 +28,25 @@
OpenProject::Application.routes.draw do
scope '', as: 'bcf' do
- mount Bcf::API::Root => '/api/bcf'
+ mount ::Bim::Bcf::API::Root => '/api/bcf'
scope 'projects/:project_id', as: 'project' do
- resources :issues, controller: 'bcf/issues' do
+ resources :issues, controller: 'bim/bcf/issues' do
get :upload, action: :upload, on: :collection
post :prepare_import, action: :prepare_import, on: :collection
post :configure_import, action: :configure_import, on: :collection
post :import, action: :perform_import, on: :collection
end
- get 'bcf_issues', to: 'bcf/issues#redirect_to_bcf_issues_list', as: :work_packages
+ get 'bcf_issues', to: 'bim/bcf/issues#redirect_to_bcf_issues_list', as: :work_packages
end
end
scope '', as: 'ifc_models' do
scope 'projects/:project_id', as: 'project' do
- resources :ifc_models, except: [:show], controller: 'ifc_models/ifc_models' do
+ resources :ifc_models, except: [:show], controller: 'bim/ifc_models/ifc_models' do
collection do
- get 'defaults(/*state)', action: :defaults
+ get 'defaults(/*state)', action: :defaults, as: 'defaults'
get 'list(/*state)', action: :defaults
end
diff --git a/modules/bim/db/migrate/20190823090211_remove_project_id_from_bcf_issue.rb b/modules/bim/db/migrate/20190823090211_remove_project_id_from_bcf_issue.rb
index 38ceb9e6c02..f23482504e5 100644
--- a/modules/bim/db/migrate/20190823090211_remove_project_id_from_bcf_issue.rb
+++ b/modules/bim/db/migrate/20190823090211_remove_project_id_from_bcf_issue.rb
@@ -6,7 +6,7 @@ class RemoveProjectIdFromBcfIssue < ActiveRecord::Migration[5.1]
def down
add_reference :bcf_issues, :project, foreign_key: { on_delete: :cascade }, index: true
- Bcf::Issue.includes(:work_package).find_each do |bcf_issue|
+ Bim::Bcf::Issue.includes(:work_package).find_each do |bcf_issue|
if bcf_issue.work_package
bcf_issue.project_id = bcf_issue.work_package.project_id
bcf_issue.save
diff --git a/modules/bim/db/migrate/20191029155327_add_ifc_models_plugin.rb b/modules/bim/db/migrate/20191029155327_add_ifc_models_plugin.rb
index bd19ddfecd4..15b8a40bef6 100644
--- a/modules/bim/db/migrate/20191029155327_add_ifc_models_plugin.rb
+++ b/modules/bim/db/migrate/20191029155327_add_ifc_models_plugin.rb
@@ -1,4 +1,4 @@
-class AddIFCModelsPlugin < ActiveRecord::Migration[5.1]
+class AddIfcModelsPlugin < ActiveRecord::Migration[5.1]
def change
create_table :ifc_models do |t|
t.string :title
diff --git a/modules/bim/db/migrate/20191114090353_add_is_default_to_ifc_models.rb b/modules/bim/db/migrate/20191114090353_add_is_default_to_ifc_models.rb
index e9aefeed8f7..571d383101c 100644
--- a/modules/bim/db/migrate/20191114090353_add_is_default_to_ifc_models.rb
+++ b/modules/bim/db/migrate/20191114090353_add_is_default_to_ifc_models.rb
@@ -1,4 +1,4 @@
-class AddIsDefaultToIFCModels < ActiveRecord::Migration[5.1]
+class AddIsDefaultToIfcModels < ActiveRecord::Migration[5.1]
def change
add_column :ifc_models, :is_default, :boolean, default: false, null: false
diff --git a/modules/bim/db/migrate/20191121140202_migrate_xml_viewpoint_to_json.rb b/modules/bim/db/migrate/20191121140202_migrate_xml_viewpoint_to_json.rb
index 8f8fc3e00a7..f0438abb340 100644
--- a/modules/bim/db/migrate/20191121140202_migrate_xml_viewpoint_to_json.rb
+++ b/modules/bim/db/migrate/20191121140202_migrate_xml_viewpoint_to_json.rb
@@ -6,9 +6,9 @@ class MigrateXmlViewpointToJson < ActiveRecord::Migration[6.0]
end
# Convert viewpoints
- ::Bcf::Viewpoint.reset_column_information
- ::Bcf::Viewpoint.find_each do |resource|
- mapper = ::OpenProject::Bcf::BcfJson::ViewpointReader
+ ::Bim::Bcf::Viewpoint.reset_column_information
+ ::Bim::Bcf::Viewpoint.find_each do |resource|
+ mapper = ::OpenProject::Bim::BcfJson::ViewpointReader
.new(resource.uuid, resource.viewpoint)
resource.update_column(:json_viewpoint, mapper.result)
diff --git a/modules/bim/lib/api/bim/bcf_xml/v1/bcf_xml_api.rb b/modules/bim/lib/api/bim/bcf_xml/v1/bcf_xml_api.rb
index 625b87c88fb..6e00840cca9 100644
--- a/modules/bim/lib/api/bim/bcf_xml/v1/bcf_xml_api.rb
+++ b/modules/bim/lib/api/bim/bcf_xml/v1/bcf_xml_api.rb
@@ -70,7 +70,7 @@ module API
query = Query.new_default(name: '_', project: project)
updated_query = ::API::V3::UpdateQueryFromV3ParamsService.new(query, User.current).call(params)
- exporter = ::OpenProject::Bcf::BcfXml::Exporter.new(updated_query.result)
+ exporter = ::OpenProject::Bim::BcfXml::Exporter.new(updated_query.result)
header['Content-Disposition'] = "attachment; filename=\"#{exporter.bcf_filename}\""
env['api.format'] = :binary
exporter.list_from_api.read
@@ -85,7 +85,7 @@ module API
begin
file = params[:bcf_xml_file][:tempfile]
- importer = ::OpenProject::Bcf::BcfXml::Importer.new(file,
+ importer = ::OpenProject::Bim::BcfXml::Importer.new(file,
project,
current_user: User.current)
importer.import!(import_options)
diff --git a/modules/bim/lib/open_project/bim/bcf_issue_associated_filter.rb b/modules/bim/lib/open_project/bim/bcf_issue_associated_filter.rb
index 92983922a88..2046b54b26a 100644
--- a/modules/bim/lib/open_project/bim/bcf_issue_associated_filter.rb
+++ b/modules/bim/lib/open_project/bim/bcf_issue_associated_filter.rb
@@ -45,9 +45,9 @@ module ::OpenProject::Bim
def where
if associated?
- ::Queries::Operators::All.sql_for_field(values, ::Bcf::Issue.table_name, 'id')
+ ::Queries::Operators::All.sql_for_field(values, ::Bim::Bcf::Issue.table_name, 'id')
elsif not_associated?
- ::Queries::Operators::None.sql_for_field(values, ::Bcf::Issue.table_name, 'id')
+ ::Queries::Operators::None.sql_for_field(values, ::Bim::Bcf::Issue.table_name, 'id')
else
raise 'Unsupported operator or value'
end
diff --git a/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb b/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
index 89ba7ba79f2..a45cc8886c9 100644
--- a/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
+++ b/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
@@ -1,6 +1,6 @@
require 'bigdecimal'
-module OpenProject::Bcf
+module OpenProject::Bim
module BcfJson
class ViewpointReader
ROOT_NODE ||= 'VisualizationInfo'.freeze
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb b/modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb
index 28090a1792a..bdbca3286c4 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb
@@ -1,4 +1,4 @@
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class Aggregations
attr_reader :listings, :project, :instance_cache
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/base_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/base_writer.rb
index ad86e1885ab..3548cf02f17 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/base_writer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/base_writer.rb
@@ -1,6 +1,6 @@
##
# Creates or updates a BCF issue and markup from a work package
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class BaseWriter
attr_reader :markup_doc
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb b/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
index 630ce25ae4d..460b4ee700d 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
@@ -1,6 +1,6 @@
require 'fileutils'
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class Exporter < ::WorkPackage::Exporter::Base
include Redmine::I18n
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/file_entry.rb b/modules/bim/lib/open_project/bim/bcf_xml/file_entry.rb
index 5f17f9f53c4..7e0d77ea7b0 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/file_entry.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/file_entry.rb
@@ -1,6 +1,6 @@
##
# Helper class to provide uploads from IO streams.
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class FileEntry < StringIO
def initialize(stream, filename:)
super(stream.read)
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/importer.rb b/modules/bim/lib/open_project/bim/bcf_xml/importer.rb
index f96d785436b..65728c1cad4 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/importer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/importer.rb
@@ -2,7 +2,7 @@ require 'activerecord-import'
require_relative 'issue_reader'
require_relative 'aggregations'
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class Importer
attr_reader :file, :project, :current_user
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
index e5120f7d70c..82c0a25ae8d 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
@@ -4,7 +4,7 @@
# this should be turned into a representable/xml decorator
require_relative 'file_entry'
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class IssueReader
attr_reader :zip, :entry, :issue, :extractor, :project, :user, :import_options
attr_accessor :wp_last_updated_at, :is_update
@@ -92,7 +92,7 @@ module OpenProject::Bcf::BcfXml
## Get mapped and raw attributes from MarkupExtractor
## and return all values that are non-nil
def work_package_attributes
- attributes = ::Bcf::Issues::TransformAttributesService
+ attributes = ::Bim::Bcf::Issues::TransformAttributesService
.new(project)
.call(extractor_attributes.merge(import_options: import_options))
.result
@@ -200,11 +200,11 @@ module OpenProject::Bcf::BcfXml
##
# Find existing issue or create new
def find_or_initialize_issue
- ::Bcf::Issue
+ ::Bim::Bcf::Issue
.joins(:work_package)
.where(uuid: topic_uuid, 'work_packages.project_id': @project.id)
.references(:work_package).first ||
- ::Bcf::Issue.new(uuid: topic_uuid)
+ ::Bim::Bcf::Issue.new(uuid: topic_uuid)
end
##
@@ -233,7 +233,7 @@ module OpenProject::Bcf::BcfXml
##
# Map the xml viewpoint as json
def viewpoint_as_json(uuid, xml)
- ::OpenProject::Bcf::BcfJson::ViewpointReader
+ ::OpenProject::Bim::BcfJson::ViewpointReader
.new(uuid, xml)
.result
end
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
index 0da31e0bf5c..479903d3eb8 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
@@ -1,6 +1,6 @@
##
# Creates or updates a BCF issue and markup from a work package
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class IssueWriter < BaseWriter
attr_reader :work_package, :issue, :markup_doc, :markup_node
@@ -231,7 +231,7 @@ module OpenProject::Bcf::BcfXml
##
# Find existing issue or create new
def find_or_initialize_issue
- ::Bcf::Issue.find_or_initialize_by(work_package: work_package)
+ ::Bim::Bcf::Issue.find_or_initialize_by(work_package: work_package)
end
end
end
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb b/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb
index 26801fd2402..03364a9a77f 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb
@@ -3,7 +3,7 @@
# manually. If we want to extract the entire markup,
# this should be turned into a representable/xml decorator
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class MarkupExtractor
attr_reader :entry
attr_accessor :markup, :doc
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
index d0a3b0ab634..4d734da22eb 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
@@ -1,6 +1,6 @@
##
# Creates or updates a BCF issue and markup from a work package
-module OpenProject::Bcf::BcfXml
+module OpenProject::Bim::BcfXml
class ViewpointWriter < BaseWriter
attr_reader :viewpoint
diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rb
index d6d4847a7e6..5bc5cabfb28 100644
--- a/modules/bim/lib/open_project/bim/engine.rb
+++ b/modules/bim/lib/open_project/bim/engine.rb
@@ -44,16 +44,16 @@ module OpenProject::Bim
} do
project_module :bim do
permission :view_ifc_models,
- { 'bim/ifc_models/ifc_models': %i[index show defaults] }
+ {'bim/ifc_models/ifc_models': %i[index show defaults]}
permission :manage_ifc_models,
- { 'bim/ifc_models/ifc_models': %i[index show destroy edit update create new] },
+ {'bim/ifc_models/ifc_models': %i[index show destroy edit update create new]},
dependencies: %i[view_ifc_models]
permission :view_linked_issues,
- { 'bim/bcf/issues': %i[index] },
+ {'bim/bcf/issues': %i[index]},
dependencies: %i[view_work_packages]
permission :manage_bcf,
- { 'bim/bcf/issues': %i[index upload prepare_import configure_import perform_import] },
+ {'bim/bcf/issues': %i[index upload prepare_import configure_import perform_import]},
dependencies: %i[view_linked_issues
view_work_packages
add_work_packages
@@ -65,7 +65,7 @@ module OpenProject::Bim
::Redmine::MenuManager.map(:project_menu) do |menu|
menu.push(:ifc_models,
- { controller: '/bim/ifc_models/ifc_models', action: 'defaults' },
+ {controller: '/bim/ifc_models/ifc_models', action: 'defaults'},
caption: :'bim.label_bim',
param: :project_id,
after: :work_packages,
@@ -73,7 +73,7 @@ module OpenProject::Bim
badge: :label_new)
menu.push :ifc_viewer_panels,
- { controller: '/bim/ifc_models/ifc_models', action: 'defaults' },
+ {controller: '/bim/ifc_models/ifc_models', action: 'defaults'},
param: :project_id,
parent: :ifc_models,
partial: '/bim/ifc_models/ifc_models/panels'
@@ -83,7 +83,7 @@ module OpenProject::Bim
assets %w(bim/bcf.css bim/ifc_viewer/generic.css)
- patches %i[WorkPackage Type Journal RootSeeder]
+ patches %i[WorkPackage Type Journal RootSeeder Project]
patch_with_namespace :BasicData, :SettingSeeder
patch_with_namespace :BasicData, :RoleSeeder
@@ -158,7 +158,11 @@ module OpenProject::Bim
end
config.to_prepare do
- require 'open_project/ifc_models/hooks'
+ require_relative 'hooks'
+
+ # The DesignPatch is not a typical method patch, as it replaces a constant and thus needs to be applied without the
+ # standard patch logic for plugins.
+ require_relative "patches/design_patch"
end
initializer 'bim.bcf.register_hooks' do
@@ -186,16 +190,16 @@ module OpenProject::Bim
config.to_prepare do
::WorkPackage::Exporter
- .register_for_list(:bcf, OpenProject::Bcf::BcfXml::Exporter)
+ .register_for_list(:bcf, OpenProject::Bim::BcfXml::Exporter)
- ::Queries::Register.filter ::Query, OpenProject::Bcf::BcfIssueAssociatedFilter
- ::Queries::Register.column ::Query, OpenProject::Bcf::QueryBcfThumbnailColumn
+ ::Queries::Register.filter ::Query, OpenProject::Bim::BcfIssueAssociatedFilter
+ ::Queries::Register.column ::Query, OpenProject::Bim::QueryBcfThumbnailColumn
::API::Root.class_eval do
content_type :binary, 'application/octet-stream'
default_format :binary
version 'v1', using: :path do
- mount ::API::BcfXml::V1::BcfXmlAPI
+ mount ::API::Bim::BcfXml::V1::BcfXmlAPI
end
end
end
diff --git a/modules/bim/lib/open_project/bim/hooks.rb b/modules/bim/lib/open_project/bim/hooks.rb
index f37217255e9..4f3c6e26ee5 100644
--- a/modules/bim/lib/open_project/bim/hooks.rb
+++ b/modules/bim/lib/open_project/bim/hooks.rb
@@ -34,7 +34,7 @@ module OpenProject::Bim::Hooks
def admin_information_checklist(*)
[
- [:'extraction.available.ifc_convert', ::Bim::IFCModels::ViewConverterService.available?]
+ [:'extraction.available.ifc_convert', ::Bim::IfcModels::ViewConverterService.available?]
]
end
end
diff --git a/modules/bim/lib/open_project/bim/patches/aggregated_journal_patch.rb b/modules/bim/lib/open_project/bim/patches/aggregated_journal_patch.rb
index 6e618e73117..3514342e6a2 100644
--- a/modules/bim/lib/open_project/bim/patches/aggregated_journal_patch.rb
+++ b/modules/bim/lib/open_project/bim/patches/aggregated_journal_patch.rb
@@ -43,7 +43,7 @@ module OpenProject::Bim::Patches::AggregatedJournalPatch
aggregated_journals = super(journable, aggregated_journals, includes)
if includes.include?(:bcf_comments)
bcf_comments = if includes.include?(:bcf_comment)
- ::Bcf::Comment
+ ::Bim::Bcf::Comment
.where(journal_id: journal_ids)
.all
.group_by(&:journal_id)
diff --git a/modules/bim/lib/open_project/bim/patches/api/v3/export_formats.rb b/modules/bim/lib/open_project/bim/patches/api/v3/export_formats.rb
index 6e7bb68c843..533cceb30ad 100644
--- a/modules/bim/lib/open_project/bim/patches/api/v3/export_formats.rb
+++ b/modules/bim/lib/open_project/bim/patches/api/v3/export_formats.rb
@@ -1,4 +1,4 @@
-module OpenProject::Bcf::Patches
+module OpenProject::Bim::Patches
module Api::V3::ExportFormats
def representation_formats
super + [representation_format_bcf]
diff --git a/modules/bim/lib/open_project/bim/patches/journal_patch.rb b/modules/bim/lib/open_project/bim/patches/journal_patch.rb
index d397c556ae9..447aeb2d0d3 100644
--- a/modules/bim/lib/open_project/bim/patches/journal_patch.rb
+++ b/modules/bim/lib/open_project/bim/patches/journal_patch.rb
@@ -31,7 +31,7 @@ require_dependency 'journal'
module OpenProject::Bim::Patches::JournalPatch
def self.included(base)
base.class_eval do
- has_one :bcf_comment, class_name: 'Bcf::Comment', foreign_key: 'journal_id'
+ has_one :bcf_comment, class_name: 'Bim::Bcf::Comment', foreign_key: 'journal_id'
end
end
end
diff --git a/modules/bim/lib/open_project/bim/patches/project_patch.rb b/modules/bim/lib/open_project/bim/patches/project_patch.rb
index 9e71e81ea48..715e3e51265 100644
--- a/modules/bim/lib/open_project/bim/patches/project_patch.rb
+++ b/modules/bim/lib/open_project/bim/patches/project_patch.rb
@@ -31,7 +31,7 @@ require_dependency 'work_package'
module OpenProject::Bim::Patches::ProjectPatch
def self.included(base)
base.class_eval do
- has_many :ifc_models, class_name: 'Bim::IFCModels::IFCModel', foreign_key: 'project_id'
+ has_many :ifc_models, class_name: 'Bim::IfcModels::IfcModel', foreign_key: 'project_id'
end
end
end
diff --git a/modules/bim/lib/open_project/bim/patches/work_package_patch.rb b/modules/bim/lib/open_project/bim/patches/work_package_patch.rb
index 030f6985911..54aebc9e701 100644
--- a/modules/bim/lib/open_project/bim/patches/work_package_patch.rb
+++ b/modules/bim/lib/open_project/bim/patches/work_package_patch.rb
@@ -31,7 +31,7 @@ require_dependency 'work_package'
module OpenProject::Bim::Patches::WorkPackagePatch
def self.included(base)
base.class_eval do
- has_one :bcf_issue, class_name: 'Bcf::Issue', foreign_key: 'work_package_id'
+ has_one :bcf_issue, class_name: 'Bim::Bcf::Issue', foreign_key: 'work_package_id'
end
end
end
diff --git a/modules/bim/spec/api/v3/queries/filters/query_filter_instance_representer_spec.rb b/modules/bim/spec/api/v3/queries/filters/query_filter_instance_representer_spec.rb
index a574b68d6f7..8638758a37e 100644
--- a/modules/bim/spec/api/v3/queries/filters/query_filter_instance_representer_spec.rb
+++ b/modules/bim/spec/api/v3/queries/filters/query_filter_instance_representer_spec.rb
@@ -31,7 +31,7 @@ require 'spec_helper'
describe ::API::V3::Queries::Filters::QueryFilterInstanceRepresenter do
let(:operator) { '=' }
let(:filter) do
- ::OpenProject::Bcf::BcfIssueAssociatedFilter.create!(name: "bcf_issue_associated", operator: operator, values: values)
+ ::OpenProject::Bim::BcfIssueAssociatedFilter.create!(name: "bcf_issue_associated", operator: operator, values: values)
end
let(:representer) { described_class.new(filter) }
diff --git a/modules/bim/spec/bcf/bcf_xml/exporter_spec.rb b/modules/bim/spec/bcf/bcf_xml/exporter_spec.rb
index 74417212bb0..c07fa0a07f2 100644
--- a/modules/bim/spec/bcf/bcf_xml/exporter_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/exporter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::OpenProject::Bcf::BcfXml::Exporter do
+describe ::OpenProject::Bim::BcfXml::Exporter do
let(:query) { FactoryBot.build(:global_query)}
let(:work_package) { FactoryBot.create :work_package }
let(:admin) { FactoryBot.create(:admin) }
diff --git a/modules/bim/spec/bcf/bcf_xml/importer_spec.rb b/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
index 4388dd6eb54..6b62590db60 100644
--- a/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::OpenProject::Bcf::BcfXml::Importer do
+describe ::OpenProject::Bim::BcfXml::Importer do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
@@ -95,7 +95,7 @@ describe ::OpenProject::Bcf::BcfXml::Importer do
it 'creates 2 work packages' do
subject.import!
- expect(::Bcf::Issue.count).to be_eql 2
+ expect(::Bim::Bcf::Issue.count).to be_eql 2
expect(WorkPackage.count).to be_eql 2
end
end
diff --git a/modules/bim/spec/bcf/bcf_xml/issue_reader_spec.rb b/modules/bim/spec/bcf/bcf_xml/issue_reader_spec.rb
index ce7e97b97b6..16d942684ef 100644
--- a/modules/bim/spec/bcf/bcf_xml/issue_reader_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/issue_reader_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::OpenProject::Bcf::BcfXml::IssueReader do
+describe ::OpenProject::Bim::BcfXml::IssueReader do
let(:absolute_file_path) { "63E78882-7C6A-4BF7-8982-FC478AFB9C97/markup.bcf" }
let(:type) { FactoryBot.create :type, name: 'Issue', is_standard: true, is_default: true }
let(:project) do
@@ -87,7 +87,7 @@ describe ::OpenProject::Bcf::BcfXml::IssueReader do
.new(absolute_file_path, entry_stream)
end
let(:entry_stream) { StringIO.new(markup) }
- let(:import_options) { OpenProject::Bcf::BcfXml::Importer::DEFAULT_IMPORT_OPTIONS }
+ let(:import_options) { OpenProject::Bim::BcfXml::Importer::DEFAULT_IMPORT_OPTIONS }
subject do
described_class.new(project,
@@ -112,7 +112,7 @@ describe ::OpenProject::Bcf::BcfXml::IssueReader do
expect(bcf_issue.work_package.start_date).to eql(subject.extractor.creation_date.to_date)
end
- it 'BCF::Issue get initialized with the GUID form the XML file' do
+ it 'Bim::Bcf::Issue get initialized with the GUID form the XML file' do
expect(bcf_issue.uuid).to eql("63E78882-7C6A-4BF7-8982-FC478AFB9C97")
end
end
diff --git a/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb b/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
index 308857ee935..21c696c5980 100644
--- a/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::OpenProject::Bcf::BcfXml::IssueWriter do
+describe ::OpenProject::Bim::BcfXml::IssueWriter do
let(:project) { FactoryBot.create(:project) }
let(:markup) do
<<-MARKUP
@@ -174,7 +174,7 @@ describe ::OpenProject::Bcf::BcfXml::IssueWriter do
it 'creates BCF comments for comments that were created within OP.' do
expect(subject.at('/Markup/Comment[2]/Comment').content).to eql("Some note created in OP.")
- expect(Bcf::Comment.count).to eql(2)
+ expect(Bim::Bcf::Comment.count).to eql(2)
end
end
diff --git a/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb b/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
index 5f62ea5a98c..317e38c0896 100644
--- a/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::OpenProject::Bcf::BcfXml::MarkupExtractor do
+describe ::OpenProject::Bim::BcfXml::MarkupExtractor do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
diff --git a/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb b/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
index 46535488b83..d6bb44d5d3f 100644
--- a/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
@@ -29,10 +29,10 @@
require 'spec_helper'
require_relative './shared_contract_examples'
-describe Bcf::Issues::CreateContract do
+describe Bim::Bcf::Issues::CreateContract do
it_behaves_like 'issues contract' do
let(:issue) do
- Bcf::Issue.new(uuid: issue_uuid,
+ Bim::Bcf::Issue.new(uuid: issue_uuid,
work_package: issue_work_package,
index: issue_index)
end
diff --git a/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb b/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
index c12b54f5fc6..110e5359fee 100644
--- a/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
+++ b/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative './shared_contract_examples'
-describe Bcf::Issues::UpdateContract do
+describe Bim::Bcf::Issues::UpdateContract do
it_behaves_like 'issues contract' do
let(:issue) do
FactoryBot.build_stubbed(:bcf_issue,
diff --git a/modules/bim/spec/contracts/bcf/viewpoints/create_contract_spec.rb b/modules/bim/spec/contracts/bcf/viewpoints/create_contract_spec.rb
index f4d89089f00..bc3d5a51b4c 100644
--- a/modules/bim/spec/contracts/bcf/viewpoints/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/bcf/viewpoints/create_contract_spec.rb
@@ -28,9 +28,9 @@
require 'spec_helper'
-describe Bcf::Viewpoints::CreateContract do
+describe Bim::Bcf::Viewpoints::CreateContract do
let(:viewpoint) do
- Bcf::Viewpoint.new(uuid: viewpoint_uuid,
+ Bim::Bcf::Viewpoint.new(uuid: viewpoint_uuid,
issue: viewpoint_issue,
json_viewpoint: viewpoint_json_viewpoint)
end
diff --git a/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb b/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
index 5729fdfbac5..ae03649c5af 100644
--- a/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
@@ -31,10 +31,10 @@
require 'spec_helper'
require_relative './shared_contract_examples'
-describe IFCModels::CreateContract do
+describe IfcModels::CreateContract do
it_behaves_like 'ifc model contract' do
let(:ifc_model) do
- ::IFCModels::IFCModel.new(project: model_project,
+ ::Bim::IfcModels::IfcModel.new(project: model_project,
title: model_title,
uploader: model_user)
end
diff --git a/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb b/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
index 35eae0092b5..34693eeae3b 100644
--- a/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
+++ b/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_relative './shared_contract_examples'
-describe IFCModels::UpdateContract do
+describe IfcModels::UpdateContract do
it_behaves_like 'ifc model contract' do
let(:ifc_model) do
FactoryBot.build_stubbed(:ifc_model,
diff --git a/modules/bim/spec/controllers/issues_controller_spec.rb b/modules/bim/spec/controllers/issues_controller_spec.rb
index 15314beafb7..fa638253107 100644
--- a/modules/bim/spec/controllers/issues_controller_spec.rb
+++ b/modules/bim/spec/controllers/issues_controller_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::Bcf::IssuesController, type: :controller do
+describe ::Bim::Bcf::IssuesController, type: :controller do
let(:manage_bcf_role) do
FactoryBot.create(:role,
permissions: %i[manage_bcf view_linked_issues view_work_packages add_work_packages edit_work_packages])
diff --git a/modules/bim/spec/factories/bcf_comment_factory.rb b/modules/bim/spec/factories/bcf_comment_factory.rb
index 3280dc52b1d..4a92777f3f1 100644
--- a/modules/bim/spec/factories/bcf_comment_factory.rb
+++ b/modules/bim/spec/factories/bcf_comment_factory.rb
@@ -27,7 +27,7 @@
#++
FactoryBot.define do
- factory :bcf_comment, class: ::Bcf::Comment do
+ factory :bcf_comment, class: ::Bim::Bcf::Comment do
after(:create) do |bcf_comment|
bcf_comment.journal = create(:work_package_journal)
bcf_comment.journal.update_attribute(:notes, 'Some BCF comment.')
diff --git a/modules/bim/spec/factories/bcf_issue_factory.rb b/modules/bim/spec/factories/bcf_issue_factory.rb
index 49aaab47f80..799ce49f1d3 100644
--- a/modules/bim/spec/factories/bcf_issue_factory.rb
+++ b/modules/bim/spec/factories/bcf_issue_factory.rb
@@ -29,7 +29,7 @@
#++
FactoryBot.define do
- factory :bcf_issue, class: ::Bcf::Issue do
+ factory :bcf_issue, class: ::Bim::Bcf::Issue do
markup do
<<-MARKUP
<Markup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
diff --git a/modules/bim/spec/factories/bcf_viewpoint_factory.rb b/modules/bim/spec/factories/bcf_viewpoint_factory.rb
index 7b9e333bcf0..4272ced9563 100644
--- a/modules/bim/spec/factories/bcf_viewpoint_factory.rb
+++ b/modules/bim/spec/factories/bcf_viewpoint_factory.rb
@@ -27,12 +27,12 @@
#++
FactoryBot.define do
- factory :bcf_viewpoint, class: ::Bcf::Viewpoint do
+ factory :bcf_viewpoint, class: ::Bim::Bcf::Viewpoint do
new_uuid = SecureRandom.uuid
uuid { new_uuid }
viewpoint_name { "full_viewpoint.bcfv" }
json_viewpoint do
- file = OpenProject::Bcf::Engine.root.join("spec/fixtures/viewpoints/#{viewpoint_name}.json")
+ file = OpenProject::Bim::Engine.root.join("spec/fixtures/viewpoints/#{viewpoint_name}.json")
if file.readable?
JSON.parse(file.read)
else
diff --git a/modules/bim/spec/factories/ifc_model_factory.rb b/modules/bim/spec/factories/ifc_model_factory.rb
index 1c1bd73719c..f1b431ade94 100644
--- a/modules/bim/spec/factories/ifc_model_factory.rb
+++ b/modules/bim/spec/factories/ifc_model_factory.rb
@@ -27,7 +27,7 @@
#++
FactoryBot.define do
- factory :ifc_model, class: ::IFCModels::IFCModel do
+ factory :ifc_model, class: ::Bim::IfcModels::IfcModel do
title { 'My IFC model' }
project factory: :project
uploader factory: :user
diff --git a/modules/bim/spec/factories/xml_viewpoint_factory.rb b/modules/bim/spec/factories/xml_viewpoint_factory.rb
index 6ea13aa4c3e..d3ad8fde9da 100644
--- a/modules/bim/spec/factories/xml_viewpoint_factory.rb
+++ b/modules/bim/spec/factories/xml_viewpoint_factory.rb
@@ -31,7 +31,7 @@ FactoryBot.define do
uuid { SecureRandom.uuid }
viewpoint_name { "full_viewpoint.bcfv" }
viewpoint do
- file = OpenProject::Bcf::Engine.root.join("spec/fixtures/viewpoints/#{viewpoint_name}.xml")
+ file = OpenProject::Bim::Engine.root.join("spec/fixtures/viewpoints/#{viewpoint_name}.xml")
if file.readable?
file.read
else
diff --git a/modules/bim/spec/features/bcf_export_spec.rb b/modules/bim/spec/features/bcf_export_spec.rb
index c3e88ecc53b..d22ec9d22b9 100644
--- a/modules/bim/spec/features/bcf_export_spec.rb
+++ b/modules/bim/spec/features/bcf_export_spec.rb
@@ -59,7 +59,7 @@ describe 'work package export', type: :feature, js: true do
::DownloadedFile.wait_for_download_content
# Check the downloaded file
- OpenProject::Bcf::BcfXml::Importer.new(
+ OpenProject::Bim::BcfXml::Importer.new(
::DownloadedFile.download,
project,
current_user: current_user
diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
index d331b856bb2..eb79015775b 100644
--- a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
+++ b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
@@ -168,7 +168,7 @@ end
shared_examples 'matches the JSON counterpart' do
it 'matches the JSON viewpoint counterpart' do
- path = OpenProject::Bcf::Engine.root.join("spec/fixtures/viewpoints/#{xml_viewpoint.viewpoint_name}.json")
+ path = OpenProject::Bim::Engine.root.join("spec/fixtures/viewpoints/#{xml_viewpoint.viewpoint_name}.json")
raise "Expected #{path} to be readable for JSON comparsion" unless path.readable?
json = path.read
diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
index edb88d095a0..e952bcf1bcb 100644
--- a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
+++ b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative './viewpoint_reader_shared_examples.rb'
-describe OpenProject::Bcf::BcfJson::ViewpointReader do
+describe OpenProject::Bim::BcfJson::ViewpointReader do
let(:instance) { described_class.new xml_viewpoint.uuid, xml_viewpoint.viewpoint }
subject { instance.result }
diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_xml/viewpoint_writer_spec.rb b/modules/bim/spec/lib/open_project/bcf/bcf_xml/viewpoint_writer_spec.rb
index 6515cb116e6..71b3c70589c 100644
--- a/modules/bim/spec/lib/open_project/bcf/bcf_xml/viewpoint_writer_spec.rb
+++ b/modules/bim/spec/lib/open_project/bcf/bcf_xml/viewpoint_writer_spec.rb
@@ -29,9 +29,9 @@
require 'spec_helper'
require 'compare-xml'
-describe OpenProject::Bcf::BcfXml::ViewpointWriter do
+describe OpenProject::Bim::BcfXml::ViewpointWriter do
let(:writer_instance) { described_class.new json_resource }
- let(:reader_instance) { ::OpenProject::Bcf::BcfJson::ViewpointReader.new xml_resource.uuid, subject.to_xml }
+ let(:reader_instance) { ::OpenProject::Bim::BcfJson::ViewpointReader.new xml_resource.uuid, subject.to_xml }
let(:xml_comparison) { Nokogiri::XML(xml_resource.viewpoint) }
let(:json_comparison) { json_resource.raw_json_viewpoint }
diff --git a/modules/bim/spec/models/bcf/issue_spec.rb b/modules/bim/spec/models/bcf/issue_spec.rb
index 687b12be715..cea49131fba 100644
--- a/modules/bim/spec/models/bcf/issue_spec.rb
+++ b/modules/bim/spec/models/bcf/issue_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe ::Bcf::Issue, type: :model do
+describe ::Bim::Bcf::Issue, type: :model do
let(:type) { FactoryBot.create :type, name: "Issue [BCF]" }
let(:work_package) { FactoryBot.create :work_package, type: type }
let(:issue) { FactoryBot.create :bcf_issue, work_package: work_package }
diff --git a/modules/bim/spec/models/ifc_model_spec.rb b/modules/bim/spec/models/ifc_model_spec.rb
index d24dfa033d2..86e25ac4b6e 100644
--- a/modules/bim/spec/models/ifc_model_spec.rb
+++ b/modules/bim/spec/models/ifc_model_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe ::IFCModels::IFCModel, type: :model do
+describe ::Bim::IfcModels::IfcModel, type: :model do
subject { described_class.new params }
let(:params) { { title: 'foo', is_default: true } }
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
index af4ea3dac4f..bbcb4a343ab 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
@@ -297,7 +297,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it 'deletes the Bcf Issue as well as the belonging Work Package' do
expect(WorkPackage.where(id: work_package.id)).to match_array []
- expect(Bcf::Issue.where(id: bcf_issue.id)).to match_array []
+ expect(Bim::Bcf::Issue.where(id: bcf_issue.id)).to match_array []
end
context 'lacking permission to manage bcf' do
@@ -307,7 +307,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it 'deletes neither the Work Package nor the Bcf Issue' do
expect(WorkPackage.where(id: work_package.id)).to match_array [work_package]
- expect(Bcf::Issue.where(id: bcf_issue.id)).to match_array [bcf_issue]
+ expect(Bim::Bcf::Issue.where(id: bcf_issue.id)).to match_array [bcf_issue]
end
end
end
@@ -537,7 +537,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_status) { 201 }
let(:expected_body) do
- issue = Bcf::Issue.last
+ issue = Bim::Bcf::Issue.last
work_package = WorkPackage.last
{
@@ -577,7 +577,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_status) { 201 }
let(:expected_body) do
- issue = Bcf::Issue.last
+ issue = Bim::Bcf::Issue.last
work_package = WorkPackage.last
{
@@ -678,7 +678,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_body) do
- issue = Bcf::Issue.last
+ issue = Bim::Bcf::Issue.last
work_package = WorkPackage.last
{
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
index 54d707da4fc..b505a321552 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
@@ -133,7 +133,7 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
end
it 'deletes the viewpoint' do
- expect(Bcf::Viewpoint.where(id: viewpoint.id)).not_to be_exist
+ expect(Bim::Bcf::Viewpoint.where(id: viewpoint.id)).not_to be_exist
end
end
@@ -253,7 +253,7 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
it_behaves_like 'bcf api successful response' do
let(:expected_body) do
- new_viewpoint = Bcf::Viewpoint.last
+ new_viewpoint = Bim::Bcf::Viewpoint.last
params
.merge(guid: new_viewpoint.uuid)
@@ -263,10 +263,10 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
end
it 'creates the viewpoint with an attachment for the snapshot' do
- expect(Bcf::Viewpoint.count)
+ expect(Bim::Bcf::Viewpoint.count)
.to eql 2
- expect(Bcf::Viewpoint.last.attachments.count)
+ expect(Bim::Bcf::Viewpoint.last.attachments.count)
.to eql 1
end
diff --git a/modules/bim/spec/seeders/demo_data_seeder_spec.rb b/modules/bim/spec/seeders/demo_data_seeder_spec.rb
index 6a878f28e74..ea3be5f722d 100644
--- a/modules/bim/spec/seeders/demo_data_seeder_spec.rb
+++ b/modules/bim/spec/seeders/demo_data_seeder_spec.rb
@@ -64,7 +64,7 @@ describe 'seeds' do
expect(Status.count).to eq 4
expect(IssuePriority.count).to eq 4
expect(Project::Status.count).to eq 4
- expect(IFCModels::IFCModel.count).to eq 6
+ expect(Bim::IfcModels::IfcModel.count).to eq 6
ensure
ActionMailer::Base.perform_deliveries = perform_deliveries
end
diff --git a/modules/bim/spec/services/bcf/issues/create_service_spec.rb b/modules/bim/spec/services/bcf/issues/create_service_spec.rb
index b9cb981367c..1895179c78c 100644
--- a/modules/bim/spec/services/bcf/issues/create_service_spec.rb
+++ b/modules/bim/spec/services/bcf/issues/create_service_spec.rb
@@ -30,7 +30,7 @@
require 'spec_helper'
-describe Bcf::Issues::CreateService, type: :model do
+describe Bim::Bcf::Issues::CreateService, type: :model do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
double('contract_class', '<=': true)
@@ -80,7 +80,7 @@ describe Bcf::Issues::CreateService, type: :model do
let!(:created_issue) do
issue = FactoryBot.build_stubbed(:bcf_issue)
- allow(Bcf::Issue)
+ allow(Bim::Bcf::Issue)
.to receive(:new)
.and_return(issue)
@@ -93,7 +93,7 @@ describe Bcf::Issues::CreateService, type: :model do
let!(:set_attributes_service) do
service = double('set_attributes_service_instance')
- allow(Bcf::Issues::SetAttributesService)
+ allow(Bim::Bcf::Issues::SetAttributesService)
.to receive(:new)
.with(user: user,
model: created_issue,
diff --git a/modules/bim/spec/services/bcf/viewpoints/create_service_spec.rb b/modules/bim/spec/services/bcf/viewpoints/create_service_spec.rb
index 50bc0a2d058..d18f508ea2c 100644
--- a/modules/bim/spec/services/bcf/viewpoints/create_service_spec.rb
+++ b/modules/bim/spec/services/bcf/viewpoints/create_service_spec.rb
@@ -30,7 +30,7 @@
require 'spec_helper'
-describe Bcf::Viewpoints::CreateService, type: :model do
+describe Bim::Bcf::Viewpoints::CreateService, type: :model do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
double('contract_class', '<=': true)
@@ -63,7 +63,7 @@ describe Bcf::Viewpoints::CreateService, type: :model do
let!(:created_viewpoint) do
viewpoint = FactoryBot.build_stubbed(:bcf_viewpoint)
- allow(Bcf::Viewpoint)
+ allow(Bim::Bcf::Viewpoint)
.to receive(:new)
.and_return(viewpoint)
@@ -76,7 +76,7 @@ describe Bcf::Viewpoints::CreateService, type: :model do
let!(:set_attributes_service) do
service = double('set_attributes_service_instance')
- allow(Bcf::Viewpoints::SetAttributesService)
+ allow(Bim::Bcf::Viewpoints::SetAttributesService)
.to receive(:new)
.with(user: user,
model: created_viewpoint,
diff --git a/modules/bim/spec/services/bcf/viewpoints/set_attributes_service_spec.rb b/modules/bim/spec/services/bcf/viewpoints/set_attributes_service_spec.rb
index 0155e2187cb..d0491a3bcba 100644
--- a/modules/bim/spec/services/bcf/viewpoints/set_attributes_service_spec.rb
+++ b/modules/bim/spec/services/bcf/viewpoints/set_attributes_service_spec.rb
@@ -30,7 +30,7 @@
require 'spec_helper'
-describe Bcf::Viewpoints::SetAttributesService, type: :model do
+describe Bim::Bcf::Viewpoints::SetAttributesService, type: :model do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
contract = double('contract_class')
@@ -57,7 +57,7 @@ describe Bcf::Viewpoints::SetAttributesService, type: :model do
end
let(:call_attributes) { {} }
let(:viewpoint) do
- Bcf::Viewpoint.new
+ Bim::Bcf::Viewpoint.new
end
describe 'call' do
diff --git a/modules/bim/spec/services/ifc_models/create_service_spec.rb b/modules/bim/spec/services/ifc_models/create_service_spec.rb
index 5d3786e8db0..c59a8fa7416 100644
--- a/modules/bim/spec/services/ifc_models/create_service_spec.rb
+++ b/modules/bim/spec/services/ifc_models/create_service_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe IFCModels::CreateService do
+describe IfcModels::CreateService do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
double('contract_class', '<=': true)
@@ -25,7 +25,7 @@ describe IFCModels::CreateService do
let!(:created_model) do
model = FactoryBot.build_stubbed(:ifc_model)
- allow(IFCModels::IFCModel)
+ allow(Bim::IfcModels::IfcModel)
.to receive(:new)
.and_return(model)
@@ -38,7 +38,7 @@ describe IFCModels::CreateService do
let!(:set_attributes_service) do
service = double('set_attributes_service_instance')
- allow(IFCModels::SetAttributesService)
+ allow(IfcModels::SetAttributesService)
.to receive(:new)
.with(user: user,
model: created_model,
@@ -54,7 +54,7 @@ describe IFCModels::CreateService do
allow(job)
.to receive(:perform_later)
- stub_const('IFCModels::IFCConversionJob', job)
+ stub_const('IfcModels::IfcConversionJob', job)
end
end
diff --git a/modules/bim/spec/services/ifc_models/set_attributes_service_spec.rb b/modules/bim/spec/services/ifc_models/set_attributes_service_spec.rb
index 6957a1db7a2..d25ab30195a 100644
--- a/modules/bim/spec/services/ifc_models/set_attributes_service_spec.rb
+++ b/modules/bim/spec/services/ifc_models/set_attributes_service_spec.rb
@@ -30,7 +30,7 @@
require 'spec_helper'
-describe IFCModels::SetAttributesService, type: :model do
+describe IfcModels::SetAttributesService, type: :model do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:other_user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
@@ -109,7 +109,7 @@ describe IFCModels::SetAttributesService, type: :model do
context 'for a new record' do
let(:model) do
- IFCModels::IFCModel.new
+ Bim::IfcModels::IfcModel.new
end
context 'with an ifc_attachment' do
diff --git a/modules/bim/spec/services/ifc_models/update_service_spec.rb b/modules/bim/spec/services/ifc_models/update_service_spec.rb
index 4863dcd1ca5..c49b47f87a1 100644
--- a/modules/bim/spec/services/ifc_models/update_service_spec.rb
+++ b/modules/bim/spec/services/ifc_models/update_service_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe IFCModels::UpdateService do
+describe IfcModels::UpdateService do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:contract_class) do
double('contract_class', '<=': true)
@@ -39,7 +39,7 @@ describe IFCModels::UpdateService do
let!(:set_attributes_service) do
service = double('set_attributes_service_instance')
- allow(IFCModels::SetAttributesService)
+ allow(IfcModels::SetAttributesService)
.to receive(:new)
.with(user: user,
model: model,
@@ -55,7 +55,7 @@ describe IFCModels::UpdateService do
allow(job)
.to receive(:perform_later)
- stub_const('IFCModels::IFCConversionJob', job)
+ stub_const('IfcModels::IfcConversionJob', job)
end
end
let(:ifc_attachment) { FactoryBot.build_stubbed(:attachment) }
diff --git a/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb b/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb
index 540c8cb40ee..365af6907de 100644
--- a/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb
+++ b/modules/bim/spec/services/ifc_models/view_conversion_service_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe IFCModels::ViewConverterService do
+describe IfcModels::ViewConverterService do
let(:model) { FactoryBot.build :ifc_model }
subject { described_class.new(model) }
diff --git a/modules/bim/spec/workers/ifc_conversion_job_spec.rb b/modules/bim/spec/workers/ifc_conversion_job_spec.rb
index bc4b5e3802d..fd4296c28b9 100644
--- a/modules/bim/spec/workers/ifc_conversion_job_spec.rb
+++ b/modules/bim/spec/workers/ifc_conversion_job_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-describe IFCModels::IFCConversionJob, type: :job do
+describe IfcModels::IfcConversionJob, type: :job do
let(:model) { FactoryBot.build :ifc_model }
subject { described_class.perform_now(model) }
it 'calls the conversion service' do
- expect(::IFCModels::ViewConverterService)
+ expect(::IfcModels::ViewConverterService)
.to receive_message_chain(:new, :call)
.and_return ServiceResult.new success: true