} else {
isPrivate = false;
}
}
if ( !isPrivate ) {
final MetatypeAttributeDefinition ad = new MetatypeAttributeDefinition();
ocd.getProperties().add(ad);
ad.setId(pd.getName());
ad.setType(pd.getType().name());
if (pd.getLabel() != null ) {
ad.setName(pd.getLabel());
}
if (pd.getDescription() != null ) {
ad.setDescription(pd.getDescription());
}
if ( pd.getUnbounded() == PropertyUnbounded.DEFAULT ) {
if ( pd.getCardinality() != 0 ) {
ad.setCardinality(pd.getCardinality());
}
} else if ( pd.getUnbounded() == PropertyUnbounded.ARRAY ) {
// unlimited array
ad.setCardinality(new Integer(Integer.MAX_VALUE));
} else {
// unlimited vector
ad.setCardinality(new Integer(Integer.MIN_VALUE));
}
ad.setDefaultValue(pd.getValue());
ad.setDefaultMultiValue(pd.getMultiValue());
// check options
final String[] parameters = pd.getOptions();
if ( parameters != null && parameters.length > 0 ) {
final Map<String, String> options = new LinkedHashMap<String, String>();
for (int j=0; j < parameters.length; j=j+2) {
final String optionLabel = parameters[j];
final String optionValue = (j < parameters.length-1) ? parameters[j+1] : null;
if (optionValue != null) {
options.put(optionLabel, optionValue);
}
}
ad.setOptions(options);
}
}
} else {
// additional metatype checks (FELIX-4033)
if ( pd.isPrivate() != null && pd.isPrivate() ) {