Changeset 4125
- Timestamp:
- 12/02/13 14:13:59 (11 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-1.14.0
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/BrowserOverviewList.mxml
r4093 r4125 156 156 event.preventDefault(); 157 157 } else{ 158 if (dataGrid.selectedItem == null) 159 return; 158 160 var groupId:String = event.getGroupId(); 159 161 Alert.show("Items, once moved to a group, can not be moved back to your workspace. Do you want to move this item?", "Title", mx.controls.Alert.YES | mx.controls.Alert.NO, this, function (nestedCloseEvent:CloseEvent):void { … … 171 173 currentSelectedGroup=groupBox.selectedItem.groupId; 172 174 var groupEvent:GroupSelectionEvent = new GroupSelectionEvent(groupBox.selectedItem.groupId, groupBox.selectedItem.label); 173 dispatchEvent(groupEvent);175 Config.instance.dispatchEvent(groupEvent); 174 176 // did someone object this selection? 175 177 if (groupEvent.isDefaultPrevented()){ -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/ExpandingComponentLabel.as
r3660 r4125 13 13 import flash.display.DisplayObject; 14 14 import flash.events.MouseEvent; 15 15 16 16 import mx.containers.VBox; 17 import mx.controls.Alert; 17 18 import mx.controls.Label; 18 19 import mx.managers.CursorManager; … … 30 31 31 32 private var editable:Boolean; 33 34 protected function setItem(item:ItemDescription):void{ 35 this.item = item; 36 } 32 37 33 38 public function ExpandingComponentLabel(componentId:String, editable:Boolean = false) { … … 43 48 this.setStyle("borderColor", StyleConstants.USER_BORDER_COLOR); 44 49 } 50 //unfortunately the componend and profile services may overlook components from groups, so we have to ask the backend 51 if (item!=null) 52 updateView(); 53 else{ 54 Config.instance.getComponentsSrv(Config.SPACE_USER).getComponent(componentId, function(item:ItemDescription):void{ 55 setItem(item); 56 updateView(); 57 }); 58 } 45 59 } 46 47 protected override function createChildren():void { 48 super.createChildren(); 60 61 private function updateView():void{ 49 62 var id:Label = new Label(); 50 63 if (item) { -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BaseRemoteService.as
r3368 r4125 43 43 */ 44 44 protected function dispatchRequest(url:URI):void { 45 trace(url);46 45 readService.setUrl(url); 47 46 var token:AsyncToken = readService.send(); -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as
r3660 r4125 43 43 for each (var item:ItemDescription in itemDescriptions) { 44 44 if (item.id == id) { 45 trace("found "+ id+" in "+itemDescriptions.length+" userSpace= "+space);46 45 return item; 47 46 } 48 47 } 49 trace("not found "+ id+" in "+itemDescriptions+" userSpace= "+space);50 48 return null; 51 49 } -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentRegistryService.as
r3660 r4125 1 1 package clarin.cmdi.componentregistry.services //trunk 2 2 { 3 import clarin.cmdi.componentregistry.common.ItemDescription; 3 4 import clarin.cmdi.componentregistry.services.remote.RemoteService; 4 5 5 6 import com.adobe.net.URI; 6 7 8 import mx.controls.Alert; 9 import mx.rpc.AsyncToken; 10 import mx.rpc.Responder; 7 11 import mx.rpc.http.HTTPService; 8 12 … … 30 34 } 31 35 36 public function getComponent(componentId:String, callback:Function):void{ 37 readService.setUrl(new URI(Config.instance.serviceRootUrl+Config.ITEMS_URL+"/"+componentId+"?userspace=true")); 38 var token:AsyncToken = readService.send(); 39 token.addResponder(new Responder(function(resultEvent):void{ 40 var resultXml:XML = resultEvent.result as XML; 41 var item:ItemDescription = new ItemDescription(); 42 item.createComponent(resultXml, "user"); 43 callback(item); 44 }, this.requestCallbackFailed)); 45 } 46 32 47 } 33 48 } -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as
r4093 r4125 45 45 public static const SPACE_PUBLIC:String = "public"; 46 46 47 private static const COMPONENT_LIST_URL:String = "/rest/registry/components"; 47 public static const COMPONENT_LIST_URL:String = "/rest/registry/components"; 48 public static const ITEMS_URL:String= "/rest/registry/items"; 48 49 private static const PROFILE_LIST_URL:String = "/rest/registry/profiles"; 49 50 private static const COMPONENT_USAGE_URL:String = "/rest/registry/components/usage/"; … … 190 191 191 192 public function getGroupsOfItemPath(itemId:String):String{ 192 return _serviceRootUrl + "/rest/registry/items/"+itemId+"/groups";193 return _serviceRootUrl + ITEMS_URL+"/"+itemId+"/groups"; 193 194 } 194 195 … … 231 232 232 233 public function getTransferItemOwnershipUrl(itemId:String,groupId:String):String{ 233 return _serviceRootUrl + "/rest/registry/items/"+itemId+"/transferownership?groupId="+groupId;234 return _serviceRootUrl + ITEMS_URL+"/"+itemId+"/transferownership?groupId="+groupId; 234 235 } 235 236 -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r3660 r4125 1582 1582 } 1583 1583 1584 @Override 1585 @GET 1586 @Path("/items/{itemId}") 1587 @Produces({ MediaType.TEXT_XML, MediaType.APPLICATION_XML, 1588 MediaType.APPLICATION_JSON }) 1589 public ComponentDescription getComponentDescription(@PathParam("itemId") String itemId) throws ComponentRegistryException{ 1590 LOG.debug("Item with id: {} is requested.", itemId); 1591 ComponentDescription description = getRegistry(getStatus(false)).getComponentDescription(itemId); 1592 if (description == null) 1593 description = getRegistry(getStatus(true)).getComponentDescription(itemId); 1594 return description; 1595 } 1596 1584 1597 } -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java
r3660 r4125 238 238 */ 239 239 void transferItemOwnershipToGroup(String itemId, long groupId); 240 241 /** 242 * Get any component (public or private) with the specified ID 243 * @param componentId 244 * @return 245 */ 246 ComponentDescription getComponentDescription(String componentId) throws ComponentRegistryException; 240 247 241 248 } -
ComponentRegistry/branches/ComponentRegistry-1.14.0/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestServiceTest.java
r3449 r4125 1230 1230 assertEquals(root.getCMDComponent().get(1).getCMDComponent().get(2).getFilename(), null); 1231 1231 } 1232 1233 @Test 1234 public void testGetDescription() throws Exception{ 1235 fillUp(); 1236 ComponentDescription component = getResource().path("/registry/items/clarin.eu:cr1:component1").accept(MediaType.APPLICATION_JSON).get(ComponentDescription.class); 1237 assertNotNull(component); 1238 assertEquals("clarin.eu:cr1:component1", component.getId()); 1239 assertEquals("component1", component.getName()); 1240 assertEquals("Test Description", component.getDescription()); 1241 1242 } 1232 1243 }
Note: See TracChangeset
for help on using the changeset viewer.