Search in sources :

Example 1 with MdClassificationDAO

use of com.runwaysdk.dataaccess.metadata.graph.MdClassificationDAO in project geoprism-registry by terraframe.

the class ClassificationType method setRoot.

public void setRoot(Classification classification) {
    MdClassificationDAO mdClassificationDAO = (MdClassificationDAO) this.mdClassification.getBusinessDAO();
    mdClassificationDAO.setValue(MdClassificationInfo.ROOT, classification.getOid());
    mdClassificationDAO.apply();
    this.mdClassification = mdClassificationDAO;
}
Also used : MdClassificationDAO(com.runwaysdk.dataaccess.metadata.graph.MdClassificationDAO)

Example 2 with MdClassificationDAO

use of com.runwaysdk.dataaccess.metadata.graph.MdClassificationDAO in project geoprism-registry by terraframe.

the class ClassificationType method apply.

public static ClassificationType apply(String oid, String code, LocalizedValue displayLabel, LocalizedValue description) {
    MdClassificationDAO mdClassification = null;
    if (oid != null) {
        mdClassification = (MdClassificationDAO) MdClassificationDAO.get(oid).getBusinessDAO();
    } else {
        if (!MasterList.isValidName(code)) {
            throw new InvalidMasterListCodeException("The geo object type code has an invalid character");
        }
        mdClassification = MdClassificationDAO.newInstance();
        mdClassification.setValue(MdClassificationInfo.PACKAGE, RegistryConstants.CLASSIFICATION_PACKAGE);
        mdClassification.setValue(MdClassificationInfo.TYPE_NAME, code);
        mdClassification.setValue(MdClassificationInfo.GENERATE_SOURCE, MdAttributeBooleanInfo.FALSE);
    }
    LocalizedValueConverter.populate(mdClassification, MdClassificationInfo.DISPLAY_LABEL, displayLabel);
    LocalizedValueConverter.populate(mdClassification, MdClassificationInfo.DESCRIPTION, description);
    boolean isNew = mdClassification.isNew() && !mdClassification.isAppliedToDB();
    mdClassification.apply();
    ClassificationType classificationType = new ClassificationType(mdClassification);
    if (isNew) {
        // Assign permissions
        classificationType.assignPermissions();
    }
    return classificationType;
}
Also used : InvalidMasterListCodeException(net.geoprism.registry.InvalidMasterListCodeException) MdClassificationDAO(com.runwaysdk.dataaccess.metadata.graph.MdClassificationDAO)

Aggregations

MdClassificationDAO (com.runwaysdk.dataaccess.metadata.graph.MdClassificationDAO)2 InvalidMasterListCodeException (net.geoprism.registry.InvalidMasterListCodeException)1