Changeset 1604
- Timestamp:
- 10/31/11 12:55:36 (13 years ago)
- Location:
- ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java
r1378 r1604 31 31 */ 32 32 List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException; 33 34 /** 35 * 36 * @return List of profile descriptions ordered by name ascending, only the ones marked for showing in metadata editor 37 * @throws ComponentRegistryException 38 */ 39 List<ProfileDescription> getProfileDescriptionsForMetadaEditor() throws ComponentRegistryException; 33 40 34 41 ProfileDescription getProfileDescription(String id) throws ComponentRegistryException; -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/ComponentRegistryImplBase.java
r1364 r1604 54 54 } 55 55 return result; 56 } 57 58 /** 59 * 60 * @return List of profile descriptions ordered by name ascending, only the ones marked for showing in metadata editor 61 * @throws ComponentRegistryException 62 */ 63 @Override 64 public List<ProfileDescription> getProfileDescriptionsForMetadaEditor() throws ComponentRegistryException { 65 // TODO: Below can also be done by accepting and passing a parameter in the ProfileDescriptionDao, should have better performance 66 67 // Get all profile descriptions 68 List<ProfileDescription> descriptionsCollection = getProfileDescriptions(); 69 // Filter out ones that do should not be shown for metadata editor 70 ArrayList<ProfileDescription> descriptions = new ArrayList<ProfileDescription>(descriptionsCollection.size()); 71 for (ProfileDescription profile : descriptionsCollection) { 72 if (((ProfileDescription) profile).isShowInEditor()) { 73 descriptions.add((ProfileDescription) profile); 74 } 75 } 76 // Return filtered list 77 return descriptions; 56 78 } 57 79 … … 122 144 return result.toString(); 123 145 } 124 125 146 } -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
r1465 r1604 91 91 } 92 92 } 93 93 94 94 @Override 95 95 public ProfileDescription getProfileDescription(String id) throws ComponentRegistryException { -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ProfileDescriptionDao.java
r1602 r1604 5 5 import java.sql.ResultSet; 6 6 import java.sql.SQLException; 7 import java.util.ArrayList;8 import java.util.Collection;9 7 import java.util.Collections; 10 8 import java.util.List; -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r1562 r1604 64 64 public static final String DOMAIN_FORM_FIELD = "domainName"; 65 65 public static final String USERSPACE_PARAM = "userspace"; 66 public static final String METADATA_EDITOR_PARAM = "mdEditor"; 66 67 @Inject(value = "componentRegistryFactory") 67 68 private ComponentRegistryFactory componentRegistryFactory; … … 107 108 @Path("/profiles") 108 109 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 109 public List<ProfileDescription> getRegisteredProfiles(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 110 public List<ProfileDescription> getRegisteredProfiles(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace, 111 @QueryParam(METADATA_EDITOR_PARAM) @DefaultValue("false") boolean metadataEditor) throws ComponentRegistryException { 110 112 long start = System.currentTimeMillis(); 111 List<ProfileDescription> profiles = getRegistry(userspace).getProfileDescriptions(); 113 114 List<ProfileDescription> profiles; 115 if (metadataEditor) { 116 profiles = getRegistry(userspace).getProfileDescriptionsForMetadaEditor(); 117 } else { 118 profiles = getRegistry(userspace).getProfileDescriptions(); 119 } 120 112 121 LOG.info("Releasing " + profiles.size() + " registered profiles into the world (" + (System.currentTimeMillis() - start) 113 122 + " millisecs)"); … … 211 220 List<ComponentDescription> components = registry.getUsageInComponents(componentId); 212 221 List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId); 213 222 214 223 LOG.info("Found " + components.size() + " components and " + profiles.size() + " profiles that use component " + componentId 215 224 + " (" + (System.currentTimeMillis() - start) + " millisecs)"); 216 225 217 226 List<AbstractDescription> usages = new ArrayList<AbstractDescription>(components.size() + profiles.size()); 218 227 usages.addAll(components); … … 225 234 } 226 235 } 227 236 228 237 /** 229 238 *
Note: See TracChangeset
for help on using the changeset viewer.