-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubsystem.go
88 lines (73 loc) · 1.87 KB
/
subsystem.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package mdclasses
import (
"github.com/v8platform/mdclasses/encoding/xml"
"strings"
)
type Subsystem struct {
MDOBaseType
SubsystemChildSubsystems
XMLName xml.Name `xml:"Subsystem"`
IncludeHelpInContents bool `xml:"includeHelpInContents"`
IncludeInCommandInterface bool `xml:"includeInCommandInterface"`
Subsystems []*Subsystem `xml:"-"`
Content MDOTypeRefList `xml:"content"`
ParentSubsystem MDOTypeRef `xml:"parentSubsystem"`
}
type SubsystemChildSubsystems struct {
Subsystems []string `xml:"subsystems"`
}
func (conf *Subsystem) Unpack(cfg UnpackConfig) error {
parentMDO := newMDOTypeRef(SUBSYSTEM, conf.Name, conf.ParentSubsystem)
var subsystems []MDOTypeRef
for _, name := range conf.SubsystemChildSubsystems.Subsystems {
subsystems = append(subsystems, newMDOTypeRef(
SUBSYSTEM,
name,
parentMDO,
))
}
err := MDOTypeRefList(subsystems).Unpack(cfg, &conf.Subsystems)
if err != nil {
return err
}
//
// for _, name := range conf.ContentNames {
//
// names := strings.Split(name, ".")
//
// if len(names) != 2 {
// log.Warnf("Error parce subsystems: %s", name)
// continue
// }
//
// contentType := names[0]
//
// value := objectByType(contentType)
//
// // TODO Временно убрать, после реализации
// if value == nil {
// continue
// }
//
// err := Unpack(cfg.WithName(name, contentType), value)
// if err != nil {
// return err
// }
//
// conf.Content = append(conf.Content, value)
// }
return nil
}
func objectByType(contentType string) interface{} {
switch strings.ToLower(contentType) {
case "businessprocess":
return nil
case "catalog":
return &Catalog{}
case "document":
return &Document{}
default:
log.Warnf("Unknown content type: %s", contentType)
}
return nil
}