Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

c

  • Loading branch information...
commit 046670be6c9704684cafe26f6f2618ea66936443 1 parent 2238e03
f-marais authored August 09, 2012
2  conf/db.yaml
... ...
@@ -1,5 +1,5 @@
1 1
 DB:
2 2
     MIS:
3  
-        DSN:   dbi:SQLite:dbname=/stmw/db/STM.db
  3
+        DSN:   dbi:SQLite:dbname=/Users/fm/fmdocs/Companies/Busii/STMWeb/db/STM.db
4 4
         USER:   fm
5 5
         PWD:   fm
20  lib/X_Db/Schema.pm
... ...
@@ -1,20 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-use strict;
8  
-use warnings;
9  
-
10  
-use base 'DBIx::Class::Schema';
11  
-
12  
-__PACKAGE__->load_namespaces;
13  
-
14  
-
15  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
16  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TkV4mYLu3oRA5irrLYyhLA
17  
-
18  
-
19  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
20  
-1;
92  lib/X_Db/Schema/Result/E2e.pm
... ...
@@ -1,92 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema::Result::E2e;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-=head1 NAME
8  
-
9  
-X_Db::Schema::Result::E2e
10  
-
11  
-=cut
12  
-
13  
-use strict;
14  
-use warnings;
15  
-
16  
-use base 'DBIx::Class::Core';
17  
-
18  
-=head1 TABLE: C<e2e>
19  
-
20  
-=cut
21  
-
22  
-__PACKAGE__->table("e2e");
23  
-
24  
-=head1 ACCESSORS
25  
-
26  
-=head2 left_id
27  
-
28  
-  data_type: 'integer'
29  
-  is_foreign_key: 1
30  
-  is_nullable: 0
31  
-
32  
-=head2 right_id
33  
-
34  
-  data_type: 'integer'
35  
-  is_foreign_key: 1
36  
-  is_nullable: 0
37  
-
38  
-=head2 bus_rule
39  
-
40  
-  data_type: 'text'
41  
-  is_nullable: 1
42  
-
43  
-=cut
44  
-
45  
-__PACKAGE__->add_columns(
46  
-  "left_id",
47  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
48  
-  "right_id",
49  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
50  
-  "bus_rule",
51  
-  { data_type => "text", is_nullable => 1 },
52  
-);
53  
-
54  
-=head1 RELATIONS
55  
-
56  
-=head2 left
57  
-
58  
-Type: belongs_to
59  
-
60  
-Related object: L<X_Db::Schema::Result::Entity>
61  
-
62  
-=cut
63  
-
64  
-__PACKAGE__->belongs_to(
65  
-  "left",
66  
-  "X_Db::Schema::Result::Entity",
67  
-  { et_id => "left_id" },
68  
-  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
69  
-);
70  
-
71  
-=head2 right
72  
-
73  
-Type: belongs_to
74  
-
75  
-Related object: L<X_Db::Schema::Result::Entity>
76  
-
77  
-=cut
78  
-
79  
-__PACKAGE__->belongs_to(
80  
-  "right",
81  
-  "X_Db::Schema::Result::Entity",
82  
-  { et_id => "right_id" },
83  
-  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
84  
-);
85  
-
86  
-
87  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
88  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0pCqfGpRExI9r7p/HpdkXg
89  
-
90  
-
91  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
92  
-1;
33  lib/X_Db/Schema/Result/EntDetVw.pm
... ...
@@ -1,33 +0,0 @@
1  
-package X_Db::Schema::Result::EntDetVw;
2  
-
3  
-use base qw/DBIx::Class::Core/;
4  
-
5  
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
6  
-
7  
-__PACKAGE__->table('entdet_vw');
8  
-__PACKAGE__->result_source_instance->is_virtual(1);
9  
-__PACKAGE__->result_source_instance->view_definition(
10  
-    qq{
11  
-select  b.name tgt_ent_nm,a.name tgt_itm_nm, 
12  
-        a.type, a.bus_rule, 
13  
-        ifnull(f.src_itm_nm,' ') src_itm_nm, 
14  
-        ifnull(f.src_ent_nm,' ') src_ent_nm
15  
-    from item a join entity b on a.et_id=b.et_id
16  
-    join entity_master c on b.em_id=c.em_id
17  
-    join (select c.tgt_id,d.name src_itm_nm,
18  
-        e.name src_ent_nm,d.seq src_seq
19  
-        from i2i c, item d, entity e
20  
-        where c.src_id=d.it_id and d.et_id=e.et_id) f
21  
-    on a.it_id=f.tgt_id
22  
-    order by a.seq,f.src_seq 
23  
-});
24  
-
25  
-__PACKAGE__->add_columns(
26  
-'tgt_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
27  
-'tgt_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
28  
-'type' => { is_numeric=>0,data_type => 'varchar', },
29  
-'bus_rule' => { is_numeric=>0,data_type => 'varchar', },
30  
-'src_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
31  
-'src_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
32  
-);
33  
-1;
32  lib/X_Db/Schema/Result/EntListVw.pm
... ...
@@ -1,32 +0,0 @@
1  
-package X_Db::Schema::Result::EntListVw;
2  
-
3  
-use base qw/DBIx::Class::Core/;
4  
-
5  
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
6  
-
7  
-__PACKAGE__->table('entlist_vw');
8  
-__PACKAGE__->result_source_instance->is_virtual(1);
9  
-__PACKAGE__->result_source_instance->view_definition(
10  
-        qq{
11  
-select distinct ifnull(c.name,f.src_em_nm) 'em_nm', 
12  
-        ifnull(c.version,f.src_em_version) 'em_version', 
13  
-        ifnull(b.name,'N/A') 'tgt_ent_nm',
14  
-        ifnull(f.src_ent_nm,'N/A') src_ent_nm
15  
-    from item a join entity b on a.et_id=b.et_id
16  
-    join entity_master c on b.em_id=c.em_id
17  
-    left join (select c.tgt_id, e.name 'src_ent_nm',
18  
-        g.name 'src_em_nm', g.version 'src_em_version'
19  
-        from i2i c, item d, entity e, entity_master g
20  
-        where e.em_id=g.em_id and c.src_id=d.it_id and d.et_id=e.et_id) f
21  
-    on a.it_id=f.tgt_id
22  
-    where b.name like '%ALLOCATION%'
23  
-    and c.max_version=1
24  
-    order by b.name, c.name, c.version desc  });
25  
-
26  
-__PACKAGE__->add_columns(
27  
-'em_nm' => { is_numeric=>0,data_type => 'varchar', },
28  
-'version' => { is_numeric=>0,data_type => 'varchar', },
29  
-'tgt_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
30  
-'src_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
31  
-);
32  
-1;
207  lib/X_Db/Schema/Result/Entity.pm
... ...
@@ -1,207 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema::Result::Entity;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-=head1 NAME
8  
-
9  
-X_Db::Schema::Result::Entity
10  
-
11  
-=cut
12  
-
13  
-use strict;
14  
-use warnings;
15  
-
16  
-use base 'DBIx::Class::Core';
17  
-
18  
-=head1 TABLE: C<entity>
19  
-
20  
-=cut
21  
-
22  
-__PACKAGE__->table("entity");
23  
-
24  
-=head1 ACCESSORS
25  
-
26  
-=head2 et_id
27  
-
28  
-  data_type: 'integer'
29  
-  is_auto_increment: 1
30  
-  is_nullable: 0
31  
-
32  
-=head2 em_id
33  
-
34  
-  data_type: 'integer'
35  
-  is_foreign_key: 1
36  
-  is_nullable: 0
37  
-
38  
-=head2 name
39  
-
40  
-  data_type: 'text'
41  
-  is_nullable: 1
42  
-
43  
-=head2 type
44  
-
45  
-  data_type: 'text'
46  
-  is_nullable: 1
47  
-
48  
-=head2 grain
49  
-
50  
-  data_type: 'text'
51  
-  is_nullable: 1
52  
-
53  
-=head2 retention
54  
-
55  
-  data_type: 'text'
56  
-  is_nullable: 1
57  
-
58  
-=head2 format
59  
-
60  
-  data_type: 'char'
61  
-  is_nullable: 1
62  
-  size: 30
63  
-
64  
-=head2 latency
65  
-
66  
-  data_type: 'char'
67  
-  is_nullable: 1
68  
-  size: 100
69  
-
70  
-=head2 frequency
71  
-
72  
-  data_type: 'char'
73  
-  is_nullable: 1
74  
-  size: 100
75  
-
76  
-=head2 scope
77  
-
78  
-  data_type: 'text'
79  
-  is_nullable: 1
80  
-
81  
-=head2 parameters
82  
-
83  
-  data_type: 'text'
84  
-  is_nullable: 1
85  
-
86  
-=head2 comment
87  
-
88  
-  data_type: 'text'
89  
-  is_nullable: 1
90  
-
91  
-=head2 description
92  
-
93  
-  data_type: 'text'
94  
-  is_nullable: 1
95  
-
96  
-=cut
97  
-
98  
-__PACKAGE__->add_columns(
99  
-  "et_id",
100  
-  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
101  
-  "em_id",
102  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
103  
-  "name",
104  
-  { data_type => "text", is_nullable => 1 },
105  
-  "type",
106  
-  { data_type => "text", is_nullable => 1 },
107  
-  "grain",
108  
-  { data_type => "text", is_nullable => 1 },
109  
-  "retention",
110  
-  { data_type => "text", is_nullable => 1 },
111  
-  "format",
112  
-  { data_type => "char", is_nullable => 1, size => 30 },
113  
-  "latency",
114  
-  { data_type => "char", is_nullable => 1, size => 100 },
115  
-  "frequency",
116  
-  { data_type => "char", is_nullable => 1, size => 100 },
117  
-  "scope",
118  
-  { data_type => "text", is_nullable => 1 },
119  
-  "parameters",
120  
-  { data_type => "text", is_nullable => 1 },
121  
-  "comment",
122  
-  { data_type => "text", is_nullable => 1 },
123  
-  "description",
124  
-  { data_type => "text", is_nullable => 1 },
125  
-);
126  
-
127  
-=head1 PRIMARY KEY
128  
-
129  
-=over 4
130  
-
131  
-=item * L</et_id>
132  
-
133  
-=back
134  
-
135  
-=cut
136  
-
137  
-__PACKAGE__->set_primary_key("et_id");
138  
-
139  
-=head1 RELATIONS
140  
-
141  
-=head2 e2e_lefts
142  
-
143  
-Type: has_many
144  
-
145  
-Related object: L<X_Db::Schema::Result::E2e>
146  
-
147  
-=cut
148  
-
149  
-__PACKAGE__->has_many(
150  
-  "e2e_lefts",
151  
-  "X_Db::Schema::Result::E2e",
152  
-  { "foreign.left_id" => "self.et_id" },
153  
-  { cascade_copy => 0, cascade_delete => 1 },
154  
-);
155  
-
156  
-=head2 e2e_rights
157  
-
158  
-Type: has_many
159  
-
160  
-Related object: L<X_Db::Schema::Result::E2e>
161  
-
162  
-=cut
163  
-
164  
-__PACKAGE__->has_many(
165  
-  "e2e_rights",
166  
-  "X_Db::Schema::Result::E2e",
167  
-  { "foreign.right_id" => "self.et_id" },
168  
-  { cascade_copy => 0, cascade_delete => 1 },
169  
-);
170  
-
171  
-=head2 em
172  
-
173  
-Type: belongs_to
174  
-
175  
-Related object: L<X_Db::Schema::Result::EntityMaster>
176  
-
177  
-=cut
178  
-
179  
-__PACKAGE__->belongs_to(
180  
-  "em",
181  
-  "X_Db::Schema::Result::EntityMaster",
182  
-  { em_id => "em_id" },
183  
-  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
184  
-);
185  
-
186  
-=head2 items
187  
-
188  
-Type: has_many
189  
-
190  
-Related object: L<X_Db::Schema::Result::Item>
191  
-
192  
-=cut
193  
-
194  
-__PACKAGE__->has_many(
195  
-  "items",
196  
-  "X_Db::Schema::Result::Item",
197  
-  { "foreign.et_id" => "self.et_id" },
198  
-  { cascade_copy => 0, cascade_delete => 1 },
199  
-);
200  
-
201  
-
202  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
203  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vYQUSN3YMvOLg6tT0Ouw6Q
204  
-
205  
-
206  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
207  
-1;
97  lib/X_Db/Schema/Result/EntityMaster.pm
... ...
@@ -1,97 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema::Result::EntityMaster;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-=head1 NAME
8  
-
9  
-X_Db::Schema::Result::EntityMaster
10  
-
11  
-=cut
12  
-
13  
-use strict;
14  
-use warnings;
15  
-
16  
-use base 'DBIx::Class::Core';
17  
-
18  
-=head1 TABLE: C<entity_master>
19  
-
20  
-=cut
21  
-
22  
-__PACKAGE__->table("entity_master");
23  
-
24  
-=head1 ACCESSORS
25  
-
26  
-=head2 em_id
27  
-
28  
-  data_type: 'integer'
29  
-  is_auto_increment: 1
30  
-  is_nullable: 0
31  
-
32  
-=head2 name
33  
-
34  
-  data_type: 'text'
35  
-  is_nullable: 1
36  
-
37  
-=head2 version
38  
-
39  
-  data_type: 'numeric'
40  
-  is_nullable: 1
41  
-  size: [4,2]
42  
-
43  
-=cut
44  
-
45  
-__PACKAGE__->add_columns(
46  
-  "em_id",
47  
-  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
48  
-  "name",
49  
-  { data_type => "text", is_nullable => 1 },
50  
-  "rel_notes",
51  
-  { data_type => "text", is_nullable => 1 },
52  
-  "max_version",
53  
-  { data_type => "boolean", is_nullable => 1 },
54  
-  "author",
55  
-  { data_type => "text", is_nullable => 1 },
56  
-  "uploaded",
57  
-  { data_type => "date", is_nullable => 1 },
58  
-  "version",
59  
-  { data_type => "text", is_nullable => 1  },
60  
-);
61  
-
62  
-=head1 PRIMARY KEY
63  
-
64  
-=over 4
65  
-
66  
-=item * L</em_id>
67  
-
68  
-=back
69  
-
70  
-=cut
71  
-
72  
-__PACKAGE__->set_primary_key("em_id");
73  
-
74  
-=head1 RELATIONS
75  
-
76  
-=head2 entities
77  
-
78  
-Type: has_many
79  
-
80  
-Related object: L<X_Db::Schema::Result::Entity>
81  
-
82  
-=cut
83  
-
84  
-__PACKAGE__->has_many(
85  
-  "entities",
86  
-  "X_Db::Schema::Result::Entity",
87  
-  { "foreign.em_id" => "self.em_id" },
88  
-  { cascade_copy => 0, cascade_delete => 1 },
89  
-);
90  
-
91  
-
92  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
93  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RghMxcHDvht6RC2RFsl3nQ
94  
-
95  
-
96  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
97  
-1;
96  lib/X_Db/Schema/Result/I2i.pm
... ...
@@ -1,96 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema::Result::I2i;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-=head1 NAME
8  
-
9  
-X_Db::Schema::Result::I2i
10  
-
11  
-=cut
12  
-
13  
-use strict;
14  
-use warnings;
15  
-
16  
-use base 'DBIx::Class::Core';
17  
-
18  
-=head1 TABLE: C<i2i>
19  
-
20  
-=cut
21  
-
22  
-__PACKAGE__->table("i2i");
23  
-
24  
-=head1 ACCESSORS
25  
-
26  
-=head2 src_id
27  
-
28  
-  data_type: 'integer'
29  
-  is_foreign_key: 1
30  
-  is_nullable: 0
31  
-
32  
-=head2 tgt_id
33  
-
34  
-  data_type: 'integer'
35  
-  is_foreign_key: 1
36  
-  is_nullable: 0
37  
-
38  
-=head2 bus_rule
39  
-
40  
-  data_type: 'text'
41  
-  is_nullable: 1
42  
-
43  
-=cut
44  
-
45  
-__PACKAGE__->add_columns(
46  
-  "src_id",
47  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
48  
-  "tgt_id",
49  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
50  
-  "bus_rule",
51  
-  { data_type => "text", is_nullable => 1 },
52  
-);
53  
-
54  
-=head1 RELATIONS
55  
-
56  
-=head2 src
57  
-
58  
-Type: belongs_to
59  
-
60  
-Related object: L<X_Db::Schema::Result::Item>
61  
-
62  
-=cut
63  
-
64  
-__PACKAGE__->belongs_to(
65  
-  "src",
66  
-  "X_Db::Schema::Result::Item",
67  
-  { it_id => "src_id" },
68  
-  { is_deferrable => 1, 
69  
-    cascade_delete => 1,
70  
-    on_delete => "CASCADE", on_update => "CASCADE" },
71  
-);
72  
-
73  
-=head2 tgt
74  
-
75  
-Type: belongs_to
76  
-
77  
-Related object: L<X_Db::Schema::Result::Item>
78  
-
79  
-=cut
80  
-
81  
-__PACKAGE__->belongs_to(
82  
-  "tgt",
83  
-  "X_Db::Schema::Result::Item",
84  
-  { it_id => "tgt_id" },
85  
-  { is_deferrable => 1, 
86  
-    cascade_delete => 1,
87  
-    on_delete => "CASCADE", on_update => "CASCADE" },
88  
-);
89  
-
90  
-
91  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
92  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fVV0WGO1ICWBxEL3S//H2w
93  
-
94  
-
95  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
96  
-1;
156  lib/X_Db/Schema/Result/Item.pm
... ...
@@ -1,156 +0,0 @@
1  
-use utf8;
2  
-package X_Db::Schema::Result::Item;
3  
-
4  
-# Created by DBIx::Class::Schema::Loader
5  
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
-
7  
-=head1 NAME
8  
-
9  
-X_Db::Schema::Result::Item
10  
-
11  
-=cut
12  
-
13  
-use strict;
14  
-use warnings;
15  
-
16  
-use base 'DBIx::Class::Core';
17  
-
18  
-=head1 TABLE: C<item>
19  
-
20  
-=cut
21  
-
22  
-__PACKAGE__->table("item");
23  
-
24  
-=head1 ACCESSORS
25  
-
26  
-=head2 it_id
27  
-
28  
-  data_type: 'integer'
29  
-  is_auto_increment: 1
30  
-  is_nullable: 0
31  
-
32  
-=head2 seq
33  
-
34  
-  data_type: 'numeric'
35  
-  is_nullable: 1
36  
-  size: 4
37  
-
38  
-=head2 et_id
39  
-
40  
-  data_type: 'integer'
41  
-  is_foreign_key: 1
42  
-  is_nullable: 0
43  
-
44  
-=head2 name
45  
-
46  
-  data_type: 'text'
47  
-  is_nullable: 1
48  
-
49  
-=head2 type
50  
-
51  
-  data_type: 'char'
52  
-  is_nullable: 1
53  
-  size: 100
54  
-
55  
-=head2 scale
56  
-
57  
-  data_type: 'smallint'
58  
-  is_nullable: 1
59  
-
60  
-=head2 precision
61  
-
62  
-  data_type: 'smallint'
63  
-  is_nullable: 1
64  
-
65  
-=head2 bus_rule
66  
-
67  
-  data_type: 'text'
68  
-  is_nullable: 1
69  
-
70  
-=cut
71  
-
72  
-__PACKAGE__->add_columns(
73  
-  "it_id",
74  
-  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
75  
-  "seq",
76  
-  { data_type => "numeric", is_nullable => 1, size => 4 },
77  
-  "et_id",
78  
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
79  
-  "name",
80  
-  { data_type => "text", is_nullable => 1 },
81  
-  "type",
82  
-  { data_type => "char", is_nullable => 1, size => 100 },
83  
-  "scale",
84  
-  { data_type => "smallint", is_nullable => 1 },
85  
-  "precision",
86  
-  { data_type => "smallint", is_nullable => 1 },
87  
-  "bus_rule",
88  
-  { data_type => "text", is_nullable => 1 },
89  
-);
90  
-
91  
-=head1 PRIMARY KEY
92  
-
93  
-=over 4
94  
-
95  
-=item * L</it_id>
96  
-
97  
-=back
98  
-
99  
-=cut
100  
-
101  
-__PACKAGE__->set_primary_key("it_id");
102  
-
103  
-=head1 RELATIONS
104  
-
105  
-=head2 et
106  
-
107  
-Type: belongs_to
108  
-
109  
-Related object: L<X_Db::Schema::Result::Entity>
110  
-
111  
-=cut
112  
-
113  
-__PACKAGE__->belongs_to(
114  
-  "et",
115  
-  "X_Db::Schema::Result::Entity",
116  
-  { et_id => "et_id" },
117  
-  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
118  
-);
119  
-
120  
-=head2 i2i_srcs
121  
-
122  
-Type: has_many
123  
-
124  
-Related object: L<X_Db::Schema::Result::I2i>
125  
-
126  
-=cut
127  
-
128  
-__PACKAGE__->has_many(
129  
-  "i2i_srcs",
130  
-  "X_Db::Schema::Result::I2i",
131  
-  { "foreign.src_id" => "self.it_id" },
132  
-  { cascade_copy => 0, cascade_delete => 1 },
133  
-);
134  
-
135  
-=head2 i2i_tgts
136  
-
137  
-Type: has_many
138  
-
139  
-Related object: L<X_Db::Schema::Result::I2i>
140  
-
141  
-=cut
142  
-
143  
-__PACKAGE__->has_many(
144  
-  "i2i_tgts",
145  
-  "X_Db::Schema::Result::I2i",
146  
-  { "foreign.tgt_id" => "self.it_id" },
147  
-  { cascade_copy => 0, cascade_delete => 1 },
148  
-);
149  
-
150  
-
151  
-# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-07 20:41:59
152  
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sd0SRS+C/U0RIl1atIMYig
153  
-
154  
-
155  
-# You can replace this text with custom code or comments, and it will be preserved on regeneration
156  
-1;
4  mojo/lib/STM.pm
... ...
@@ -1,12 +1,12 @@
1 1
 package STM;
