use of com.runwaysdk.dataaccess.MdClassDAOIF in project geoprism-registry by terraframe.
the class PatchCodeMetadata method create.
// @Transaction
public void create(ServerGeoObjectType type) {
List<ServerGeoObjectType> subtypes = type.getSubtypes();
for (ServerGeoObjectType subtype : subtypes) {
// Add the code attribute to the subtypes
MdClassDAOIF[] mdClasses = new MdClassDAOIF[] { subtype.getMdVertex(), subtype.getMdBusinessDAO() };
for (MdClassDAOIF mdClass : mdClasses) {
MdAttributeCharacterDAO codeMdAttr = MdAttributeCharacterDAO.newInstance();
codeMdAttr.setValue(MdAttributeConcreteInfo.NAME, DefaultAttribute.CODE.getName());
codeMdAttr.setStructValue(MdAttributeConcreteInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, DefaultAttribute.CODE.getDefaultLocalizedName());
codeMdAttr.setStructValue(MdAttributeConcreteInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, DefaultAttribute.CODE.getDefaultDescription());
codeMdAttr.setValue(MdAttributeCharacterInfo.SIZE, MdAttributeCharacterInfo.MAX_CHARACTER_SIZE);
codeMdAttr.setValue(MdAttributeConcreteInfo.DEFINING_MD_CLASS, mdClass.getOid());
codeMdAttr.setValue(MdAttributeConcreteInfo.REQUIRED, MdAttributeBooleanInfo.TRUE);
codeMdAttr.addItem(MdAttributeConcreteInfo.INDEX_TYPE, IndexTypes.UNIQUE_INDEX.getOid());
codeMdAttr.apply();
}
}
}
use of com.runwaysdk.dataaccess.MdClassDAOIF in project geoprism-registry by terraframe.
the class TermConverter method enforceTermPermissions.
public static void enforceTermPermissions(Classifier parent, CGRPermissionActionIF action) {
GeoObjectTypePermissionServiceIF service = ServiceFactory.getGeoObjectTypePermissionService();
// Is this a root term for an {@link MdAttributeTerm}
try (OIterator<? extends MdAttributeTerm> attrTerm = parent.getAllClassifierTermAttributeRoots()) {
for (MdAttributeTerm mdAttributeTerm : attrTerm) {
MdClassDAOIF mdEntityDAOIF = MdClassDAO.get(mdAttributeTerm.getDefiningMdClassId());
ServerGeoObjectType geoObjectType = ServerGeoObjectType.get(mdEntityDAOIF.getTypeName(), true);
if (geoObjectType != null) {
Organization organization = geoObjectType.getOrganization();
service.enforceActorHasPermission(organization.getCode(), geoObjectType, geoObjectType.getIsPrivate(), action);
}
}
}
}
Aggregations