Source:
<code>protected void registerFilePidsIfNeeded(Dataset theDataset, CommandContext ctxt, boolean b) throws CommandException { String protocol = theDataset.getProtocol(); String authority = theDataset.getAuthority(); GlobalIdServiceBean idServiceBean = GlobalIdServiceBean.getBean(protocol, ctxt); String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, ""); String currentGlobalAuthority = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Authority, ""); String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT"); <START> boolean shouldRegister = ctxt.systemConfig().isFilePIDsEnabled() END> && !idServiceBean.registerWhenPublished() &&((currentGlobalIdProtocol.equals(protocol) && currentGlobalAuthority.equals(authority)) || dataFilePIDFormat.equals("INDEPENDENT")); logger.fine("IsFilePIDsEnabled: " + ctxt.systemConfig().isFilePIDsEnabled()); logger.fine("RegWhenPub: " + !idServiceBean.registerWhenPublished()); logger.fine("OK provider: " + ((currentGlobalIdProtocol.equals(protocol) && currentGlobalAuthority.equals(authority)) || dataFilePIDFormat.equals("INDEPENDENT"))); logger.fine("Should register: " + shouldRegister); for (DataFile dataFile : theDataset.getFiles()) { logger.fine(dataFile.getId() + " is registered?: " + dataFile.isIdentifierRegistered()); if (shouldRegister && !dataFile.isIdentifierRegistered()) { registerFileExternalIdentifier(dataFile, idServiceBean, ctxt, true); } } }</code><technical_language>I thinking iterate files below. short circuit iteration simply return early if file level PIDs enabled</technical_language>

Target:
protected void registerFilePidsIfNeeded(Dataset theDataset, CommandContext ctxt, boolean b) throws CommandException { String protocol = theDataset.getProtocol(); String authority = theDataset.getAuthority(); GlobalIdServiceBean idServiceBean = GlobalIdServiceBean.getBean(protocol, ctxt); String currentGlobalIdProtocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, ""); String currentGlobalAuthority = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Authority, ""); String dataFilePIDFormat = ctxt.settings().getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, SystemConfig.DataFilePIDFormat.DEPENDENT.toString()); boolean shouldRegister = ctxt.systemConfig().isFilePIDsEnabled() && !idServiceBean.registerWhenPublished() &&((currentGlobalIdProtocol.equals(protocol) && currentGlobalAuthority.equals(authority)) || dataFilePIDFormat.equals(SystemConfig.DataFilePIDFormat.INDEPENDENT.toString())); logger.fine("IsFilePIDsEnabled: " + ctxt.systemConfig().isFilePIDsEnabled()); logger.fine("RegWhenPub: " + !idServiceBean.registerWhenPublished()); logger.fine("OK provider: " + ((currentGlobalIdProtocol.equals(protocol) && currentGlobalAuthority.equals(authority)) || dataFilePIDFormat.equals(SystemConfig.DataFilePIDFormat.INDEPENDENT.toString()))); logger.fine("Should register: " + shouldRegister); if (shouldRegister) { for (DataFile dataFile : theDataset.getFiles()) { logger.fine(dataFile.getId() + " is registered?: " + dataFile.isIdentifierRegistered()); if (!dataFile.isIdentifierRegistered()) { registerFileExternalIdentifier(dataFile, idServiceBean, ctxt, true); } } } }