2 2
 use Mojo::Base 'Mojolicious';
3 3
 use Data::Dumper;
4  
-use X_Db::Schema;
  4
+use Schema;
5 5
 use X_Db;
6 6
 
7 7
 has schema => sub {
8 8
   # return Schema->connect('dbi:SQLite:' . ($ENV{TEST_DB} || 'test.db'));
9  
-    return X_Db::Schema->connect ( sub {X_Db::connect('MIS') });
  9
+    return Schema->connect ( sub {X_Db::connect('MIS') });
10 10
 };
11 11
 
12 12
 # This method will run once at server start
22  mojo/templates/entdet.html.ep
... ...
@@ -1,25 +1,21 @@
1 1
 % title 'Entity Detail';
2 2
 %  my $rs;
  3
+%  my $cols= [ qw(  tgt_itm_nm tgt_itm_type tgt_itm_scale 
  4
+%            bus_rule src_itm_nm 
  5
+%          src_itm_type src_itm_scale src_ent_nm)  ];
3 6
 %  if (param('src')) {
4 7
 %    $rs = $self->app->schema->resultset('EntDetVw')->search(
5 8
 %            { 'tgt_ent_nm' => param('tgt'),
6  
-%              'src_ent_nm' => param('src')  },{
7  
-%        distinct => 1});
  9
+%              'src_ent_nm' => param('src')  },{ 
  10
+%       columns=> $cols ,distinct => 1});
8 11
 <%= include 'tabout', partial => 1,
