mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/osgi/MetatypeMessageService.java
private AttributeDefinitionType convertToAttribDefType(final AttributeDefinition attribute, final int filter)
    {
        //attribute definition message
        final AttributeDefinitionType.Builder attribBuilder = AttributeDefinitionType.newBuilder();
        //set values to the current attribute values
        attribBuilder.setCardinality(attribute.getCardinality());
        attribBuilder.setId(attribute.getID());
        attribBuilder.setName(attribute.getName());
        attribBuilder.setAttributeType(attribute.getType());
        
        //Description is not a required field so check for null.
        if (attribute.getDescription() != null)
        {
            attribBuilder.setDescription(attribute.getDescription());
        }
        
        //Set whether the field is required or optional.
        if (filter == ObjectClassDefinition.REQUIRED)
        {
            attribBuilder.setRequired(true);
        }
        else
        {
            attribBuilder.setRequired(false);
        }
        
        //Fill in repeated values.
        if (attribute.getDefaultValue() != null)
        {
            attribBuilder.addAllDefaultValue(Arrays.asList(attribute.getDefaultValue()));
        }        
        if (attribute.getOptionLabels() != null)
        {
            attribBuilder.addAllOptionLabel(Arrays.asList(attribute.getOptionLabels()));
        }
        if (attribute.getOptionValues() != null)
        {
            attribBuilder.addAllOptionValue(Arrays.asList(attribute.getOptionValues()));
        }
        return attribBuilder.build();
    }
/**
     * Get an attribute definition type proto message from the attribute values.
     * @param attribute
     *     The {@link AttributeDefinition} to be converted to an {@link AttributeDefinitionType}.
     * @param filter
     *     The filter used to determine whether the attribute definitions are required or not. Valid values are 
     *      {@link ObjectClassDefinition#REQUIRED}, and {@link ObjectClassDefinition#OPTIONAL}. 
     * @return
     *     a built {@link AttributeDefinitionType} message
     */
Get an attribute definition type proto message from the attribute values.
@param attribute
The  AttributeDefinition to be converted to an  AttributeDefinitionType.
@param filter
The filter used to determine whether the attribute definitions are required or not.
Get an attribute definition type proto message from the attribute values . @param attribute The AttributeDefinition to be converted to an AttributeDefinitionType . @param filter The filter used to determine whether the attribute definitions are required or not .
private AttributeDefinitionType convertToAttribDefType(final AttributeDefinition attribute, final int filter)
    {
        final AttributeDefinitionType.Builder attribBuilder = AttributeDefinitionType.newBuilder();
        attribBuilder.setCardinality(attribute.getCardinality());
        attribBuilder.setId(attribute.getID());
        attribBuilder.setName(attribute.getName());
        attribBuilder.setAttributeType(attribute.getType());
        if (attribute.getDescription() != null)
        {
            attribBuilder.setDescription(attribute.getDescription());
        }
        if (filter == ObjectClassDefinition.REQUIRED)
        {
            attribBuilder.setRequired(true);
        }
        else
        {
            attribBuilder.setRequired(false);
        }
        if (attribute.getDefaultValue() != null)
        {
            attribBuilder.addAllDefaultValue(Arrays.asList(attribute.getDefaultValue()));
        }        
        if (attribute.getOptionLabels() != null)
        {
            attribBuilder.addAllOptionLabel(Arrays.asList(attribute.getOptionLabels()));
        }
        if (attribute.getOptionValues() != null)
        {
            attribBuilder.addAllOptionValue(Arrays.asList(attribute.getOptionValues()));
        }
        return attribBuilder.build();
    }
private AttributeDefinitionType convertToAttribDefType ( final AttributeDefinition attribute , final int filter ) { final AttributeDefinitionType . Builder attribBuilder = AttributeDefinitionType . newBuilder ( ) ; attribBuilder . setCardinality ( attribute . getCardinality ( ) ) ; attribBuilder . setId ( attribute . getID ( ) ) ; attribBuilder . setName ( attribute . getName ( ) ) ; attribBuilder . setAttributeType ( attribute . getType ( ) ) ; if ( attribute . getDescription ( ) != null ) { attribBuilder . setDescription ( attribute . getDescription ( ) ) ; } if ( filter == ObjectClassDefinition . REQUIRED ) { attribBuilder . setRequired ( true ) ; } else { attribBuilder . setRequired ( false ) ; } if ( attribute . getDefaultValue ( ) != null ) { attribBuilder . addAllDefaultValue ( Arrays . asList ( attribute . getDefaultValue ( ) ) ) ; } if ( attribute . getOptionLabels ( ) != null ) { attribBuilder . addAllOptionLabel ( Arrays . asList ( attribute . getOptionLabels ( ) ) ) ; } if ( attribute . getOptionValues ( ) != null ) { attribBuilder . addAllOptionValue ( Arrays . asList ( attribute . getOptionValues ( ) ) ) ; } return attribBuilder . build ( ) ; }
Get an attribute definition type proto message from the attribute values.
Get an attribute definition type proto message from the attribute values .
//attribute definition message //set values to the current attribute values //Description is not a required field so check for null. //Set whether the field is required or optional. //Fill in repeated values.