@Override public void onSuccess(final List<EIInstanceMinimal> result) { log.debug( "updated resource provider cache" ); providerMap.clear(); for (final EIInstanceMinimal instance : result) { providerMap.put( instance.getInstanceLabel(), instance ); providerURIMap.put( instance.getInstanceURI(), instance ); } loading = false; loadStarted = false; notifyListeners(); }
public List<EIEntity> getResourceProviderEntities() { final List<EIEntity> providerEntities = new ArrayList<EIEntity>(); for (final String label : getResourceProviderLabels()) { providerEntities.add( providerMap.get( label ).getEntity() ); } return providerEntities; }
private String getDisplayLabel(final EIInstanceMinimal value) { if ( value == null ) { return ""; } else if ( value.equals( EIInstanceMinimal.NULL_INSTANCE ) ) { return NO_VALUE_FOR_LISTS; } else { return value.getInstanceLabel() + " <" + value.getInstanceType().getLabel() + ">"; } }
protected final EIEntity getCorrectProviderEntity(EIURI providerUri) { if ( valuesForAll != null ) { for (EIInstanceMinimal instance : valuesForAll) { if ( instance.getInstanceURI().equals( providerUri ) ) { return instance.getEntity(); } } } return EIEntity.NULL_ENTITY; }
private Resources fillResources(final EIResourceProvider eiProvider, final EIEntity eiType) { final Set<EIInstanceMinimal> instances = eiProvider.getResources( eiType ); final Resources resources = new Resources(); resources.setEiroot( DataProvider.getPluralLabel( eiType.getLabel().toString() ) ); final List<Resource> resourceList = resources.getResource(); for (final EIInstanceMinimal instance : instances) { final Resource resource = new Resource(); resource.setEiuri( instance.getInstanceURI().toString() ); resource.setEitype( instance.getInstanceType().getLabel() ); resource.setName( instance.getInstanceLabel() ); if ( instance.getDescription().length() > 0 ) { resource.setDescription( Util.setHtmlBreaks( Util.removeQuotes( instance.getDescription() ) ) ); } resourceList.add( resource ); } return resources; }
private EIInstanceMinimal findInstanceByUri(final String uriString, final List<EIInstanceMinimal> instances) { for (EIInstanceMinimal instance : instances) { if ( instance.getInstanceURI().toString().equals( uriString ) ) { return instance; } } return EIInstanceMinimal.NULL_INSTANCE; } }
@Override public void onValueChange(ValueChangeEvent<EIInstanceMinimal> event) { EIInstanceMinimal newValue = event.getValue(); if ( newValue == null || EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { picker.setValue( EIInstanceMinimal.NULL_INSTANCE ); eiInstance.replaceObjectPropertyAllValues(propertyEntity, null ); oldValue = null; return; } if ( hasOldValue() ) { // Replace all possible values eiInstance.replaceObjectPropertyAllValues(propertyEntity, null ); oldValue = null; } if ( !EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { String instanceLabel = newValue.getEntity().getLabel(); List<EIEntity> entityList = getEntitiesByLabel( instanceLabel ); for ( EIEntity entity : entityList ) { eiInstance.addObjectProperty( propertyEntity, entity ); } updateOldValue( newValue.getInstanceURI() ); } }
private void populateInstanceTable(FlexTable table) { int instanceCount =0; for(EIInstanceMinimal instance : instances) { table.setText( instanceCount + 2, 0, instance.getInstanceLabel() ); table.setText( instanceCount + 2, 1, instance.getInstanceType().getLabel() ); table.setText( instanceCount + 2, 2, instance.getWFState().getLabel() ); instanceCount++; } }
protected String formatInstanceForListBox(final EIInstanceMinimal valueInstance) { return valueInstance.getInstanceLabel() + " <" + valueInstance.getInstanceType().getLabel() + ">" + ( !valueInstance.getLab().equals( EIEntity.NULL_ENTITY ) ? ", " + valueInstance.getLab().getLabel() : "" ); }
@Override public void onClick(final ClickEvent event) { if(WidgetUtils.clickHasModifiers( event )) { //no-op - let the browser handle } else { //Prevent regular behavior of Anchor event.preventDefault(); ApplicationState.getInstance().updateApplicationState( Mode.edit, instance.getEntity(), instance.getInstanceType(), getUpdatedProviderEntity( instance.getEntity() ) ); } } } );
setStyleName( "dtListGridRow" ); final Anchor instanceAnchor = makeRightClickableAnchor( instance.getEntity(), instance.getInstanceType() ); if ( !isNull( instance.getLab() ) && !ApplicationState.getInstance().hasResourceProvider()) { final FlowPanel firstCell = new FlowPanel(); final Anchor providerAnchor = makeRightClickableAnchor(instance.getLab(), ResourceProvider.BASE_RESOURCE_CONTAINER); providerAnchor.addStyleName( "dtListGridRowLab" ); firstCell.add( instanceAnchor ); addWithStyle( new Label( instance.getInstanceType().getLabel() ), TYPE_COLUMN, this ); addWithStyle( formActions[CLAIM_OR_SHARE_POSITION], ACTIONS_FIRST_COLUMN + CLAIM_OR_SHARE_POSITION, actionPanel ); redrawActions(); } else if ( instance.getWFOwner() != null && !EIEntity.NULL_ENTITY.equals( instance.getWFOwner() ) ) { Image lockImg = new Image("images/lock.png"); lockImg.setTitle("Currently locked by " + instance.getWFOwner().getLabel()); actionPanel.add(lockImg);
private void displayResults(final List<EIInstanceMinimal> page, final FlowPanel innerPanel) { innerPanel.clear(); Anchor instanceLink; EIEntity instanceEntity; String displayValue; for (EIInstanceMinimal instance : page) { instanceEntity = instance.getEntity(); displayValue = InstanceWidgetUtils.formatText( instance.getInstanceLabel() ); instanceLink = new Anchor(displayValue, "#" + INSTANCE_PAGE_TOKEN + "?" + URI_KEY + "=" + instanceEntity.getURI().toString()); innerPanel.add( instanceLink ); } }
@Override public void drawAfterClaim(final EIInstanceMinimal[] instances, final List<EIInstanceMinimal> successes) { if ( successes == null || successes.size() == 0 ) { final String failMessage = UIMessages.CLAIM_FAILURE.replace( "$RESOURCES$", instance.getInstanceLabel() ).replace( "they", "it" ); Window.alert( failMessage ); } else { final EIInstanceMinimal claimedMinimal = successes.get( 0 ); instance.setWFOwner( claimedMinimal.getWFOwner() ); drawAfterClaim( instance ); } }
@Override public void drawAfterPromote(final EIInstanceMinimal[] instances, final List<EIInstanceMinimal> successes) { if ( successes == null || successes.size() == 0 ) { final String failMessage = UIMessages.TRANSITION_FAILURE.replace( "$TRANSITION$", "" ).replace( "$RESOURCES$", instance.getInstanceLabel() ).replace( "they", "it" ); Window.alert( failMessage ); } else { final EIInstanceMinimal claimedMinimal = successes.get( 0 ); instance.setWFState( claimedMinimal.getWFState() ); drawAfterPromote( instance ); } }
final OptionElement item = instances.newOption( formatInstanceForListBox( instance ), instance.getInstanceURI().toString() ); if ( instance.isGlobal() ) { belongsTo = GLOBAL_GROUP_LABEL; } else if ( ApplicationState.getInstance().hasResourceProvider() && instance.getLab().equals( ApplicationState.getInstance().getResourceProviderEntity() ) ) { belongsTo = LAB_GROUP_LABEL; } else {
@Override public int compare(final EIInstanceMinimal arg0, final EIInstanceMinimal arg1) { return arg0.getInstanceType().getLabel().compareToIgnoreCase( arg1.getInstanceType().getLabel() ); } }),
@Override public int compare(final EIInstanceMinimal arg0, final EIInstanceMinimal arg1) { return arg0.getInstanceLabel().compareToIgnoreCase( arg1.getInstanceLabel() ); } }),
private Services fillServices(final EICatalystCoreLab lab) { final List<EIInstanceMinimal> instances = lab.getProvidesService(); final Services services = new Services(); final List<Service> serviceList = services.getService(); for (final EIInstanceMinimal instance : instances) { final Service service = new Service(); service.setName( instance.getInstanceLabel() ); if ( instance.getDescription().length() > 0 ) { service.setDescription( Util.setHtmlBreaks( Util.removeQuotes( instance.getDescription() ) ) ); } serviceList.add( service ); } return services; }
if ( performable.isValidFor( instance ) ) { validInstances.add( instance ); log.debug( "valid instance " + instance.getInstanceLabel() ); instanceCount++; } else { if ( instance.isStub() ) { log.debug( "stub instance" ); stubInstances.add( instance );
private EIEntity getUpdatedProviderEntity(final EIEntity instanceEntity) { if ( ApplicationState.getInstance().isFiltered() && !ApplicationState.getInstance().getFilterResourceProviderEntity().equals( EIEntity.NULL_ENTITY ) ) { return ApplicationState.getInstance().hasResourceProviderType() ? instanceEntity : ApplicationState.getInstance().getResourceProviderEntity(); } if ( ResourceProvider.isResourceProviderType( instance.getInstanceType() ) ) { return instanceEntity; } //log.debug( "app has provider? " + ApplicationState.getInstance().hasResourceProvider() + "; app state provider: ApplicationState.getInstance().getResourceProviderEntity() " + "; instance provider " + instance.getLab() ); if ( ApplicationState.getInstance().hasResourceProvider() ) { return ApplicationState.getInstance().getResourceProviderEntity(); } if ( instance.getLab().getLabel().equals( EIEntity.NO_LABEL ) ) { return EIEntity.NULL_ENTITY; } return instance.getLab(); }