9 12
     title => param('tgt') . '<-' . param('src'), 
10  
-            rs=> $rs, chk_blanks => 0  ,
11  
-        url => {tgt_ent_nm => '/entlist?tgt=tgt_ent_nm',
12  
-    src_ent_nm => '/entlist?tgt=tgt_ent_nm&src=src_ent_nm'}
13  
-%>
  13
+            rs=> $rs, chk_blanks => 0  , url => {} %>
14 14
 %  } else {
15 15
 %    $rs = $self->app->schema->resultset('EntDetVw')->search(
16  
-%            { 'tgt_ent_nm' => param('tgt') },{
17  
-%        columns => [qw(tgt_itm_nm bus_rule 
18  
-%                src_itm_nm src_ent_nm )], distinct => 1});
  16
+%            { 'tgt_ent_nm' => param('tgt') },
  17
+%           {columns=> $cols, distinct => 1});
19 18
 <%= include 'tabout', partial => 1,
20  
-    title => param('tgt'), rs=> $rs, chk_blanks => 2  ,
21  
-        url => {tgt_ent_nm => '/entlist?tgt=tgt_ent_nm',
22  
-    src_ent_nm => '/entlist?tgt=tgt_ent_nm&src=src_ent_nm'}
23  
-%>
  19
+    title => param('tgt'), rs=> $rs, chk_blanks => 2  , url => {} %>
24 20
 % }
