/** * Obtains an instance from a security, locking by strong object identifier if possible and the * external identifier bundle if not. The result will contain the resolved target and one type of * reference. * * @param security the security to store, not null * @return the link with target and object identifier set, not null */ public static ManageableSecurityLink of(Security security) { ArgumentChecker.notNull(security, "security"); ManageableSecurityLink link = new ManageableSecurityLink(); link.setAndLockTarget(security); if (link.getObjectId() == null) { link.setExternalId(security.getExternalIdBundle()); } return link; }
/** * Obtains an instance from a security, locking by external identifier bundle. The result will * contain the external identifier bundle and the resolved target. * * @param security the security to store, not null * @return the link with target and identifier bundle set, not null */ public static ManageableSecurityLink ofBundleId(Security security) { ArgumentChecker.notNull(security, "security"); ManageableSecurityLink link = new ManageableSecurityLink(security.getExternalIdBundle()); link.setTarget(security); return link; }