@Test public void testFrom() { Configuration config = new BaseConfiguration(); String[] excludes = {"ID1", "ID2", "ID3"}; config.addProperty(Kramerius4ExportOptions.PROP_EXCLUDE_DATASTREAM_ID, excludes); config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID1", "NEWID1"); config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID2", "NEWID2"); String policy = "policy:public"; config.addProperty(Kramerius4ExportOptions.PROP_POLICY, policy); Kramerius4ExportOptions result = Kramerius4ExportOptions.from(config); assertEquals(new HashSet<String>(Arrays.asList(excludes)), result.getExcludeDatastreams()); assertEquals("NEWID1", result.getDsIdMap().get("ID1")); assertEquals("NEWID2", result.getDsIdMap().get("ID2")); assertEquals(policy, result.getPolicy()); }
public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next(); String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; }
Kramerius4ExportOptions { public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next(); String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; } }
Kramerius4ExportOptions { public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next(); String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; }  }
Kramerius4ExportOptions { public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next(); String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; }  static Kramerius4ExportOptions from(Configuration config); Set<String> getExcludeDatastreams(); void setExcludeDatastreams(Set<String> excludeDatastreams); Map<String, String> getDsIdMap(); void setDsIdMap(Map<String, String> dsIdMap); String getPolicy(); void setPolicy(String policy); Map<String, String> getRelationMap(); void setRelationMap(Map<String, String> relationMap); Map<String, String> getModelMap(); }
Kramerius4ExportOptions { public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next(); String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; }  static Kramerius4ExportOptions from(Configuration config); Set<String> getExcludeDatastreams(); void setExcludeDatastreams(Set<String> excludeDatastreams); Map<String, String> getDsIdMap(); void setDsIdMap(Map<String, String> dsIdMap); String getPolicy(); void setPolicy(String policy); Map<String, String> getRelationMap(); void setRelationMap(Map<String, String> relationMap); Map<String, String> getModelMap();  }