25 21
 <br>
8  mojo/templates/search.html.ep
@@ -10,8 +10,13 @@
10 10
 %   my $match=param('match');
11 11
 <H3>Entities</H3>
12 12
 % {
  13
+%    my $em_rs = $self->app->schema->resultset('EntityMaster')->search(
  14
+%       {max_version => 1});
  15
+%    while (my $em=$em_rs->next) {
  16
+<H3><%= $em->name %></H3>
13 17
 %    my $rs = $self->app->schema->resultset('EntDetVw')->search(
14  
-%      \[ 'tgt_ent_nm like ? OR src_ent_nm like ? ', 
  18
+%      \[ 'em_nm=? AND (tgt_ent_nm like ? OR src_ent_nm like ?) ', 
  19
+%            [ 'em_nm', $em->name  ], 
15 20
 %            [ 'tgt_ent_nm', '%' . param('match') . '%'  ], 
16 21
 %            [ 'src_ent_nm', '%' . param('match') . '%'  ], ],
17 22
 %        { columns => [qw(tgt_ent_nm src_ent_nm )],
@@ -21,6 +26,7 @@
21 26
         url => {tgt_ent_nm => '/entdet?tgt=tgt_ent_nm',
22 27
     src_ent_nm => '/entdet?tgt=tgt_ent_nm&src=src_ent_nm'}
23 28
 %>
  29
+% }
24 30
 <br>
25 31
 <H3>Items</H3>
26 32
 %  }
9  mojo/templates/upload.html.ep
... ...
@@ -1,5 +1,6 @@
1 1
 % title 'Upload';
2 2
 % use Data::Dumper;
  3
+% use Try::Tiny;
3 4
 %= form_for upload => (method => 'post')=> (enctype => 'multipart/form-data')=> begin
4 5
 %= file_field 'example'
5 6
 %= submit_button 'Upload'
@@ -12,11 +13,17 @@
12 13
 
13 14
 %        my $size = $example->size;
14 15
 %        my $name = $example->filename;
  16
+%        my $curr_dt=scalar localtime;
  17
+%        $curr_dt=~s/ /-/g;$curr_dt=~s/--*/-/g;
  18
+%#        try {
  19
+%#          system qq[mv $ENV{MIS}/tmp/$name $ENV{MIS}/tmp/${name}$curr_dt ];
  20
+%#        }
15 21
 %        $example->move_to(qq[$ENV{MIS}/tmp/$name]);
  22
+%        
16 23
 %        # print STDERR Dumper(\$example);
17 24
 <br>
18 25
 Thanks for uploading <%= $size %> byte file <%= $name %>.<br> 
19 26
 % my $x= join("<br>",split (/\n/,
20  
-%            qx[$ENV{MIS}/parsexcel.pl $ENV{MIS}/tmp/$name] ));
  27
+%            qx[$ENV{MIS}/script/parsexcel.pl $ENV{MIS}/tmp/$name] ));
21 28
 <%== $x %>
22 29
 % }
