Search in sources :

Example 1 with MdClassDAOIF

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();
        }
    }
}
Also used : MdAttributeCharacterDAO(com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MdClassDAOIF(com.runwaysdk.dataaccess.MdClassDAOIF)

Example 2 with MdClassDAOIF

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);
            }
        }
    }
}
Also used : MdAttributeTerm(com.runwaysdk.system.metadata.MdAttributeTerm) Organization(net.geoprism.registry.Organization) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MdClassDAOIF(com.runwaysdk.dataaccess.MdClassDAOIF) GeoObjectTypePermissionServiceIF(net.geoprism.registry.permission.GeoObjectTypePermissionServiceIF)

Aggregations

MdClassDAOIF (com.runwaysdk.dataaccess.MdClassDAOIF)2 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 MdAttributeCharacterDAO (com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO)1 MdAttributeTerm (com.runwaysdk.system.metadata.MdAttributeTerm)1 Organization (net.geoprism.registry.Organization)1 GeoObjectTypePermissionServiceIF (net.geoprism.registry.permission.GeoObjectTypePermissionServiceIF)1