/** * */ package at.knowcenter.wag.egov.egiz.sig.sigid; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * @author wprinz * */ public class HotfixIdFormatter implements IdFormatter { /** * The SIG_ID prefix. */ public static final String SIG_ID_PREFIX = "etsi-bka-1.0"; //$NON-NLS-1$ /** * The log. */ private static Log log = LogFactory.getLog(HotfixIdFormatter.class); /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ public String formatIds(String[] ids) { // ids algorithm: String join = ""; //$NON-NLS-1$ String base = null; for (int arr_idx = 0; arr_idx < ids.length; arr_idx++) { String id = ids[arr_idx]; if (log.isDebugEnabled()) { log.debug("Set BKU id:" + id); //$NON-NLS-1$ } int id_idx = id.lastIndexOf("-"); //$NON-NLS-1$ if (arr_idx == 0) { base = id.substring(0, id_idx); } String cur_id = id.substring(id_idx + 1); join += "-" + cur_id; //$NON-NLS-1$ } String idstr = base + "@" + join.substring(1); //$NON-NLS-1$ String final_ids = SIG_ID_PREFIX + "@" + idstr; return final_ids; } }