@GET @Path("/getmultiple/{types}") public XMLEntityMappings getMutlipleType(@PathParam("types") String types) throws Exception { XMLEntityMappings entityMaps = MetaSourceBuilder.createEmptyEntityMappings(); Set<String> processed = new HashSet<>(); String[] names = types.split(","); for (String typename : names) { if (processed.contains(typename)) { continue; } ClassAccessor accessor = JpaMapHelper.findClassAccessor(DynamicMetaSource.getEntityMaps(), typename); if (accessor == null) { continue; } JpaMapHelper.addClassAccessor(entityMaps, accessor); TableGeneratorMetadata meta = JpaMapHelper.retrieveTableGenerator(DynamicMetaSource.getEntityMaps(), accessor); if (meta != null) { entityMaps.getTableGenerators().add(meta); } } return entityMaps; }
@GET @Path("/getsingle/{typename}") public XMLEntityMappings getSingleType(@PathParam("typename") String typename) throws Exception { XMLEntityMappings entityMaps = MetaSourceBuilder.createEmptyEntityMappings(); ClassAccessor accessor = JpaMapHelper.findClassAccessor(DynamicMetaSource.getEntityMaps(), typename); if (accessor == null) { throw new HttpCodeException( Status.NO_CONTENT.getStatusCode(), "type " + typename + " is not found"); } JpaMapHelper.addClassAccessor(entityMaps, accessor); TableGeneratorMetadata meta = JpaMapHelper.retrieveTableGenerator(DynamicMetaSource.getEntityMaps(), accessor); if (meta != null) { entityMaps.getTableGenerators().add(meta); } return entityMaps; }