idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
29,200
protected HawkbitErrorNotificationMessage buildNotification ( final Throwable ex ) { LOG . error ( "Error in UI: " , ex ) ; final String errorMessage = extractMessageFrom ( ex ) ; final VaadinMessageSource i18n = SpringContextHelper . getBean ( VaadinMessageSource . class ) ; return new HawkbitErrorNotificationMessage ( STYLE , i18n . getMessage ( "caption.error" ) , errorMessage , true ) ; }
Method to build a notification based on an exception .
29,201
private void assertMetaDataQuota ( final Long moduleId , final int requested ) { final int maxMetaData = quotaManagement . getMaxMetaDataEntriesPerSoftwareModule ( ) ; QuotaHelper . assertAssignmentQuota ( moduleId , requested , maxMetaData , SoftwareModuleMetadata . class , SoftwareModule . class , softwareModuleMetadataRepository :: countBySoftwareModuleId ) ; }
Asserts the meta data quota for the software module with the given ID .
29,202
public static Specification < JpaAction > hasTargetAssignedArtifact ( final String controllerId , final String sha1Hash ) { return ( actionRoot , query , criteriaBuilder ) -> { final Join < JpaAction , JpaDistributionSet > dsJoin = actionRoot . join ( JpaAction_ . distributionSet ) ; final SetJoin < JpaDistributionSet , JpaSoftwareModule > modulesJoin = dsJoin . join ( JpaDistributionSet_ . modules ) ; final ListJoin < JpaSoftwareModule , JpaArtifact > artifactsJoin = modulesJoin . join ( JpaSoftwareModule_ . artifacts ) ; return criteriaBuilder . and ( criteriaBuilder . equal ( artifactsJoin . get ( JpaArtifact_ . sha1Hash ) , sha1Hash ) , criteriaBuilder . equal ( actionRoot . get ( JpaAction_ . target ) . get ( JpaTarget_ . controllerId ) , controllerId ) ) ; } ; }
Specification which joins all necessary tables to retrieve the dependency between a target and a local file assignment through the assigned action of the target . All actions are included not only active actions .
29,203
public CommonDialogWindow getWindow ( final E entity , final String metaDatakey ) { selectedEntity = entity ; metadataWindow = new WindowBuilder ( SPUIDefinitions . CREATE_UPDATE_WINDOW ) . caption ( getMetadataCaption ( ) ) . content ( this ) . cancelButtonClickListener ( event -> onCancel ( ) ) . id ( UIComponentIdProvider . METADATA_POPUP_ID ) . layout ( mainLayout ) . i18n ( i18n ) . saveDialogCloseListener ( new SaveOnDialogCloseListener ( ) ) . buildCommonDialogWindow ( ) ; metadataWindow . setHeight ( 550 , Unit . PIXELS ) ; metadataWindow . setWidth ( 800 , Unit . PIXELS ) ; metadataWindow . getMainLayout ( ) . setSizeFull ( ) ; metadataWindow . getButtonsLayout ( ) . setHeight ( "45px" ) ; setUpDetails ( entity . getId ( ) , metaDatakey ) ; return metadataWindow ; }
Returns metadata popup .
29,204
public void restoreState ( ) { if ( artifactUploadState . areAllUploadsFinished ( ) ) { artifactUploadState . clearUploadTempData ( ) ; hideUploadProgressButton ( ) ; upload . setEnabled ( true ) ; } else if ( artifactUploadState . isAtLeastOneUploadInProgress ( ) ) { showUploadProgressButton ( ) ; } }
Is called when view is shown to the user
29,205
public void buttonClick ( final ClickEvent event ) { if ( window . getParent ( ) != null ) { isImplicitClose = true ; UI . getCurrent ( ) . removeWindow ( window ) ; } callback . response ( event . getSource ( ) . equals ( okButton ) ) ; }
TenantAwareEvent handler for button clicks .
29,206
@ SuppressWarnings ( "unchecked" ) public static < T > Set < T > getTableValue ( final Table table ) { final Object value = table . getValue ( ) ; Set < T > idsReturn ; if ( value == null ) { idsReturn = Collections . emptySet ( ) ; } else if ( value instanceof Collection ) { final Collection < T > ids = ( Collection < T > ) value ; idsReturn = ids . stream ( ) . filter ( Objects :: nonNull ) . collect ( Collectors . toSet ( ) ) ; } else { final T id = ( T ) value ; idsReturn = Collections . singleton ( id ) ; } return idsReturn ; }
Gets the selected item id or in multiselect mode the selected ids .
29,207
public Set < Long > getSelectedEntitiesByTransferable ( final TableTransferable transferable ) { final Set < Long > selectedEntities = getTableValue ( this ) ; final Set < Long > ids = new HashSet < > ( ) ; final Long transferableData = ( Long ) transferable . getData ( SPUIDefinitions . ITEMID ) ; if ( transferableData == null ) { return ids ; } if ( entityToBeDeletedIsSelectedInTable ( transferableData , selectedEntities ) ) { ids . addAll ( selectedEntities ) ; } else { ids . add ( transferableData ) ; } return ids ; }
Return the entity which should be deleted by a transferable
29,208
public void selectEntity ( final Long entityId ) { E entity = null ; if ( entityId != null ) { entity = findEntityByTableValue ( entityId ) . orElse ( null ) ; } setLastSelectedEntityId ( entityId ) ; publishSelectedEntityEvent ( entity ) ; }
Finds the entity object of the given entity ID and performs the publishing of the BaseEntityEventType . SELECTED_ENTITY event
29,209
public void reset ( ) { totalTargetsLabel . setVisible ( false ) ; populateGroupsLegendByTargetCounts ( Collections . emptyList ( ) ) ; if ( groupsLegend . getComponentCount ( ) > MAX_GROUPS_TO_BE_DISPLAYED ) { groupsLegend . getComponent ( MAX_GROUPS_TO_BE_DISPLAYED ) . setVisible ( false ) ; } }
Resets the display of the legend and total targets .
29,210
public void populateTotalTargets ( final Long totalTargets ) { if ( totalTargets == null ) { totalTargetsLabel . setVisible ( false ) ; } else { totalTargetsLabel . setVisible ( true ) ; totalTargetsLabel . setValue ( getTotalTargetMessage ( totalTargets ) ) ; } }
Displays the total targets or hides the label when null is supplied .
29,211
public void populateGroupsLegendByTargetCounts ( final List < Long > listOfTargetCountPerGroup ) { loadingLabel . setVisible ( false ) ; for ( int i = 0 ; i < getGroupsWithoutToBeContinuedLabel ( listOfTargetCountPerGroup . size ( ) ) ; i ++ ) { final Component component = groupsLegend . getComponent ( i ) ; final Label label = ( Label ) component ; if ( listOfTargetCountPerGroup . size ( ) > i ) { final Long targetCount = listOfTargetCountPerGroup . get ( i ) ; label . setValue ( getTargetsInGroupMessage ( targetCount , i18n . getMessage ( "textfield.rollout.group.default.name" , i + 1 ) ) ) ; label . setVisible ( true ) ; } else { label . setValue ( "" ) ; label . setVisible ( false ) ; } } showOrHideToBeContinueLabel ( listOfTargetCountPerGroup ) ; unassignedTargetsLabel . setValue ( "" ) ; unassignedTargetsLabel . setVisible ( false ) ; }
Populates the legend based on a list of anonymous groups . They can t have unassigned targets .
29,212
public void populateGroupsLegendByValidation ( final RolloutGroupsValidation validation , final List < RolloutGroupCreate > groups ) { loadingLabel . setVisible ( false ) ; if ( validation == null ) { return ; } final List < Long > targetsPerGroup = validation . getTargetsPerGroup ( ) ; final long unassigned = validation . getTotalTargets ( ) - validation . getTargetsInGroups ( ) ; final int labelsToUpdate = ( unassigned > 0 ) ? ( getGroupsWithoutToBeContinuedLabel ( groups . size ( ) ) - 1 ) : groupsLegend . getComponentCount ( ) ; for ( int i = 0 ; i < getGroupsWithoutToBeContinuedLabel ( groups . size ( ) ) ; i ++ ) { final Component component = groupsLegend . getComponent ( i ) ; final Label label = ( Label ) component ; if ( targetsPerGroup . size ( ) > i && groups . size ( ) > i && labelsToUpdate > i ) { final Long targetCount = targetsPerGroup . get ( i ) ; final String groupName = groups . get ( i ) . build ( ) . getName ( ) ; label . setValue ( getTargetsInGroupMessage ( targetCount , groupName ) ) ; label . setVisible ( true ) ; } else { label . setValue ( "" ) ; label . setVisible ( false ) ; } } showOrHideToBeContinueLabel ( groups ) ; if ( unassigned > 0 ) { unassignedTargetsLabel . setValue ( getTargetsInGroupMessage ( unassigned , "Unassigned" ) ) ; unassignedTargetsLabel . setVisible ( true ) ; } else { unassignedTargetsLabel . setValue ( "" ) ; unassignedTargetsLabel . setVisible ( false ) ; } }
Populates the legend based on a groups validation and a list of groups that is used for resolving their names . Positions of the groups in the groups list and the validation need to be in correct order . Can have unassigned targets that are displayed on top of the groups list which results in one group less to be displayed
29,213
public void populateGroupsLegendByGroups ( final List < RolloutGroup > groups ) { loadingLabel . setVisible ( false ) ; for ( int i = 0 ; i < getGroupsWithoutToBeContinuedLabel ( groups . size ( ) ) ; i ++ ) { final Component component = groupsLegend . getComponent ( i ) ; final Label label = ( Label ) component ; if ( groups . size ( ) > i ) { final int targetCount = groups . get ( i ) . getTotalTargets ( ) ; final String groupName = groups . get ( i ) . getName ( ) ; label . setValue ( getTargetsInGroupMessage ( ( long ) targetCount , groupName ) ) ; label . setVisible ( true ) ; } else { label . setValue ( "" ) ; label . setVisible ( false ) ; } } showOrHideToBeContinueLabel ( groups ) ; }
Populates the legend based on a list of groups .
29,214
private void getTargetFilterStatuses ( ) { unknown = SPUIComponentProvider . getButton ( UIComponentIdProvider . UNKNOWN_STATUS_ICON , TargetUpdateStatus . UNKNOWN . toString ( ) , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_TARGET_STATUS_UNKNOWN ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; inSync = SPUIComponentProvider . getButton ( UIComponentIdProvider . INSYNCH_STATUS_ICON , TargetUpdateStatus . IN_SYNC . toString ( ) , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_STATUS_INSYNC ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; pending = SPUIComponentProvider . getButton ( UIComponentIdProvider . PENDING_STATUS_ICON , TargetUpdateStatus . PENDING . toString ( ) , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_STATUS_PENDING ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; error = SPUIComponentProvider . getButton ( UIComponentIdProvider . ERROR_STATUS_ICON , TargetUpdateStatus . ERROR . toString ( ) , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_STATUS_ERROR ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; registered = SPUIComponentProvider . getButton ( UIComponentIdProvider . REGISTERED_STATUS_ICON , TargetUpdateStatus . REGISTERED . toString ( ) , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_STATUS_REGISTERED ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; overdue = SPUIComponentProvider . getButton ( UIComponentIdProvider . OVERDUE_STATUS_ICON , OVERDUE_CAPTION , i18n . getMessage ( UIMessageIdProvider . TOOLTIP_STATUS_OVERDUE ) , SPUIDefinitions . SP_BUTTON_STATUS_STYLE , false , FontAwesome . SQUARE , SPUIButtonStyleSmall . class ) ; applyStatusBtnStyle ( ) ; unknown . setData ( "filterStatusOne" ) ; inSync . setData ( "filterStatusTwo" ) ; pending . setData ( "filterStatusThree" ) ; error . setData ( "filterStatusFour" ) ; registered . setData ( "filterStatusFive" ) ; overdue . setData ( "filterStatusSix" ) ; unknown . addClickListener ( this ) ; inSync . addClickListener ( this ) ; pending . addClickListener ( this ) ; error . addClickListener ( this ) ; registered . addClickListener ( this ) ; overdue . addClickListener ( this ) ; }
Get - status of FILTER .
29,215
private void applyStatusBtnStyle ( ) { unknown . addStyleName ( "unknownBtn" ) ; inSync . addStyleName ( "inSynchBtn" ) ; pending . addStyleName ( "pendingBtn" ) ; error . addStyleName ( "errorBtn" ) ; registered . addStyleName ( "registeredBtn" ) ; overdue . addStyleName ( "overdueBtn" ) ; }
Apply - status style .
29,216
private void processOverdueFilterStatus ( ) { overdueBtnClicked = ! overdueBtnClicked ; managementUIState . getTargetTableFilters ( ) . setOverdueFilterEnabled ( overdueBtnClicked ) ; if ( overdueBtnClicked ) { buttonClicked . addStyleName ( BTN_CLICKED ) ; eventBus . publish ( this , TargetFilterEvent . FILTER_BY_STATUS ) ; } else { buttonClicked . removeStyleName ( BTN_CLICKED ) ; eventBus . publish ( this , TargetFilterEvent . REMOVE_FILTER_BY_STATUS ) ; } }
Process - OVERDUE .
29,217
private void processCommonFilterStatus ( final TargetUpdateStatus status , final boolean buttonPressed ) { if ( buttonPressed ) { buttonClicked . addStyleName ( BTN_CLICKED ) ; managementUIState . getTargetTableFilters ( ) . getClickedStatusTargetTags ( ) . add ( status ) ; eventBus . publish ( this , TargetFilterEvent . FILTER_BY_STATUS ) ; } else { buttonClicked . removeStyleName ( BTN_CLICKED ) ; managementUIState . getTargetTableFilters ( ) . getClickedStatusTargetTags ( ) . remove ( status ) ; eventBus . publish ( this , TargetFilterEvent . REMOVE_FILTER_BY_STATUS ) ; } }
Process - COMMON PROCESS .
29,218
private void checkAndCancelExpiredAction ( final Action action ) { if ( action != null && action . hasMaintenanceSchedule ( ) && action . isMaintenanceScheduleLapsed ( ) ) { try { controllerManagement . cancelAction ( action . getId ( ) ) ; } catch ( final CancelActionNotAllowedException e ) { LOG . info ( "Cancel action not allowed exception :{}" , e ) ; } } }
If the action has a maintenance schedule defined but is no longer valid cancel the action .
29,219
public void populateByRollout ( final Rollout rollout ) { if ( rollout == null ) { return ; } removeAllRows ( ) ; final List < RolloutGroup > groups = rolloutGroupManagement . findByRollout ( PageRequest . of ( 0 , quotaManagement . getMaxRolloutGroupsPerRollout ( ) ) , rollout . getId ( ) ) . getContent ( ) ; for ( final RolloutGroup group : groups ) { final GroupRow groupRow = addGroupRow ( ) ; groupRow . populateByGroup ( group ) ; } updateValidation ( ) ; }
Populate groups by rollout
29,220
private void setGroupsValidation ( final RolloutGroupsValidation validation ) { final int runningValidation = runningValidationsCounter . getAndSet ( 0 ) ; if ( runningValidation > 1 ) { validateRemainingTargets ( ) ; return ; } groupsValidation = validation ; final int lastIdx = groupRows . size ( ) - 1 ; final GroupRow lastRow = groupRows . get ( lastIdx ) ; if ( groupsValidation != null && groupsValidation . isValid ( ) && validationStatus != ValidationStatus . INVALID ) { lastRow . resetError ( ) ; setValidationStatus ( ValidationStatus . VALID ) ; } else { lastRow . setError ( i18n . getMessage ( "message.rollout.remaining.targets.error" ) ) ; setValidationStatus ( ValidationStatus . INVALID ) ; } final int maxTargets = quotaManagement . getMaxTargetsPerRolloutGroup ( ) ; final boolean hasRemainingTargetsError = validationStatus == ValidationStatus . INVALID ; for ( int i = 0 ; i < groupRows . size ( ) ; ++ i ) { final GroupRow row = groupRows . get ( i ) ; if ( hasRemainingTargetsError && row . equals ( lastRow ) ) { continue ; } row . resetError ( ) ; final Long count = groupsValidation . getTargetsPerGroup ( ) . get ( i ) ; if ( count != null && count > maxTargets ) { row . setError ( i18n . getMessage ( MESSAGE_ROLLOUT_MAX_GROUP_SIZE_EXCEEDED , maxTargets ) ) ; setValidationStatus ( ValidationStatus . INVALID ) ; } } }
YOU SHOULD NOT CALL THIS METHOD MANUALLY . It s only for the callback . Only 1 runningValidation should be executed . If this runningValidation is done then this method is called . Maybe then a new runningValidation is executed .
29,221
public String getMinPollingTime ( ) { return systemSecurityContext . runAsSystem ( ( ) -> tenantConfigurationManagement . getConfigurationValue ( TenantConfigurationKey . MIN_POLLING_TIME_INTERVAL , String . class ) . getValue ( ) ) ; }
Returns the configured minimum polling interval .
29,222
@ EventBusListenerMethod ( scope = EventScope . UI ) public void onEvent ( final PinUnpinEvent event ) { final Optional < Long > pinnedDist = managementUIState . getTargetTableFilters ( ) . getPinnedDistId ( ) ; if ( event == PinUnpinEvent . PIN_DISTRIBUTION && pinnedDist . isPresent ( ) ) { displayCountLabel ( pinnedDist . get ( ) ) ; } else { setValue ( "" ) ; displayTargetCountStatus ( ) ; } }
TenantAwareEvent Listener for Pinning Distribution .
29,223
public String getMessage ( final Locale local , final String code , final Object ... args ) { try { return source . getMessage ( code , args , local ) ; } catch ( final NoSuchMessageException ex ) { LOG . error ( "Failed to retrieve message!" , ex ) ; return code ; } }
Tries to resolve the message based on the provided Local . Returns message code if fitting message could not be found .
29,224
public static void verifyRolloutGroupConditions ( final RolloutGroupConditions conditions ) { if ( conditions . getSuccessCondition ( ) == null ) { throw new ValidationException ( "Rollout group is missing success condition" ) ; } if ( conditions . getSuccessAction ( ) == null ) { throw new ValidationException ( "Rollout group is missing success action" ) ; } }
Verifies that the required success condition and action are actually set .
29,225
public static RolloutGroup verifyRolloutGroupHasConditions ( final RolloutGroup group ) { if ( group . getTargetPercentage ( ) < 1F || group . getTargetPercentage ( ) > 100F ) { throw new ValidationException ( "Target percentage has to be between 1 and 100" ) ; } if ( group . getSuccessCondition ( ) == null ) { throw new ValidationException ( "Rollout group is missing success condition" ) ; } if ( group . getSuccessAction ( ) == null ) { throw new ValidationException ( "Rollout group is missing success action" ) ; } return group ; }
Verifies that the group has the required success condition and action and a falid target percentage .
29,226
public static void verifyRolloutGroupParameter ( final int amountGroup , final QuotaManagement quotaManagement ) { if ( amountGroup <= 0 ) { throw new ValidationException ( "The amount of groups cannot be lower than zero" ) ; } else if ( amountGroup > quotaManagement . getMaxRolloutGroupsPerRollout ( ) ) { throw new QuotaExceededException ( "The amount of groups cannot be greater than " + quotaManagement . getMaxRolloutGroupsPerRollout ( ) ) ; } }
Verify if the supplied amount of groups is in range
29,227
public static void verifyRolloutInStatus ( final Rollout rollout , final Rollout . RolloutStatus status ) { if ( ! rollout . getStatus ( ) . equals ( status ) ) { throw new RolloutIllegalStateException ( "Rollout is not in status " + status . toString ( ) ) ; } }
Verifies that the Rollout is in the required status .
29,228
public static List < Long > getGroupsByStatusIncludingGroup ( final List < RolloutGroup > groups , final RolloutGroup . RolloutGroupStatus status , final RolloutGroup group ) { return groups . stream ( ) . filter ( innerGroup -> innerGroup . getStatus ( ) . equals ( status ) || innerGroup . equals ( group ) ) . map ( RolloutGroup :: getId ) . collect ( Collectors . toList ( ) ) ; }
Filters the groups of a Rollout to match a specific status and adds a group to the result .
29,229
public static String getAllGroupsTargetFilter ( final List < RolloutGroup > groups ) { if ( groups . stream ( ) . anyMatch ( group -> StringUtils . isEmpty ( group . getTargetFilterQuery ( ) ) ) ) { return "" ; } return "(" + groups . stream ( ) . map ( RolloutGroup :: getTargetFilterQuery ) . distinct ( ) . sorted ( ) . collect ( Collectors . joining ( "),(" ) ) + ")" ; }
Creates an RSQL expression that matches all targets in the provided groups . Links all target filter queries with OR .
29,230
public static String getOverlappingWithGroupsTargetFilter ( final String baseFilter , final List < RolloutGroup > groups , final RolloutGroup group ) { final String groupFilter = group . getTargetFilterQuery ( ) ; if ( isTargetFilterInGroups ( groupFilter , groups ) ) { return concatAndTargetFilters ( baseFilter , groupFilter ) ; } final String previousGroupFilters = getAllGroupsTargetFilter ( groups ) ; if ( ! StringUtils . isEmpty ( previousGroupFilters ) ) { if ( ! StringUtils . isEmpty ( groupFilter ) ) { return concatAndTargetFilters ( baseFilter , groupFilter , previousGroupFilters ) ; } else { return concatAndTargetFilters ( baseFilter , previousGroupFilters ) ; } } if ( ! StringUtils . isEmpty ( groupFilter ) ) { return concatAndTargetFilters ( baseFilter , groupFilter ) ; } else { return baseFilter ; } }
Creates an RSQL Filter that matches all targets that are in the provided group and in the provided groups .
29,231
private void decorate ( final Map < String , String > controllerAttibs ) { final VaadinMessageSource i18n = SpringContextHelper . getBean ( VaadinMessageSource . class ) ; final Label title = new Label ( i18n . getMessage ( "label.target.controller.attrs" ) , ContentMode . HTML ) ; title . addStyleName ( SPUIDefinitions . TEXT_STYLE ) ; targetAttributesLayout . addComponent ( title ) ; if ( HawkbitCommonUtil . isNotNullOrEmpty ( controllerAttibs ) ) { for ( final Map . Entry < String , String > entry : controllerAttibs . entrySet ( ) ) { targetAttributesLayout . addComponent ( SPUIComponentProvider . createNameValueLabel ( entry . getKey ( ) + ": " , entry . getValue ( ) ) ) ; } } }
Custom Decorate .
29,232
@ SuppressWarnings ( { "squid:S2221" , "squid:S00112" } ) public < T > T runAsSystemAsTenant ( final Callable < T > callable , final String tenant ) { final SecurityContext oldContext = SecurityContextHolder . getContext ( ) ; try { LOG . debug ( "entering system code execution" ) ; return tenantAware . runAsTenant ( tenant , ( ) -> { try { setSystemContext ( SecurityContextHolder . getContext ( ) ) ; return callable . call ( ) ; } catch ( final RuntimeException e ) { throw e ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; } } ) ; } finally { SecurityContextHolder . setContext ( oldContext ) ; LOG . debug ( "leaving system code execution" ) ; } }
The callable API throws a Exception and not a specific one
29,233
protected DmfTenantSecurityToken createTenantSecruityTokenVariables ( final HttpServletRequest request ) { final String requestURI = request . getRequestURI ( ) ; if ( pathExtractor . match ( request . getContextPath ( ) + CONTROLLER_REQUEST_ANT_PATTERN , requestURI ) ) { LOG . debug ( "retrieving principal from URI request {}" , requestURI ) ; final Map < String , String > extractUriTemplateVariables = pathExtractor . extractUriTemplateVariables ( request . getContextPath ( ) + CONTROLLER_REQUEST_ANT_PATTERN , requestURI ) ; final String controllerId = extractUriTemplateVariables . get ( CONTROLLER_ID_PLACE_HOLDER ) ; final String tenant = extractUriTemplateVariables . get ( TENANT_PLACE_HOLDER ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Parsed tenant {} and controllerId {} from path request {}" , tenant , controllerId , requestURI ) ; } return createTenantSecruityTokenVariables ( request , tenant , controllerId ) ; } else if ( pathExtractor . match ( request . getContextPath ( ) + CONTROLLER_DL_REQUEST_ANT_PATTERN , requestURI ) ) { LOG . debug ( "retrieving path variables from URI request {}" , requestURI ) ; final Map < String , String > extractUriTemplateVariables = pathExtractor . extractUriTemplateVariables ( request . getContextPath ( ) + CONTROLLER_DL_REQUEST_ANT_PATTERN , requestURI ) ; final String tenant = extractUriTemplateVariables . get ( TENANT_PLACE_HOLDER ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Parsed tenant {} from path request {}" , tenant , requestURI ) ; } return createTenantSecruityTokenVariables ( request , tenant , "anonymous" ) ; } else { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "request {} does not match the path pattern {}, request gets ignored" , requestURI , CONTROLLER_REQUEST_ANT_PATTERN ) ; } return null ; } }
Extracts tenant and controllerId from the request URI as path variables .
29,234
@ SuppressWarnings ( "unchecked" ) public < T > T convertMessage ( final Message message , final Class < T > clazz ) { checkMessageBody ( message ) ; message . getMessageProperties ( ) . getHeaders ( ) . put ( AbstractJavaTypeMapper . DEFAULT_CLASSID_FIELD_NAME , clazz . getName ( ) ) ; return ( T ) rabbitTemplate . getMessageConverter ( ) . fromMessage ( message ) ; }
Is needed to convert a incoming message to is originally object type .
29,235
public static List < GrantedAuthority > createAllAuthorityList ( ) { return SpPermission . getAllAuthorities ( ) . stream ( ) . map ( SimpleGrantedAuthority :: new ) . collect ( Collectors . toList ( ) ) ; }
Returns all authorities .
29,236
public static Button getButton ( final String id , final String buttonName , final String buttonDesc , final String style , final boolean setStyle , final Resource icon , final Class < ? extends SPUIButtonDecorator > buttonDecoratorclassName ) { Button button = null ; SPUIButtonDecorator buttonDecorator = null ; try { buttonDecorator = buttonDecoratorclassName . newInstance ( ) ; button = buttonDecorator . decorate ( new SPUIButton ( id , buttonName , buttonDesc ) , style , setStyle , icon ) ; } catch ( final InstantiationException exception ) { LOG . error ( "Error occured while creating Button decorator-" + buttonName , exception ) ; } catch ( final IllegalAccessException exception ) { LOG . error ( "Error occured while acessing Button decorator-" + buttonName , exception ) ; } return button ; }
Get Button - Factory Approach for decoration .
29,237
public static String getPinButtonStyle ( ) { final StringBuilder pinStyle = new StringBuilder ( ValoTheme . BUTTON_BORDERLESS_COLORED ) ; pinStyle . append ( ' ' ) ; pinStyle . append ( ValoTheme . BUTTON_SMALL ) ; pinStyle . append ( ' ' ) ; pinStyle . append ( ValoTheme . BUTTON_ICON_ONLY ) ; pinStyle . append ( ' ' ) ; pinStyle . append ( "pin-icon" ) ; return pinStyle . toString ( ) ; }
Get the style required .
29,238
public static Panel getDistributionSetInfo ( final DistributionSet distributionSet , final String caption , final String style1 , final String style2 ) { return new DistributionSetInfoPanel ( distributionSet , caption , style1 , style2 ) ; }
Get DistributionSet Info Panel .
29,239
public static Label createNameValueLabel ( final String label , final String ... values ) { final String valueStr = StringUtils . arrayToDelimitedString ( values , " " ) ; final Label nameValueLabel = new Label ( getBoldHTMLText ( label ) + valueStr , ContentMode . HTML ) ; nameValueLabel . setSizeFull ( ) ; nameValueLabel . addStyleName ( SPUIDefinitions . TEXT_STYLE ) ; nameValueLabel . addStyleName ( "label-style" ) ; return nameValueLabel ; }
Method to CreateName value labels .
29,240
public static VerticalLayout getDetailTabLayout ( ) { final VerticalLayout layout = new VerticalLayout ( ) ; layout . setSpacing ( true ) ; layout . setMargin ( true ) ; layout . setImmediate ( true ) ; return layout ; }
Layout of tabs in detail tabsheet .
29,241
public static Link getLink ( final String id , final String name , final String resource , final FontAwesome icon , final String targetOpen , final String style ) { final Link link = new Link ( name , new ExternalResource ( resource ) ) ; link . setId ( id ) ; link . setIcon ( icon ) ; link . setDescription ( name ) ; link . setTargetName ( targetOpen ) ; if ( style != null ) { link . setStyleName ( style ) ; } return link ; }
Method to create a link .
29,242
public CommonDialogWindow createUpdateSoftwareModuleWindow ( final Long baseSwModuleId ) { this . baseSwModuleId = baseSwModuleId ; resetComponents ( ) ; populateTypeNameCombo ( ) ; populateValuesOfSwModule ( ) ; return createWindow ( ) ; }
Creates window for update software module .
29,243
private void populateValuesOfSwModule ( ) { if ( baseSwModuleId == null ) { return ; } editSwModule = Boolean . TRUE ; softwareModuleManagement . get ( baseSwModuleId ) . ifPresent ( swModule -> { nameTextField . setValue ( swModule . getName ( ) ) ; versionTextField . setValue ( swModule . getVersion ( ) ) ; vendorTextField . setValue ( swModule . getVendor ( ) ) ; descTextArea . setValue ( swModule . getDescription ( ) ) ; softwareModuleType = new LabelBuilder ( ) . name ( swModule . getType ( ) . getName ( ) ) . caption ( i18n . getMessage ( UIMessageIdProvider . CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE ) ) . buildLabel ( ) ; } ) ; }
fill the data of a softwareModule in the content of the window
29,244
public void addItems ( final List < SuggestTokenDto > suggestions , final VTextField textFieldWidget , final PopupPanel popupPanel , final TextFieldSuggestionBoxServerRpc suggestionServerRpc ) { for ( int index = 0 ; index < suggestions . size ( ) ; index ++ ) { final SuggestTokenDto suggestToken = suggestions . get ( index ) ; final MenuItem mi = new MenuItem ( suggestToken . getSuggestion ( ) , true , new ScheduledCommand ( ) { public void execute ( ) { final String tmpSuggestion = suggestToken . getSuggestion ( ) ; final TokenStartEnd tokenStartEnd = tokenMap . get ( tmpSuggestion ) ; final String text = textFieldWidget . getValue ( ) ; final StringBuilder builder = new StringBuilder ( text ) ; builder . replace ( tokenStartEnd . getStart ( ) , tokenStartEnd . getEnd ( ) + 1 , tmpSuggestion ) ; textFieldWidget . setValue ( builder . toString ( ) , true ) ; popupPanel . hide ( ) ; textFieldWidget . setFocus ( true ) ; suggestionServerRpc . suggest ( builder . toString ( ) , textFieldWidget . getCursorPos ( ) ) ; } } ) ; tokenMap . put ( suggestToken . getSuggestion ( ) , new TokenStartEnd ( suggestToken . getStart ( ) , suggestToken . getEnd ( ) ) ) ; Roles . getListitemRole ( ) . set ( mi . getElement ( ) ) ; WidgetUtil . sinkOnloadForImages ( mi . getElement ( ) ) ; addItem ( mi ) ; } }
Adds suggestions to the suggestion menu bar .
29,245
public static < T > T getBean ( final String beanName , final Class < T > beanClazz ) { return context . getBean ( beanName , beanClazz ) ; }
method to return a certain bean by its class and name .
29,246
private static String [ ] getDsFilterNameAndVersionEntries ( final String filterString ) { final int semicolonIndex = filterString . indexOf ( ':' ) ; final String dsFilterName = semicolonIndex != - 1 ? filterString . substring ( 0 , semicolonIndex ) : ( filterString + "%" ) ; final String dsFilterVersion = semicolonIndex != - 1 ? ( filterString . substring ( semicolonIndex + 1 ) + "%" ) : "%" ; return new String [ ] { ! StringUtils . isEmpty ( dsFilterName ) ? dsFilterName : "%" , dsFilterVersion } ; }
field when the semicolon is present
29,247
private Boolean validate ( final DragAndDropEvent event ) { final Transferable transferable = event . getTransferable ( ) ; final Component compsource = transferable . getSourceComponent ( ) ; if ( ! ( compsource instanceof AbstractTable ) ) { uiNotification . displayValidationError ( getI18n ( ) . getMessage ( getActionNotAllowedMessage ( ) ) ) ; return false ; } final TableTransferable tabletransferable = ( TableTransferable ) transferable ; final AbstractTable < ? > source = ( AbstractTable < ? > ) tabletransferable . getSourceComponent ( ) ; if ( ! validateIfSourceIsTargetTable ( source ) && ! hasTargetUpdatePermission ( ) ) { return false ; } final Set < Long > deletedEntityByTransferable = source . getSelectedEntitiesByTransferable ( tabletransferable ) ; if ( deletedEntityByTransferable . isEmpty ( ) ) { final String actionDidNotWork = getI18n ( ) . getMessage ( "message.action.did.not.work" ) ; uiNotification . displayValidationError ( actionDidNotWork ) ; return false ; } return true ; }
Validate the drop .
29,248
private boolean hasTargetUpdatePermission ( ) { if ( ! permChecker . hasUpdateTargetPermission ( ) ) { uiNotification . displayValidationError ( getI18n ( ) . getMessage ( "message.permission.insufficient" , SpPermission . UPDATE_TARGET ) ) ; return false ; } return true ; }
validate the update permission .
29,249
public void refreshContainer ( ) { final Indexed container = getContainerDataSource ( ) ; if ( hasGeneratedPropertySupport ( ) && getGeneratedPropertySupport ( ) . getRawContainer ( ) instanceof LazyQueryContainer ) { ( ( LazyQueryContainer ) getGeneratedPropertySupport ( ) . getRawContainer ( ) ) . refresh ( ) ; return ; } if ( container instanceof LazyQueryContainer ) { ( ( LazyQueryContainer ) container ) . refresh ( ) ; } }
Refresh the container .
29,250
protected HeaderRow resetHeaderDefaultRow ( ) { getHeader ( ) . removeRow ( getHeader ( ) . getDefaultRow ( ) ) ; final HeaderRow newHeaderRow = getHeader ( ) . appendRow ( ) ; getHeader ( ) . setDefaultRow ( newHeaderRow ) ; return newHeaderRow ; }
Resets the default row of the header . This means the current default row is removed and replaced with a newly created one .
29,251
public static int getCtrlOrMetaModifier ( ) { final WebBrowser webBrowser = Page . getCurrent ( ) . getWebBrowser ( ) ; if ( webBrowser . isMacOSX ( ) ) { return ShortcutAction . ModifierKey . META ; } return ShortcutAction . ModifierKey . CTRL ; }
Returns the ctrl or meta modifier depending on the platform .
29,252
protected void getPreviewButtonColor ( final String color ) { Page . getCurrent ( ) . getJavaScript ( ) . execute ( HawkbitCommonUtil . getPreviewButtonColorScript ( color ) ) ; }
Dynamic styles for window .
29,253
protected void createDynamicStyleForComponents ( final TextField tagName , final TextArea tagDesc , final String taregtTagColor ) { tagName . removeStyleName ( SPUIDefinitions . TAG_NAME ) ; tagDesc . removeStyleName ( SPUIDefinitions . TAG_DESC ) ; getTargetDynamicStyles ( taregtTagColor ) ; tagName . addStyleName ( TAG_NAME_DYNAMIC_STYLE ) ; tagDesc . addStyleName ( TAG_DESC_DYNAMIC_STYLE ) ; }
Set tag name and desc field border color based on chosen color .
29,254
protected void restoreComponentStyles ( ) { tagName . removeStyleName ( TAG_NAME_DYNAMIC_STYLE ) ; tagDesc . removeStyleName ( TAG_DESC_DYNAMIC_STYLE ) ; tagName . addStyleName ( SPUIDefinitions . TAG_NAME ) ; tagDesc . addStyleName ( SPUIDefinitions . TAG_DESC ) ; getPreviewButtonColor ( ColorPickerConstants . DEFAULT_COLOR ) ; }
reset the tag name and tag description component border color .
29,255
public CommonDialogWindow createWindow ( ) { window = new WindowBuilder ( SPUIDefinitions . CREATE_UPDATE_WINDOW ) . caption ( getWindowCaption ( ) ) . content ( this ) . cancelButtonClickListener ( event -> discard ( ) ) . layout ( mainLayout ) . i18n ( i18n ) . saveDialogCloseListener ( new SaveOnDialogCloseListener ( ) ) . buildCommonDialogWindow ( ) ; return window ; }
Creates the window to create or update a tag or type
29,256
private void previewButtonClicked ( ) { if ( ! tagPreviewBtnClicked ) { colorPickerLayout . setSelectedColor ( ColorPickerHelper . rgbToColorConverter ( ColorPickerConstants . DEFAULT_COLOR ) ) ; } tagPreviewBtnClicked = ! tagPreviewBtnClicked ; colorPickerLayout . setVisible ( tagPreviewBtnClicked ) ; }
Open color picker on click of preview button . Auto select the color based on target tag if already selected .
29,257
private static void getTargetDynamicStyles ( final String colorPickedPreview ) { Page . getCurrent ( ) . getJavaScript ( ) . execute ( HawkbitCommonUtil . changeToNewSelectedPreviewColor ( colorPickedPreview ) ) ; }
Get target style - Dynamically as per the color picked cannot be done from the static css .
29,258
private void slidersValueChangeListeners ( ) { colorPickerLayout . getRedSlider ( ) . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 1L ; public void valueChange ( final ValueChangeEvent event ) { final double red = ( Double ) event . getProperty ( ) . getValue ( ) ; final Color newColor = new Color ( ( int ) red , colorPickerLayout . getSelectedColor ( ) . getGreen ( ) , colorPickerLayout . getSelectedColor ( ) . getBlue ( ) ) ; setColorToComponents ( newColor ) ; } } ) ; colorPickerLayout . getGreenSlider ( ) . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 1L ; public void valueChange ( final ValueChangeEvent event ) { final double green = ( Double ) event . getProperty ( ) . getValue ( ) ; final Color newColor = new Color ( colorPickerLayout . getSelectedColor ( ) . getRed ( ) , ( int ) green , colorPickerLayout . getSelectedColor ( ) . getBlue ( ) ) ; setColorToComponents ( newColor ) ; } } ) ; colorPickerLayout . getBlueSlider ( ) . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 1L ; public void valueChange ( final ValueChangeEvent event ) { final double blue = ( Double ) event . getProperty ( ) . getValue ( ) ; final Color newColor = new Color ( colorPickerLayout . getSelectedColor ( ) . getRed ( ) , colorPickerLayout . getSelectedColor ( ) . getGreen ( ) , ( int ) blue ) ; setColorToComponents ( newColor ) ; } } ) ; }
Value change listeners implementations of sliders .
29,259
@ ExceptionHandler ( AbstractServerRtException . class ) public ResponseEntity < ExceptionInfo > handleSpServerRtExceptions ( final HttpServletRequest request , final Exception ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = createExceptionInfo ( ex ) ; final HttpStatus responseStatus ; if ( ex instanceof AbstractServerRtException ) { responseStatus = getStatusOrDefault ( ( ( AbstractServerRtException ) ex ) . getError ( ) ) ; } else { responseStatus = DEFAULT_RESPONSE_STATUS ; } return new ResponseEntity < > ( response , responseStatus ) ; }
method for handling exception of type AbstractServerRtException . Called by the Spring - Framework for exception handling .
29,260
@ ExceptionHandler ( HttpMessageNotReadableException . class ) public ResponseEntity < ExceptionInfo > handleHttpMessageNotReadableException ( final HttpServletRequest request , final Exception ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = createExceptionInfo ( new MessageNotReadableException ( ) ) ; return new ResponseEntity < > ( response , HttpStatus . BAD_REQUEST ) ; }
Method for handling exception of type HttpMessageNotReadableException which is thrown in case the request body is not well formed and cannot be deserialized . Called by the Spring - Framework for exception handling .
29,261
@ ExceptionHandler ( ConstraintViolationException . class ) public ResponseEntity < ExceptionInfo > handleConstraintViolationException ( final HttpServletRequest request , final ConstraintViolationException ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = new ExceptionInfo ( ) ; response . setMessage ( ex . getConstraintViolations ( ) . stream ( ) . map ( violation -> violation . getPropertyPath ( ) + MESSAGE_FORMATTER_SEPARATOR + violation . getMessage ( ) + "." ) . collect ( Collectors . joining ( MESSAGE_FORMATTER_SEPARATOR ) ) ) ; response . setExceptionClass ( ex . getClass ( ) . getName ( ) ) ; response . setErrorCode ( SpServerError . SP_REPO_CONSTRAINT_VIOLATION . getKey ( ) ) ; return new ResponseEntity < > ( response , HttpStatus . BAD_REQUEST ) ; }
Method for handling exception of type ConstraintViolationException which is thrown in case the request is rejected due to a constraint violation . Called by the Spring - Framework for exception handling .
29,262
@ ExceptionHandler ( ValidationException . class ) public ResponseEntity < ExceptionInfo > handleValidationException ( final HttpServletRequest request , final ValidationException ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = new ExceptionInfo ( ) ; response . setMessage ( ex . getMessage ( ) ) ; response . setExceptionClass ( ex . getClass ( ) . getName ( ) ) ; response . setErrorCode ( SpServerError . SP_REPO_CONSTRAINT_VIOLATION . getKey ( ) ) ; return new ResponseEntity < > ( response , HttpStatus . BAD_REQUEST ) ; }
Method for handling exception of type ValidationException which is thrown in case the request is rejected due to invalid requests . Called by the Spring - Framework for exception handling .
29,263
protected void onBaseEntityEvent ( final BaseUIEntityEvent < T > baseEntityEvent ) { final BaseEntityEventType eventType = baseEntityEvent . getEventType ( ) ; if ( BaseEntityEventType . SELECTED_ENTITY == eventType || BaseEntityEventType . UPDATED_ENTITY == eventType || BaseEntityEventType . REMOVE_ENTITY == eventType ) { UI . getCurrent ( ) . access ( ( ) -> populateData ( baseEntityEvent . getEntity ( ) ) ) ; } else if ( BaseEntityEventType . MINIMIZED == eventType ) { UI . getCurrent ( ) . access ( ( ) -> setVisible ( true ) ) ; } else if ( BaseEntityEventType . MAXIMIZED == eventType ) { UI . getCurrent ( ) . access ( ( ) -> setVisible ( false ) ) ; } }
Default implementation to handle an entity event .
29,264
public Queue dmfReceiverQueue ( ) { return new Queue ( amqpProperties . getReceiverQueue ( ) , true , false , false , amqpDeadletterProperties . getDeadLetterExchangeArgs ( amqpProperties . getDeadLetterExchange ( ) ) ) ; }
Create the DMF API receiver queue for retrieving DMF messages .
29,265
public Queue authenticationReceiverQueue ( ) { return QueueBuilder . nonDurable ( amqpProperties . getAuthenticationReceiverQueue ( ) ) . autoDelete ( ) . withArguments ( getTTLMaxArgsAuthenticationQueue ( ) ) . build ( ) ; }
Create the DMF API receiver queue for authentication requests called by 3rd party artifact storages for download authorization by devices .
29,266
public AmqpMessageHandlerService amqpMessageHandlerService ( final RabbitTemplate rabbitTemplate , final AmqpMessageDispatcherService amqpMessageDispatcherService , final ControllerManagement controllerManagement , final EntityFactory entityFactory ) { return new AmqpMessageHandlerService ( rabbitTemplate , amqpMessageDispatcherService , controllerManagement , entityFactory ) ; }
Create AMQP handler service bean .
29,267
@ ConditionalOnMissingBean ( name = "listenerContainerFactory" ) public RabbitListenerContainerFactory < SimpleMessageListenerContainer > listenerContainerFactory ( final SimpleRabbitListenerContainerFactoryConfigurer configurer , final ErrorHandler errorHandler ) { final ConfigurableRabbitListenerContainerFactory factory = new ConfigurableRabbitListenerContainerFactory ( amqpProperties . isMissingQueuesFatal ( ) , amqpProperties . getDeclarationRetries ( ) , errorHandler ) ; configurer . configure ( factory , rabbitConnectionFactory ) ; return factory ; }
Create RabbitListenerContainerFactory bean if no listenerContainerFactory bean found
29,268
@ ConditionalOnMissingBean ( AmqpControllerAuthentication . class ) public AmqpControllerAuthentication amqpControllerAuthentication ( final SystemManagement systemManagement , final ControllerManagement controllerManagement , final TenantConfigurationManagement tenantConfigurationManagement , final TenantAware tenantAware , final DdiSecurityProperties ddiSecruityProperties , final SystemSecurityContext systemSecurityContext ) { return new AmqpControllerAuthentication ( systemManagement , controllerManagement , tenantConfigurationManagement , tenantAware , ddiSecruityProperties , systemSecurityContext ) ; }
create the authentication bean for controller over amqp .
29,269
public void refreshView ( final Set < Class < ? > > eventContainers ) { eventContainers . stream ( ) . filter ( this :: supportNotificationEventContainer ) . forEach ( this :: refreshContainer ) ; clear ( ) ; }
Refresh the view by event container changes .
29,270
public TextField createSearchField ( final TextChangeListener textChangeListener ) { final TextField textField = style ( "filter-box" ) . styleName ( "text-style filter-box-hide" ) . buildTextComponent ( ) ; textField . setWidth ( 100.0F , Unit . PERCENTAGE ) ; textField . addTextChangeListener ( textChangeListener ) ; textField . setTextChangeEventMode ( TextChangeEventMode . LAZY ) ; textField . setTextChangeTimeout ( 1000 ) ; return textField ; }
Create a search text field .
29,271
public void showForTargetFilter ( final Long tfqId ) { this . tfqId = tfqId ; final TargetFilterQuery tfq = targetFilterQueryManagement . get ( tfqId ) . orElseThrow ( ( ) -> new EntityNotFoundException ( TargetFilterQuery . class , tfqId ) ) ; final VerticalLayout verticalLayout = initView ( ) ; final DistributionSet distributionSet = tfq . getAutoAssignDistributionSet ( ) ; final ActionType actionType = tfq . getAutoAssignActionType ( ) ; setInitialControlValues ( distributionSet , actionType ) ; final CommonDialogWindow window = new WindowBuilder ( SPUIDefinitions . CREATE_UPDATE_WINDOW ) . caption ( i18n . getMessage ( UIMessageIdProvider . CAPTION_SELECT_AUTO_ASSIGN_DS ) ) . content ( verticalLayout ) . layout ( verticalLayout ) . i18n ( i18n ) . saveDialogCloseListener ( this ) . buildCommonDialogWindow ( ) ; window . setId ( UIComponentIdProvider . DIST_SET_SELECT_WINDOW_ID ) ; window . setWidth ( 40.0F , Sizeable . Unit . PERCENTAGE ) ; UI . getCurrent ( ) . addWindow ( window ) ; window . setVisible ( true ) ; }
Shows a distribution set select window for the given target filter query
29,272
public void saveOrUpdate ( ) { if ( checkBox . getValue ( ) && dsCombo . getValue ( ) != null ) { final ActionType autoAssignActionType = ( ( ActionTypeOption ) actionTypeOptionGroupLayout . getActionTypeOptionGroup ( ) . getValue ( ) ) . getActionType ( ) ; updateTargetFilterQueryDS ( tfqId , ( Long ) dsCombo . getValue ( ) , autoAssignActionType ) ; } else if ( ! checkBox . getValue ( ) ) { updateTargetFilterQueryDS ( tfqId , null , null ) ; } }
Is called when the new value should be saved after the save button has been clicked
29,273
static ServerViewComponentClientCriterion [ ] createViewComponentClientCriteria ( ) { final ServerViewComponentClientCriterion [ ] criteria = new ServerViewComponentClientCriterion [ 4 ] ; criteria [ 0 ] = ServerViewComponentClientCriterion . createBuilder ( ) . dragSourceIdPrefix ( UIComponentIdProvider . TARGET_TABLE_ID ) . dropTargetIdPrefixes ( SPUIDefinitions . TARGET_TAG_ID_PREFIXS , UIComponentIdProvider . DIST_TABLE_ID ) . dropAreaIds ( UIComponentIdProvider . TARGET_TAG_DROP_AREA_ID , UIComponentIdProvider . DIST_TABLE_ID ) . build ( ) ; criteria [ 1 ] = ServerViewComponentClientCriterion . createBuilder ( ) . dragSourceIdPrefix ( SPUIDefinitions . TARGET_TAG_ID_PREFIXS ) . dropTargetIdPrefixes ( UIComponentIdProvider . TARGET_TABLE_ID , UIComponentIdProvider . DIST_TABLE_ID ) . dropAreaIds ( UIComponentIdProvider . TARGET_TABLE_ID , UIComponentIdProvider . DIST_TABLE_ID ) . build ( ) ; criteria [ 2 ] = ServerViewComponentClientCriterion . createBuilder ( ) . dragSourceIdPrefix ( UIComponentIdProvider . DIST_TABLE_ID ) . dropTargetIdPrefixes ( UIComponentIdProvider . TARGET_TABLE_ID , UIComponentIdProvider . TARGET_DROP_FILTER_ICON , SPUIDefinitions . DISTRIBUTION_TAG_ID_PREFIXS ) . dropAreaIds ( UIComponentIdProvider . TARGET_TABLE_ID , UIComponentIdProvider . TARGET_DROP_FILTER_ICON , UIComponentIdProvider . DISTRIBUTION_TAG_TABLE_ID ) . build ( ) ; criteria [ 3 ] = ServerViewComponentClientCriterion . createBuilder ( ) . dragSourceIdPrefix ( SPUIDefinitions . DISTRIBUTION_TAG_ID_PREFIXS ) . dropTargetIdPrefixes ( UIComponentIdProvider . DIST_TABLE_ID ) . dropAreaIds ( UIComponentIdProvider . DIST_TABLE_ID ) . build ( ) ; return criteria ; }
Configures the elements of the composite accept criterion for the Management View .
29,274
public static String trimAndNullIfEmpty ( final String text ) { if ( text != null && ! text . trim ( ) . isEmpty ( ) ) { return text . trim ( ) ; } return null ; }
Trims the text and converts into null in case of an empty string .
29,275
public static String concatStrings ( final String delimiter , final String ... texts ) { final String delim = delimiter == null ? "" : delimiter ; final StringBuilder conCatStrBldr = new StringBuilder ( ) ; if ( null != texts ) { for ( final String text : texts ) { conCatStrBldr . append ( delim ) ; conCatStrBldr . append ( text ) ; } } final String conCatedStr = conCatStrBldr . toString ( ) ; return delim . length ( ) > 0 && conCatedStr . startsWith ( delim ) ? conCatedStr . substring ( 1 ) : conCatedStr ; }
Concatenate the given text all the string arguments with the given delimiter .
29,276
public static String getSoftwareModuleName ( final String caption , final String name ) { return new StringBuilder ( ) . append ( DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText ( getFormattedName ( name ) ) ) . append ( DIV_DESCRIPTION_END ) . toString ( ) ; }
Get Label for Artifact Details .
29,277
public static String getPollStatusToolTip ( final PollStatus pollStatus , final VaadinMessageSource i18N ) { if ( pollStatus != null && pollStatus . getLastPollDate ( ) != null && pollStatus . isOverdue ( ) ) { final TimeZone tz = SPDateTimeUtil . getBrowserTimeZone ( ) ; return i18N . getMessage ( UIMessageIdProvider . TOOLTIP_OVERDUE , SPDateTimeUtil . getDurationFormattedString ( pollStatus . getOverdueDate ( ) . atZone ( SPDateTimeUtil . getTimeZoneId ( tz ) ) . toInstant ( ) . toEpochMilli ( ) , pollStatus . getCurrentDate ( ) . atZone ( SPDateTimeUtil . getTimeZoneId ( tz ) ) . toInstant ( ) . toEpochMilli ( ) , i18N ) ) ; } return null ; }
Get tool tip for Poll status .
29,278
public static String getFormattedName ( final String orgText ) { return trimAndNullIfEmpty ( orgText ) == null ? SPUIDefinitions . SPACE : orgText ; }
Null check for text .
29,279
public static float getArtifactUploadPopupWidth ( final float newBrowserWidth , final int minPopupWidth ) { final float extraWidth = findRequiredSwModuleExtraWidth ( newBrowserWidth ) ; if ( extraWidth + minPopupWidth > SPUIDefinitions . MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH ) { return SPUIDefinitions . MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH ; } return extraWidth + minPopupWidth ; }
Get artifact upload pop up width .
29,280
public static String removePrefix ( final String text , final String prefix ) { if ( text != null ) { return text . replaceFirst ( prefix , "" ) ; } return null ; }
Remove the prefix from text .
29,281
public static Label getFormatedLabel ( final String labelContent ) { final Label labelValue = new Label ( labelContent , ContentMode . HTML ) ; labelValue . setSizeFull ( ) ; labelValue . addStyleName ( SPUIDefinitions . TEXT_STYLE ) ; labelValue . addStyleName ( "label-style" ) ; return labelValue ; }
Get formatted label . Appends ellipses if content does not fit the label .
29,282
public static String createAssignmentMessage ( final String tagName , final AssignmentResult < ? extends NamedEntity > result , final VaadinMessageSource i18n ) { final StringBuilder formMsg = new StringBuilder ( ) ; final int assignedCount = result . getAssigned ( ) ; final int alreadyAssignedCount = result . getAlreadyAssigned ( ) ; final int unassignedCount = result . getUnassigned ( ) ; if ( assignedCount == 1 ) { formMsg . append ( i18n . getMessage ( "message.target.assigned.one" , result . getAssignedEntity ( ) . get ( 0 ) . getName ( ) , tagName ) ) . append ( "<br>" ) ; } else if ( assignedCount > 1 ) { formMsg . append ( i18n . getMessage ( "message.target.assigned.many" , assignedCount , tagName ) ) . append ( "<br>" ) ; if ( alreadyAssignedCount > 0 ) { final String alreadyAssigned = i18n . getMessage ( "message.target.alreadyAssigned" , alreadyAssignedCount ) ; formMsg . append ( alreadyAssigned ) . append ( "<br>" ) ; } } if ( unassignedCount == 1 ) { formMsg . append ( i18n . getMessage ( "message.target.unassigned.one" , result . getUnassignedEntity ( ) . get ( 0 ) . getName ( ) , tagName ) ) . append ( "<br>" ) ; } else if ( unassignedCount > 1 ) { formMsg . append ( i18n . getMessage ( "message.target.unassigned.many" , unassignedCount , tagName ) ) . append ( "<br>" ) ; } return formMsg . toString ( ) ; }
Display Target Tag action message .
29,283
public static LazyQueryContainer createLazyQueryContainer ( final BeanQueryFactory < ? extends AbstractBeanQuery < ? > > queryFactory ) { queryFactory . setQueryConfiguration ( Collections . emptyMap ( ) ) ; return new LazyQueryContainer ( new LazyQueryDefinition ( true , 20 , SPUILabelDefinitions . VAR_NAME ) , queryFactory ) ; }
Create a lazy query container for the given query bean factory with empty configurations .
29,284
public static LazyQueryContainer createDSLazyQueryContainer ( final BeanQueryFactory < ? extends AbstractBeanQuery < ? > > queryFactory ) { queryFactory . setQueryConfiguration ( Collections . emptyMap ( ) ) ; return new LazyQueryContainer ( new LazyQueryDefinition ( true , 20 , "tagIdName" ) , queryFactory ) ; }
Create lazy query container for DS type .
29,285
public static void getDsTableColumnProperties ( final Container container ) { final LazyQueryContainer lqc = ( LazyQueryContainer ) container ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_ID , Long . class , null , false , false ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_DESC , String . class , "" , false , true ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_VERSION , String . class , null , false , false ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_NAME , String . class , null , false , true ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_CREATED_BY , String . class , null , false , true ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_LAST_MODIFIED_BY , String . class , null , false , true ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_CREATED_DATE , String . class , null , false , true ) ; lqc . addContainerProperty ( SPUILabelDefinitions . VAR_LAST_MODIFIED_DATE , String . class , null , false , true ) ; }
Set distribution table column properties .
29,286
public static String getScriptSMHighlightWithColor ( final String colorCSS ) { return new StringBuilder ( ) . append ( SM_HIGHLIGHT_SCRIPT_CURRENT ) . append ( "smHighlightStyle = smHighlightStyle + \"" ) . append ( colorCSS ) . append ( "\";" ) . append ( SM_HIGHLIGHT_SCRIPT_APPEND ) . toString ( ) ; }
Highlight software module rows with the color of sw - type .
29,287
public static String changeToNewSelectedPreviewColor ( final String colorPickedPreview ) { return new StringBuilder ( ) . append ( NEW_PREVIEW_COLOR_REMOVE_SCRIPT ) . append ( NEW_PREVIEW_COLOR_CREATE_SCRIPT ) . append ( "var newColorPreviewStyle = \".v-app .new-tag-name{ border: solid 3px " ) . append ( colorPickedPreview ) . append ( " !important; width:138px; margin-left:2px !important; box-shadow:none !important; } \"; " ) . append ( "newColorPreviewStyle = newColorPreviewStyle + \".v-app .new-tag-desc{ border: solid 3px " ) . append ( colorPickedPreview ) . append ( " !important; width:138px; height:75px !important; margin-top:4px !important; margin-left:2px !important;;box-shadow:none !important;} \"; " ) . append ( NEW_PREVIEW_COLOR_SET_STYLE_SCRIPT ) . toString ( ) ; }
Get javascript to reflect new color selection in color picker preview for name and description fields .
29,288
public static String getPreviewButtonColorScript ( final String color ) { return new StringBuilder ( ) . append ( PREVIEW_BUTTON_COLOR_REMOVE_SCRIPT ) . append ( PREVIEW_BUTTON_COLOR_CREATE_SCRIPT ) . append ( "var tagColorPreviewStyle = \".v-app .tag-color-preview{ height: 15px !important; padding: 0 10px !important; border: 0px !important; margin-left:12px !important; margin-top: 4px !important; border-width: 0 !important; background: " ) . append ( color ) . append ( " } .v-app .tag-color-preview:after{ border-color: none !important; box-shadow:none !important;} \"; " ) . append ( PREVIEW_BUTTON_COLOR_SET_STYLE_SCRIPT ) . toString ( ) ; }
Get javascript to reflect new color selection for preview button .
29,289
public static void applyStatusLblStyle ( final Table targetTable , final Button pinBtn , final Object itemId ) { final Item item = targetTable . getItem ( itemId ) ; if ( item != null ) { final TargetUpdateStatus updateStatus = ( TargetUpdateStatus ) item . getItemProperty ( SPUILabelDefinitions . VAR_TARGET_STATUS ) . getValue ( ) ; pinBtn . removeStyleName ( "statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue" ) ; if ( updateStatus == TargetUpdateStatus . ERROR ) { pinBtn . addStyleName ( SPUIStyleDefinitions . STATUS_ICON_RED ) ; } else if ( updateStatus == TargetUpdateStatus . UNKNOWN ) { pinBtn . addStyleName ( SPUIStyleDefinitions . STATUS_ICON_BLUE ) ; } else if ( updateStatus == TargetUpdateStatus . IN_SYNC ) { pinBtn . addStyleName ( SPUIStyleDefinitions . STATUS_ICON_GREEN ) ; } else if ( updateStatus == TargetUpdateStatus . PENDING ) { pinBtn . addStyleName ( SPUIStyleDefinitions . STATUS_ICON_YELLOW ) ; } else if ( updateStatus == TargetUpdateStatus . REGISTERED ) { pinBtn . addStyleName ( SPUIStyleDefinitions . STATUS_ICON_LIGHT_BLUE ) ; } } }
Apply style for status label in target table .
29,290
public static String formattingFinishedPercentage ( final RolloutGroup rolloutGroup , final float finishedPercentage ) { float tmpFinishedPercentage = 0 ; switch ( rolloutGroup . getStatus ( ) ) { case READY : case SCHEDULED : case ERROR : tmpFinishedPercentage = 0.0F ; break ; case FINISHED : tmpFinishedPercentage = 100.0F ; break ; case RUNNING : tmpFinishedPercentage = finishedPercentage ; break ; default : break ; } return String . format ( "%.1f" , tmpFinishedPercentage ) ; }
Formats the finished percentage of a rollout group into a string with one digit after comma .
29,291
public static String getStatusLabelDetailsInString ( final String value , final String style , final String id ) { final StringBuilder val = new StringBuilder ( ) ; if ( ! StringUtils . isEmpty ( value ) ) { val . append ( "value:" ) . append ( value ) . append ( "," ) ; } if ( ! StringUtils . isEmpty ( style ) ) { val . append ( "style:" ) . append ( style ) . append ( "," ) ; } return val . append ( "id:" ) . append ( id ) . toString ( ) ; }
Returns a formatted string as needed by label custom render . This string holds the properties of a status label .
29,292
public static String getCodePoint ( final StatusFontIcon statusFontIcon ) { if ( statusFontIcon == null ) { return null ; } return statusFontIcon . getFontIcon ( ) != null ? Integer . toString ( statusFontIcon . getFontIcon ( ) . getCodepoint ( ) ) : null ; }
Receive the code point of a given StatusFontIcon .
29,293
public static Locale getCurrentLocale ( ) { final UI currentUI = UI . getCurrent ( ) ; return currentUI == null ? Locale . getDefault ( ) : currentUI . getLocale ( ) ; }
Gets the locale of the current Vaadin UI . If the locale can not be determined the default locale is returned instead .
29,294
public static String getArtifactoryDetailsLabelId ( final String name , final VaadinMessageSource i18n ) { String caption ; if ( StringUtils . hasText ( name ) ) { caption = i18n . getMessage ( UIMessageIdProvider . CAPTION_ARTIFACT_DETAILS_OF , HawkbitCommonUtil . getBoldHTMLText ( name ) ) ; } else { caption = i18n . getMessage ( UIMessageIdProvider . CAPTION_ARTIFACT_DETAILS ) ; } return getCaptionText ( caption ) ; }
Creates the caption of the Artifact Details table
29,295
public static Locale getLocaleToBeUsed ( final UiProperties . Localization localizationProperties , final Locale desiredLocale ) { final List < String > availableLocals = localizationProperties . getAvailableLocals ( ) ; if ( availableLocals . contains ( desiredLocale . getLanguage ( ) ) ) { return desiredLocale ; } return new Locale ( localizationProperties . getDefaultLocal ( ) ) ; }
Determine the language that should be used considering localization properties and a desired Locale
29,296
public static void initLocalization ( final UI ui , final Localization localizationProperties , final VaadinMessageSource i18n ) { ui . setLocale ( HawkbitCommonUtil . getLocaleToBeUsed ( localizationProperties , ui . getSession ( ) . getLocale ( ) ) ) ; ui . getReconnectDialogConfiguration ( ) . setDialogText ( i18n . getMessage ( UIMessageIdProvider . VAADIN_SYSTEM_TRYINGRECONNECT ) ) ; }
Set localization considering properties and UI settings .
29,297
public void populateDSMetadata ( final DistributionSet distributionSet ) { removeAllItems ( ) ; if ( null == distributionSet ) { return ; } selectedDistSetId = distributionSet . getId ( ) ; final List < DistributionSetMetadata > dsMetadataList = distributionSetManagement . findMetaDataByDistributionSetId ( PageRequest . of ( 0 , MAX_METADATA_QUERY ) , selectedDistSetId ) . getContent ( ) ; if ( null != dsMetadataList && ! dsMetadataList . isEmpty ( ) ) { dsMetadataList . forEach ( this :: setMetadataProperties ) ; } }
Populate distribution set metadata .
29,298
public void addSoftwareModule ( final DmfSoftwareModule createSoftwareModule ) { if ( softwareModules == null ) { softwareModules = new ArrayList < > ( ) ; } softwareModules . add ( createSoftwareModule ) ; }
Add a Software module .
29,299
static < T > void validateTenantConfigurationDataType ( final TenantConfigurationKey configurationKey , final Class < T > propertyType ) { if ( ! configurationKey . getDataType ( ) . isAssignableFrom ( propertyType ) ) { throw new TenantConfigurationValidatorException ( String . format ( "Cannot parse the database value of type %s into the type %s." , configurationKey . getDataType ( ) , propertyType ) ) ; } }
Validates the data type of the tenant configuration . If it is possible to cast to the given data type .