<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>Hi Esha-</div>
<div><br>
</div>
<div>I think you'll want something like the following, where I'm adding the ead_id to a new 035 field.</div>
<div><br>
</div>
<div>
<div> def datafields</div>
<div> extra_fields = []</div>
<div> </div>
<div> if @record.aspace_record.ead_id</div>
<div> extra_fields << DataField.new('035', ' ', ' ', [SubField.new('a', @record.aspace_record.ead_id)])</div>
<div> end</div>
</div>
<div><br>
</div>
<div>
<div> (@record.datafields + extra_fields).sort_by(&:tag)</div>
<div> end</div>
</div>
<div><br>
</div>
<div>There's a complete view of what Dartmouth is doing - at least in my local test environment against v1.4+ here:
<a href="https://github.com/jdshaw/dartmouth_udf_exports/tree/1.5-compatible">https://github.com/jdshaw/dartmouth_udf_exports/tree/1.5-compatible</a> I've optimistically labeled it 1.5+ compatible, but I think it should work with 1.4 as well. It's a work in
progress, so feel free to let me know if you spot some major nastiness!</div>
<div><br>
</div>
<div>We haven't updated from 1.3 in production yet, but I've rolled most of the changes to the exporter into a 1.3 version which ca be found here: https://github.com/jdshaw/dartmouth_udf_exports</div>
<div><br>
</div>
<div>Best,</div>
<div>Joshua</div>
<div><br>
</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Esha Datta<br>
<span style="font-weight:bold">Reply-To: </span>"<a href="mailto:esha@nyu.edu">esha@nyu.edu</a>", Archivesspace Users Group<br>
<span style="font-weight:bold">Date: </span>Tuesday, March 1, 2016 at 1:16 PM<br>
<span style="font-weight:bold">To: </span>Archivesspace Users Group<br>
<span style="font-weight:bold">Subject: </span>[Archivesspace_Users_Group] marcxml exporter plugin questions<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am trying to write a plugin to apply some custom mappings to the marc export for Archives Space records. I am using Hudson Molonglo's <a href="https://github.com/hudmol/dartmouth_udf_exports">plugin</a> and the ASpace plugin
<a href="http://archivesspace.github.io/archivesspace/user/archivesspace-plug-ins-readme/">
documentation</a> as a template. My question is how do I access the archives space object? So far, I have created a custom marc serializer class where I specify the class in the MarcSerializer add decorator method. I can inspect the object(record) in the MarcCustomFieldSerialize
class and see the marc record...which is pretty cool. However, I also need to access the archives space object before it's transformed to marc to access some other values.</div>
<div><br>
</div>
<div>I see from the plugin listed above that the MarcModel class is being re-defined in it and is getting the aspace record. It also has some decorator logic which I assume got pulled back into the main code, as I see it there now. However, I'm not sure how
object is being read in the plugin. I see how that's happening in the main source code.</div>
<div><br>
</div>
<div>So far, I have:</div>
<div>plugins/name/</div>
<div>plugin_init.rb:</div>
<div> MARCSerializer.add_decorator(MARCCustomFieldSerialize)</div>
<div>and the class:</div>
<div>plugins/name/backend/lib/</div>
<div>
<div>class MARCCustomFieldSerialize</div>
<div> ControlField = Struct.new(:tag, :text)</div>
<div> DataField = Struct.new(:tag, :ind1, :ind2, :subfields)</div>
<div> SubField = Struct.new(:code, :text)</div>
<div> </div>
<div> def initialize(record)</div>
<div> @record = record</div>
<div> end</div>
<div>end</div>
<div><br>
</div>
<div>I'd really appreciate any feedback on this. Thanks for your time! Please let me know if you need any clarifications.</div>
<div><br>
</div>
<div>Thanks.</div>
<div><br>
</div>
<div>Esha Datta</div>
<div>Senior Programmer/Analyst</div>
<div>Bobst Library</div>
<div>NYU</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</span>
</body>
</html>