/** * Updates column hint values by given axis attributes. * * @param outputAttrs the latest axis attributes * @param cachedOutputAttrs the last(cached) axis attributes * @param newHint the column hint */ private static void updateColumnHintFromAxisAttrs( AxisAttributes axisAttributes, AxisAttributes cachedAxisAttributes, ColumnHint newHint) { if (axisAttributes == null) return; Object newValue = axisAttributes.getAxisType(); Object oldValue = cachedAxisAttributes == null ? null : cachedAxisAttributes.getAxisType(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty( ColumnHint.ANALYSIS_MEMBER, convertAxisTypeToAnalysisType((AxisType) newValue)); } newValue = axisAttributes.isOnColumnLayout(); oldValue = cachedAxisAttributes == null ? null : cachedAxisAttributes.isOnColumnLayout(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.ON_COLUMN_LAYOUT_MEMBER, newValue); } newValue = axisAttributes.getRelatedColumns(); oldValue = cachedAxisAttributes == null ? null : cachedAxisAttributes.getRelatedColumns(); if (!CompareUtil.isEquals(oldValue, newValue)) { String analysisColumnName = null; DataElementIdentifiers columns = ((ResultSubset) newValue).getColumnIdentifiers(); if (columns != null && !columns.getIdentifiers().isEmpty()) analysisColumnName = columns.getIdentifiers().get(0).getName(); newHint.setProperty(ColumnHint.ANALYSIS_COLUMN_MEMBER, analysisColumnName); } }
/** * Updates column hint values by given data element attributes. * * @param dataAttrs the latest data element attributes * @param cachedDataAttrs the last(cached) data element attributes * @param newHint the column hint */ private static void updateColumnHintFromDataAttrs( DataElementAttributes dataAttrs, DataElementAttributes cachedDataAttrs, ColumnHint newHint, OdaResultSetColumn column) { if (dataAttrs == null) return; Object oldValue = cachedDataAttrs == null ? null : cachedDataAttrs.getName(); Object newValue = dataAttrs.getName(); // If column name in hint already matches column name in column, don't // update it even if // oda has a new column name. Column name in hint and column has to // match as model use column name // as identifier to relate column and hint if (!CompareUtil.isEquals( newHint.getProperty(null, ColumnHint.COLUMN_NAME_MEMBER), column.getColumnName()) && !CompareUtil.isEquals(oldValue, newValue)) newHint.setProperty(ColumnHint.COLUMN_NAME_MEMBER, newValue); DataElementUIHints dataUIHints = dataAttrs.getUiHints(); if (dataUIHints == null) return; DataElementUIHints cachedDataUIHints = cachedDataAttrs == null ? null : cachedDataAttrs.getUiHints(); oldValue = cachedDataUIHints == null ? null : cachedDataUIHints.getDisplayName(); newValue = dataUIHints.getDisplayName(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.DISPLAY_NAME_MEMBER, newValue); } oldValue = cachedDataUIHints == null ? null : cachedDataUIHints.getDisplayNameKey(); newValue = dataUIHints.getDisplayNameKey(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.DISPLAY_NAME_ID_MEMBER, newValue); } // description to description in data ui hints: not support now /* * oldValue = cachedDataUIHints == null ? null : cachedDataUIHints * .getDescription( ); newValue = dataUIHints.getDescription( ); if ( * oldValue == null || !oldValue.equals( newValue ) ) { * newHint.setProperty( ColumnHint.DESCRIPTION_MEMBER, newValue ); } * * oldValue = cachedDataUIHints == null ? null : cachedDataUIHints * .getDescriptionKey( ); newValue = dataUIHints.getDescriptionKey( ); * if ( oldValue == null || !oldValue.equals( newValue ) ) { * newHint.setProperty( ColumnHint.DESCRIPTION_ID_MEMBER, newValue ); } */ }
public synchronized boolean contains(int key) { IntLinkedSetry buk[] = table; int index = hash(key) % buk.length; for (IntLinkedSetry e = buk[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized boolean containsValue(int value) { ENTRY tab[] = table; int i = tab.length; while (i-- > 0) { for (ENTRY e = tab[i]; e != null; e = e.next) { if (CompareUtil.equals(e.value, value)) { return true; } } } return false; }
/** * Updates values in InputElementAttributes to the given report parameter. * * @param elementAttrs the latest input element attributes * @param cachedElementAttrs the cached input element attributes * @param reportParam the report parameter * @param setHandle the ROM data set that has the corresponding data set parameter * @throws SemanticException */ protected void updateInputElementAttrsToReportParam( InputElementAttributes elementAttrs, InputElementAttributes cachedElementAttrs, AbstractScalarParameterHandle reportParam, OdaDataSetHandle setHandle) throws SemanticException { if (elementAttrs == null) return; // update default values. updateDefaultValueToReportParam(elementAttrs, cachedElementAttrs, reportParam); // update isOptional value Boolean isOptional = Boolean.valueOf(elementAttrs.isOptional()); Boolean cachedIsOptional = cachedElementAttrs == null ? null : Boolean.valueOf(cachedElementAttrs.isOptional()); if (!CompareUtil.isEquals(cachedIsOptional, isOptional)) setReportParamIsRequired(reportParam, ALLOW_BLANK_PROP_NAME, isOptional.booleanValue()); // update selection choices updateROMSelectionList( elementAttrs.getStaticValueChoices(), cachedElementAttrs == null ? null : cachedElementAttrs.getStaticValueChoices(), reportParam); // update dynamic list DynamicValuesQuery valueQuery = elementAttrs.getDynamicValueChoices(); AdapterUtil.updateROMDyanmicList( valueQuery, cachedElementAttrs == null ? null : cachedElementAttrs.getDynamicValueChoices(), reportParam, setHandle); // for dynamic parameter, the flag is in DynamicValuesQuery is true // for static parameter, the DynamicValuesQuery is null or the flag is // false DynamicValuesQuery cachedValueQuery = cachedElementAttrs == null ? null : cachedElementAttrs.getDynamicValueChoices(); boolean isEnabled = (valueQuery == null) ? false : valueQuery.isEnabled(); if (reportParam.getContainer() != null && reportParam.getContainer() instanceof CascadingParameterGroupHandle) isEnabled = true; if (cachedValueQuery == null || cachedValueQuery.isEnabled() != isEnabled) { if (isEnabled) reportParam.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC); else reportParam.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC); } }
/** * Updates result set column values by given data element attributes. * * @param dataAttrs the latest data element attributes * @param cachedDataAttrs the last (cached) data element attributes * @param newColumn the result set column * @param dataSourceId the data source id * @param dataSetId the data set id * @param params the iterator that includes oda result set columns */ private void updateResultSetColumnFromDataAttrs( DataElementAttributes dataAttrs, DataElementAttributes cachedDataAttrs, OdaResultSetColumn newColumn, String dataSourceId, String dataSetId) { if (dataAttrs == null) { return; } Object oldValue = cachedDataAttrs == null ? null : cachedDataAttrs.getName(); Object newValue = dataAttrs.getName(); if (!CompareUtil.isEquals(oldValue, newValue)) { // if the native name is just empty, treat it as null String tmpNativeName = (String) newValue; if (tmpNativeName != null && tmpNativeName.length() == 0) tmpNativeName = null; newColumn.setNativeName(tmpNativeName); } oldValue = cachedDataAttrs == null ? null : Integer.valueOf(cachedDataAttrs.getPosition()); newValue = Integer.valueOf(dataAttrs.getPosition()); if (!CompareUtil.isEquals(oldValue, newValue)) { newColumn.setPosition((Integer) newValue); } oldValue = cachedDataAttrs == null ? null : Integer.valueOf(cachedDataAttrs.getNativeDataTypeCode()); newValue = Integer.valueOf(dataAttrs.getNativeDataTypeCode()); if (!CompareUtil.isEquals(oldValue, newValue) || newColumn.getNativeDataType() == null) { newColumn.setNativeDataType((Integer) newValue); } newColumn.setDataType(getROMDataType(dataSourceId, dataSetId, newColumn)); }
public synchronized int remove(int key) { IntLinkedSetry buk[] = table; int index = hash(key) % buk.length; for (IntLinkedSetry e = buk[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { buk[index] = e.next; } count--; // unchain(e); return key; } } return NONE; }
ReviewCompareInputListener( MergeSourceViewer mergeSourceViewer, ReviewAnnotationModel annotationModel) { this.sourceViewer = CompareUtil.getSourceViewer(mergeSourceViewer); this.mergeSourceViewer = mergeSourceViewer; this.annotationModel = annotationModel; }
/** * Updates column hint values by given output element attributes. * * @param outputAttrs the latest output element attributes * @param cachedOutputAttrs the last(cached) output element attributes * @param newHint the column hint */ private static void updateColumnHintFromUsageHints( OutputElementAttributes outputAttrs, OutputElementAttributes cachedOutputAttrs, ColumnHint newHint, OdaResultSetColumn column) { if (outputAttrs == null) return; // help text and key Object oldValue = cachedOutputAttrs == null ? null : cachedOutputAttrs.getHelpText(); Object newValue = outputAttrs.getHelpText(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.HELP_TEXT_MEMBER, newValue); } oldValue = cachedOutputAttrs == null ? null : cachedOutputAttrs.getHelpTextKey(); newValue = outputAttrs.getHelpTextKey(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.HELP_TEXT_ID_MEMBER, newValue); } // m_label maps to heading oldValue = cachedOutputAttrs == null ? null : cachedOutputAttrs.getLabel(); newValue = outputAttrs.getLabel(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.HEADING_MEMBER, newValue); } oldValue = cachedOutputAttrs == null ? null : cachedOutputAttrs.getLabelKey(); newValue = outputAttrs.getLabelKey(); if (!CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty(ColumnHint.HEADING_ID_MEMBER, newValue); } // for values in formatting. ValueFormatHints formatHints = outputAttrs.getFormattingHints(); if (formatHints == null) return; ValueFormatHints cachedFormatHints = cachedOutputAttrs == null ? null : cachedOutputAttrs.getFormattingHints(); oldValue = cachedFormatHints == null ? null : cachedFormatHints.getDisplayFormat(); // convert display format in oda to pattern part of value-format member newValue = formatHints.getDisplayFormat(); if (!CompareUtil.isEquals(oldValue, newValue)) { FormatValue format = (FormatValue) newHint.getProperty(null, ColumnHint.VALUE_FORMAT_MEMBER); if (format == null && newValue != null) { format = StructureFactory.newFormatValue(); newHint.setProperty(ColumnHint.VALUE_FORMAT_MEMBER, format); } // add logic to fix 32742: if the column is date-time, then do some // special handle for the format string in IO if (newValue != null && (column != null && DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(column.getDataType()))) { String formatValue = (String) newValue; newValue = formatValue.replaceFirst("mm/", "MM/"); // $NON-NLS-1$//$NON-NLS-2$ } if (format != null) format.setPattern((String) newValue); } // not support display length /* * newValue = formatHints.getDisplaySize( ); oldValue = * cachedFormatHints == null ? null : cachedFormatHints .getDisplaySize( * ); if ( oldValue == null || !oldValue.equals( newValue ) ) { * newHint.setProperty( ColumnHint.DISPLAY_LENGTH_MEMBER, newValue ); } */ newValue = formatHints.getHorizontalAlignment(); oldValue = cachedFormatHints == null ? null : cachedFormatHints.getHorizontalAlignment(); if (formatHints.isSetHorizontalAlignment() && !CompareUtil.isEquals(oldValue, newValue)) { newHint.setProperty( ColumnHint.HORIZONTAL_ALIGN_MEMBER, convertToROMHorizontalAlignment((HorizontalAlignment) newValue)); } // not support word-wrap /* * newValue = formatHints.getTextWrapType( ); oldValue = * cachedFormatHints == null ? null : cachedFormatHints * .getTextWrapType( ); * * if ( oldValue == null || !oldValue.equals( newValue ) ) { * newHint.setProperty( ColumnHint.WORD_WRAP_MEMBER, * convertToROMWordWrap( (TextWrapType) newValue ) ); } */ // cannot handle text format since two objects in ODA and ROM are // different. }
public boolean equals(Object o) { if (!(o instanceof IntLinkedSetry)) return false; IntLinkedSetry e = (IntLinkedSetry) o; return CompareUtil.equals(e.key, key); }
private synchronized int _put(int key, MODE m) { IntLinkedSetry buk[] = table; int index = hash(key) % buk.length; for (IntLinkedSetry e = buk[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { switch (m) { case FORCE_FIRST: if (header.link_next != e) { unchain(e); chain(header, header.link_next, e); } break; case FORCE_LAST: if (header.link_prev != e) { unchain(e); chain(header.link_prev, header, e); } break; } return key; } } if (max > 0) { switch (m) { case FORCE_FIRST: case FIRST: while (count >= max) { int v = header.link_prev.key; remove(v); overflowed(v); } break; case FORCE_LAST: case LAST: while (count >= max) { int v = header.link_next.key; remove(v); overflowed(v); } break; } } if (count >= threshold) { rehash(); buk = table; index = hash(key) % buk.length; } IntLinkedSetry e = new IntLinkedSetry(key, buk[index]); buk[index] = e; switch (m) { case FORCE_FIRST: case FIRST: chain(header, header.link_next, e); break; case FORCE_LAST: case LAST: chain(header.link_prev, header, e); break; } count++; return NONE; }