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; } }
public void addMaterializedInverseProperty(final EIEntity property, final EIInstanceMinimal value) { List<EIInstanceMinimal> pValues = materializedInverseProperties.get( property ); if ( pValues == null ) { pValues = new ArrayList<EIInstanceMinimal>(); pValues.add( value ); materializedInverseProperties.put( property, pValues ); } else { // only add if URI doesn't already exist boolean uriInList = false; for (final EIInstanceMinimal ei : pValues) { if ( ei.getInstanceURI().equals( value.getInstanceURI() ) ) { uriInList = true; break; } } if ( !uriInList ) { pValues.add( value ); } } }
@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 void release(final EIInstanceMinimal[] instances, final BulkWorkflowCallback callback) { final Map<EIURI, EIInstanceMinimal> instanceUriMap = new HashMap<EIURI, EIInstanceMinimal>(); for (final EIInstanceMinimal instance : instances) { instanceUriMap.put( instance.getInstanceURI(), instance ); } repositoryService.release( securityProxy.getSessionId(), new ArrayList<EIURI>( instanceUriMap.keySet() ), new AsyncCallback<List<EIURI>>() { @Override public void onFailure(final Throwable caught) { callback.onFailure( caught ); } @Override public void onSuccess(final List<EIURI> result) { final List<EIInstanceMinimal> successes = new ArrayList<EIInstanceMinimal>(); for (final EIURI succeededUri : result) { final EIInstanceMinimal succeeded = instanceUriMap.get( succeededUri ); succeeded.setWFOwner( EIEntity.NULL_ENTITY ); successes.add( succeeded ); } callback.onSuccess( successes ); } } ); }
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; }
@Override public void onSuccess(final List<EIInstanceMinimal> successes) { if ( successes == null || successes.size() == 0 ) { callback.onFailure( new RepositoryProviderException( ExternalServiceExceptionType.UNCLAIMABLE )); } getInstance( successes.get( 0 ).getInstanceURI(), callback ); dealWithLinkedResources(instance, transition); }
instanceUriMap.put( instance.getInstanceURI(), instance );
private boolean oldValueMissingFromResult(final List<EIInstanceMinimal> fetchedInstances) { // DBW - remove final EIURI oldUri = EIURI.create( oldValue ); for (final EIInstanceMinimal instance : fetchedInstances) { if ( instance.getInstanceURI().equals( oldUri ) ) { return false; } } log.debug( "Old value missing from result: " + oldValue ); return true; }
@Override public void onClick(final ClickEvent event) { if ( Window.confirm( UIMessages.DELETE_CONFIRM_MESSAGE ) ) { ClientSweetProxy.getInstance().claimAndDeleteInstance( instance.getInstanceURI(), new RootAsyncCallback<Void>() { @Override public void onSuccess(final Void result) { if ( listener != null ) { listener.onRowDeletion( instance ); } } } ); } } } );
@Override public void onSuccess(final List<EIInstanceMinimal> successes) { if ( successes == null || successes.size() == 0 ) { log.warn("Release failed for: "+instance.getInstanceLabel()); callback.onFailure( new RepositoryProviderException( "release failed for " + instance.getInstanceLabel(), ExternalServiceExceptionType.FAILED_ACTION ) ); } getInstance( successes.get( 0 ).getInstanceURI(), callback ); }
@Override public void onSuccess(final List<EIInstanceMinimal> successes) { if ( successes == null || successes.size() == 0 ) { log.warn("Claim failed for: "+instance.getInstanceLabel()); callback.onFailure( new RepositoryProviderException( "claim failed for " + instance.getInstanceLabel(), ExternalServiceExceptionType.FAILED_ACTION ) ); } getInstance( successes.get( 0 ).getInstanceURI(), callback ); }
public void addMaterializedInverseProperty(final EIEntity property, final EIInstanceMinimal instance) { if ( referencingResources == null ) { referencingResources = new ReferencingResources(); } if ( ( mainInstance.getObjectProperty( property ) == null ) || ( mainInstance.getObjectProperty( property ) != null && !mainInstance.getObjectProperty( property ).contains( instance.getInstanceURI() ) ) ) { referencingResources.addMaterializedInverseProperty( property, instance ); // we only want the inverse property in one place, so only add it if it's not // there already } }
instanceUriMap.put( instance.getInstanceURI(), instance );
public void setReferences(final Map<EIEntity, List<EIInstanceMinimal>> listReferences) { setVisible( false ); if ( listReferences == null || listReferences.size() == 0 ) { return; } linksPanel.clear(); final List<EIEntity> instanceTypes = new LinkedList<EIEntity>( listReferences.keySet() ); Collections.sort( instanceTypes ); for (final EIEntity instanceType : instanceTypes) { final String rootTypeString = EIOntPlurals.plurals.containsKey( instanceType.getLabel() ) ? EIOntPlurals.plurals.get( instanceType.getLabel() ) : instanceType.getLabel(); final Label rootTypeLabel = new Label( rootTypeString ); rootTypeLabel.setStyleName( "relatedResourcesGroupTitle" ); linksPanel.add( rootTypeLabel ); final List<EIInstanceMinimal> references = listReferences.get( instanceType ); Collections.sort( references ); for (final EIInstanceMinimal eiInstanceMinimal : references) { final Hyperlink instanceLink = new Hyperlink( InstanceWidgetUtils.formatText( eiInstanceMinimal.getInstanceLabel() ), INSTANCE_PAGE_TOKEN + "?" + URI_KEY + "=" + eiInstanceMinimal.getInstanceURI().toString() ); linksPanel.add( instanceLink ); instanceLink.addStyleName( "link" ); } } setVisible( true ); } }
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; }
@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.replaceObjectPropertyValue( propertyEntity, getOldValueEIURI(), null ); oldValue = null; return; } if ( hasOldValue() ) { eiInstance.replaceObjectPropertyValue( propertyEntity, getOldValueEIURI(), null ); oldValue = null; } if ( !EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { eiInstance.addObjectProperty( propertyEntity, newValue.getEntity() ); updateOldValue( newValue.getInstanceURI() ); } }
@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() ); } }
final OptionElement item = instances.newOption( formatInstanceForListBox( instance ), instance.getInstanceURI().toString() ); if ( instance.isGlobal() ) { belongsTo = GLOBAL_GROUP_LABEL;