/** * The "Add Identifier" button is clicked on the panel. * * @param identifierTable */ protected void addIdentifierActionPerformed( DomainSortableTable identifierTable, Resources model) { ArchDescComponentIdentifiers newArchDescComponentIdentifier; DomainEditor dialog = new DomainEditor( ArchDescComponentIdentifiers.class, editorField.getParentEditor(), "Add Identifier", new ArchDescComponentIdentifiersFields()); dialog.setNavigationButtonListeners((ActionListener) editorField.getParentEditor()); dialog.setNewRecord(true); boolean done = false; int returnStatus; while (!done) { newArchDescComponentIdentifier = new ArchDescComponentIdentifiers(model); dialog.setModel(newArchDescComponentIdentifier, null); returnStatus = dialog.showDialog(); if (returnStatus == JOptionPane.OK_OPTION) { model.addArchDescComponentIdentifier(newArchDescComponentIdentifier); identifierTable.updateCollection(model.getArchDescComponentIdentifiers()); done = true; } else if (returnStatus == StandardEditor.OK_AND_ANOTHER_OPTION) { model.addArchDescComponentIdentifier(newArchDescComponentIdentifier); identifierTable.updateCollection(model.getArchDescComponentIdentifiers()); } else { done = true; } } }
public void processElement(Resources resource, Object o, InfiniteProgressPanel progressPanel) throws UnsupportedRepeatingDataTypeException { DataFieldType dataField = (DataFieldType) o; String titles[] = {"a", "b", "c", "d", "e", "f", "g"}; Vector<String> titlesV; titlesV = BYU_MARCIngest.arrayToVector(titles); String title = BYU_MARCIngest.getSpecificSubCodeValuesAsDelimitedString(dataField, titlesV, ","); NotesEtcTypes noteType = NoteEtcTypesUtils.lookupNoteEtcTypeByCannonicalName("General note"); ArchDescriptionNotes adn = new ArchDescriptionNotes( resource, "Mathematical map data", NotesEtcTypes.DATA_TYPE_NOTE, resource.getRepeatingData().size() + 1, noteType, title); adn.setPersistentId(resource.getNextPersistentIdAndIncrement()); resource.addRepeatingData(adn); }
private void addResource( Accessions accession, IdentifierType resourceId, DomainImportController controller, String accesionNumber, int recordNumber) throws ImportException { if (resourceId != null) { String resourceId1; String resourceId2 = null; String resourceId3 = null; String resourceId4 = null; if (resourceId.getComposite() != null) { resourceId1 = StringHelper.trimToLength( resourceId.getComposite(), ATFieldInfo.checkFieldLength( Resources.class, Resources.PROPERTYNAME_RESOURCE_IDENTIFIER_1)); } else { resourceId1 = resourceId.getPart1(); resourceId2 = resourceId.getPart2(); resourceId3 = resourceId.getPart3(); resourceId4 = resourceId.getPart4(); } ResourcesDAO resourceDao = new ResourcesDAO(); Resources resource; if (resourceCreation.equalsIgnoreCase(AccessionImportXmlHandler.RESOURCE_CREATION_NONE)) { resource = resourceDao.lookupResource( resourceId1, resourceId2, resourceId3, resourceId4, false, repository); } else { resource = resourceDao.lookupResource( resourceId1, resourceId2, resourceId3, resourceId4, true, repository); } if (resourceDao.getNewRecordCreated() && resourceCreation.equalsIgnoreCase(AccessionImportXmlHandler.RESOURCE_CREATION_FULL)) { try { resource = (Resources) resourceDao.findByPrimaryKeyLongSession(resource.getIdentifier()); resource.populateResourceFromAccession(accession); resourceDao.updateLongSession(resource); } catch (LookupException e) { throw new ImportException( "Error creating resource: " + resourceId + ", " + e.getMessage(), e); } catch (PersistenceException e) { throw new ImportException( "Error creating resource: " + resourceId + ", " + e.getMessage(), e); } catch (DuplicateLinkException e) { throw new ImportException( "Error creating resource: duplicate link" + resourceId + ", " + e.getMessage(), e); } } if (resource != null) { AccessionsResources accessionResource = new AccessionsResources(resource, accession); accession.addAccessionsResources(accessionResource); } } else { if (!resourceCreation.equalsIgnoreCase(AccessionImportXmlHandler.RESOURCE_CREATION_NONE)) { controller.addLineToImportLog( "Record # " + recordNumber + " - " + accesionNumber + " has no resource id so no resource record was created"); } } }