private List<Property<Serializable>> getIdProperties(Object resource) { Class<?> resourceClass = unwrapResourceClass(resource); if (!idProperties.containsKey(resourceClass)) { queryIdProperties(resourceClass); } return idProperties.get(resourceClass); }
public PermissionHandlerPolicy(Set<PermissionHandler> handlers) { if (handlers == null || handlers.isEmpty()) { registeredHandlers.add(new EntityPermissionHandler()); registeredHandlers.add(new ClassPermissionHandler()); registeredHandlers.add(new StringPermissionHandler()); } }
/** * TODO we only support @Id identifiers at the moment, still need to add support for @EmbeddedId etc * * @param resource * @return */ @Override public Serializable getIdentifier(Object resource) { List<Property<Serializable>> props = getIdProperties(resource); // If the entity has a single @Id property, return it if (props.size() == 1) { return props.get(0).getValue(resource); // Otherwise return a colon-separated list } else if (props.size() > 1) { StringBuilder sb = new StringBuilder(); for (Property<Serializable> p : props) { if (sb.length() > 0) { sb.append(SEPARATOR); } sb.append(p.getValue(resource).toString()); } return sb.toString(); } else { throw new IdentityManagementException( String.format("Could not locate @Id property for specified resource [%s]", resource)); } }
public PermissionHandlerPolicy(Set<PermissionHandler> handlers) { if (handlers == null || handlers.isEmpty()) { registeredHandlers.add(new EntityPermissionHandler()); registeredHandlers.add(new ClassPermissionHandler()); registeredHandlers.add(new StringPermissionHandler()); } }
/** * TODO we only support @Id identifiers at the moment, still need to add support for @EmbeddedId etc * * @param resource * @return */ @Override public Serializable getIdentifier(Object resource) { List<Property<Serializable>> props = getIdProperties(resource); // If the entity has a single @Id property, return it if (props.size() == 1) { return props.get(0).getValue(resource); // Otherwise return a colon-separated list } else if (props.size() > 1) { StringBuilder sb = new StringBuilder(); for (Property<Serializable> p : props) { if (sb.length() > 0) { sb.append(SEPARATOR); } sb.append(p.getValue(resource).toString()); } return sb.toString(); } else { throw new IdentityManagementException( String.format("Could not locate @Id property for specified resource [%s]", resource)); } }
private List<Property<Serializable>> getIdProperties(Object resource) { Class<?> resourceClass = unwrapResourceClass(resource); if (!idProperties.containsKey(resourceClass)) { queryIdProperties(resourceClass); } return idProperties.get(resourceClass); }