38  script/parsexcel.pl
@@ -136,7 +136,6 @@ sub assign_val {
136 136
         'Num' => 0,
137 137
       };
138 138
 }
139  
-
140 139
 #---------------------------------------------
141 140
 # hash used to keep track of max seq number in an entity
142 141
 #
@@ -350,16 +349,20 @@ =head1 Testing
350 349
 from item b, entity c, entity_master d 
351 350
 where b.et_id=c.et_id and c.em_id=d.em_id group by d.name,d.version;
352 351
 
353  
-select name,uploaded,version from entity_master;
  352
+select name,uploaded,version,max_version from entity_master;
354 353
 
355  
-select name from item where name like '%_AMT%';
  354
+select distinct type,scale from item;
356 355
 
357 356
 select b.name,b.bus_rule
358 357
 from item b, entity c, entity_master d 
359 358
 where b.et_id=c.et_id and c.em_id=d.em_id 
360 359
 and c.name = 'CAMPAIGN_STB_REWARDS_YYYYMMDDHHMM.txt';
361 360
 
362  
-select name,version,max_version from entity_master;
  361
+select name, version, max_version from entity_master;
  362
+
  363
+select a.name from item a, entity b
  364
+where a.et_id=b.et_id and b.name like '%MI_STB_REWARD_ALLOCATION_T%'
  365
