use of com.runwaysdk.system.metadata.MdAttributeUUID in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method createDefaultAttributes.
/**
* Adds default attributes to the given {@link MdBusinessDAO} according to the
* Common Geo-Registry specification for {@link GeoObject}.
*
* @param mdBusinessDAO
* {@link MdBusinessDAO} that will define the default attributes.
*/
@Transaction
public void createDefaultAttributes(Universal universal, MdBusiness definingMdBusiness) {
if (!universal.getIsLeafType()) {
// MdAttributeReference geoEntRefMdAttrRef = new MdAttributeReference();
// geoEntRefMdAttrRef.setAttributeName(RegistryConstants.GEO_ENTITY_ATTRIBUTE_NAME);
// geoEntRefMdAttrRef.getDisplayLabel().setValue(RegistryConstants.GEO_ENTITY_ATTRIBUTE_LABEL);
// geoEntRefMdAttrRef.getDescription().setValue("References a GeoEntity
// for non-leaf Universal Types");
// geoEntRefMdAttrRef.setMdBusiness(mdBusGeoEntity);
// geoEntRefMdAttrRef.setDefiningMdClass(definingMdBusiness);
// geoEntRefMdAttrRef.setRequired(false);
// geoEntRefMdAttrRef.apply();
}
// DefaultAttribute.UID - Defined on the MdBusiness and the values are from
// the {@code GeoObject#OID};
MdAttributeUUID uuidMdAttr = new MdAttributeUUID();
uuidMdAttr.setAttributeName(RegistryConstants.UUID);
uuidMdAttr.getDisplayLabel().setValue(RegistryConstants.UUID_LABEL);
uuidMdAttr.getDescription().setValue("The universal unique identifier of the feature.");
uuidMdAttr.setDefiningMdClass(definingMdBusiness);
uuidMdAttr.setRequired(true);
uuidMdAttr.addIndexType(MdAttributeIndices.UNIQUE_INDEX);
uuidMdAttr.apply();
// DefaultAttribute.TYPE - This is the display label of the Universal.
// BusObject.mdBusiness.Universal.displayLabel
// DefaultAttribute.CREATED_DATE - The create data on the Business Object?
// DefaultAttribute.UPDATED_DATE - The update data on the Business Object?
// DefaultAttribute.STATUS
MdAttributeBooleanDAO invalidMdAttr = MdAttributeBooleanDAO.newInstance();
invalidMdAttr.setValue(MdAttributeConcreteInfo.NAME, DefaultAttribute.INVALID.getName());
invalidMdAttr.setStructValue(MdAttributeConcreteInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, DefaultAttribute.INVALID.getDefaultLocalizedName());
invalidMdAttr.setStructValue(MdAttributeConcreteInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, DefaultAttribute.INVALID.getDefaultDescription());
invalidMdAttr.setValue(MdAttributeConcreteInfo.DEFINING_MD_CLASS, definingMdBusiness.getOid());
invalidMdAttr.setValue(MdAttributeConcreteInfo.REQUIRED, MdAttributeBooleanInfo.TRUE);
invalidMdAttr.setValue(MdAttributeConcreteInfo.DEFAULT_VALUE, MdAttributeBooleanInfo.FALSE);
invalidMdAttr.addItem(MdAttributeConcreteInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
invalidMdAttr.apply();
}
Aggregations