integration/js/ldt-serializer.js
changeset 42 40909e8d6855
parent 41 3ec2343f2b85
child 43 5a5024bc74e6
equal deleted inserted replaced
41:3ec2343f2b85 42:40909e8d6855
   119                         description : _data.description,
   119                         description : _data.description,
   120                         audio : _data.audio
   120                         audio : _data.audio
   121                     },
   121                     },
   122                     media : _data.media.id,
   122                     media : _data.media.id,
   123                     meta : {
   123                     meta : {
   124                         "id-ref" : _data.annotationType.id,
   124                         "id-ref" : _data.getAnnotationType().id,
   125                         "dc:created" : IriSP.Model.dateToIso(_data.created),
   125                         "dc:created" : IriSP.Model.dateToIso(_data.created),
   126                         "dc:creator" : _data.creator,
   126                         "dc:creator" : _data.creator,
   127                         project : _source.projectId
   127                         project : _source.projectId
   128                     },
   128                     },
   129                     tags : IriSP._(_data.tag.id).map(function(_id) {
   129                     tags : IriSP._(_data.tag.id).map(function(_id) {
   153                         "dc:title": _data.title,
   153                         "dc:title": _data.title,
   154                         "dc:description": _data.description,
   154                         "dc:description": _data.description,
   155                         listtype: "mashup"
   155                         listtype: "mashup"
   156                     },
   156                     },
   157                     items: _data.segments.map(function(_annotation) {
   157                     items: _data.segments.map(function(_annotation) {
   158                         return _id;
   158                         return _annotation.annotation.id;
   159                     }),
   159                     }),
   160                     id: _data.id
   160                     id: _data.id
   161                 }
   161                 }
   162             }
   162             }
   163         }
   163         }
   164     },
   164     },
   165     serialize : function(_source) {
   165     serialize : function(_source) {
   166         var _res = {},
   166         var _res = {
       
   167                 meta: {
       
   168                     "dc:creator": _source.creator,
       
   169                     "dc:created": IriSP.Model.dateToIso(_source.created),
       
   170                     "dc:title": _source.title,
       
   171                     "dc:description": _source.description,
       
   172                     "id": _source.projectId || _source.id
       
   173                 },
       
   174                 views: []
       
   175             },
   167             _this = this;
   176             _this = this;
   168         _source.forEach(function(_list, _typename) {
   177         _source.forEach(function(_list, _typename) {
   169             if (typeof _this.types[_typename] !== "undefined") {
   178             if (typeof _this.types[_typename] !== "undefined") {
   170                 _res[_this.types[_typename].serialized_name] = _list.map(function(_el) {
   179                 _res[_this.types[_typename].serialized_name] = _list.map(function(_el) {
   171                     return _this.types[_typename].serializer(_el, _source);
   180                     return _this.types[_typename].serializer(_el, _source);