+order by a.seq;
363 366
 
364 367
 SELECT me.em_id, me.name, me.rel_notes, me.author, me.uploaded, me.version 
365 368
 FROM entity_master me 
@@ -369,3 +372,30 @@ =head1 Testing
369 372
     WHERE iner.name = 'FEWR dfsdfs' 
370 373
 ) 
371 374
 AND name = 'FEWR dfsdfs';
  375
+
  376
+
  377
+
  378
+SELECT me.tgt_ent_nm, me.tgt_itm_nm, me.tgt_itm_type, 
  379
+me.tgt_itm_scale, me.bus_rule, me.src_itm_nm, 
  380
+me.src_itm_type, me.src_itm_scale, me.src_ent_nm FROM (
  381
+select  b.name tgt_ent_nm,a.name tgt_itm_nm,
  382
+        a.type tgt_itm_type, a.scale tgt_itm_scale,
  383
+        a.bus_rule,
  384
+        ifnull(f.src_itm_nm,' ') src_itm_nm,
  385
+        ifnull(f.src_itm_type,' ') src_itm_type,
  386
+        ifnull(f.src_itm_scale,' ') src_itm_scale,
  387
+        ifnull(f.src_ent_nm,' ') src_ent_nm
  388
+    from item a join entity b on a.et_id=b.et_id
  389
+    join entity_master c on b.em_id=c.em_id
  390
+    join (select c.tgt_id,d.name src_itm_nm,
  391
+        d.type src_itm_type, d.scale src_itm_scale,
  392
+        e.name src_ent_nm,d.seq src_seq
  393
+        from i2i c, item d, entity e
  394
+        where c.src_id=d.it_id and d.et_id=e.et_id) f
  395
+    on a.it_id=f.tgt_id
  396
+    where c.max_version=1
  397
+    order by a.seq,f.src_seq
  398
+) me WHERE ( tgt_ent_nm = 'IDMI01.MI_STB_REWARD_ALLOCATION_T' ) 
  399
+GROUP BY me.tgt_ent_nm, me.tgt_itm_nm, me.tgt_itm_type, 
  400
+me.tgt_itm_scale, me.bus_rule, me.src_itm_nm, me.src_itm_type, 
  401
+me.src_itm_scale, me.src_ent_nm;

0 notes on commit 046670b

Please sign in to comment.
Something went wrong with that request. Please try again.