Java Code Examples for org.alfresco.service.cmr.dictionary.CustomModelDefinition#isActive()

The following examples show how to use org.alfresco.service.cmr.dictionary.CustomModelDefinition#isActive() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomModelServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public CustomModelsInfo getCustomModelsInfo()
{
    List<CustomModelDefinition> page = getCustomModels(new PagingRequest(0, Integer.MAX_VALUE)).getPage();

    int activeModels = 0;
    int activeTypes = 0;
    int activeAspects = 0;
    for (CustomModelDefinition cm : page)
    {
        if (cm.isActive())
        {
            activeModels++;
            activeTypes += cm.getTypeDefinitions().size();
            activeAspects += cm.getAspectDefinitions().size();
        }
    }

    CustomModelsInfo info = new CustomModelsInfo();
    info.setNumberOfActiveModels(activeModels);
    info.setNumberOfActiveTypes(activeTypes);
    info.setNumberOfActiveAspects(activeAspects);
    return info;
}
 
Example 2
Source File: CustomModel.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
public CustomModel(CustomModelDefinition modelDefinition, List<CustomType> types, List<CustomAspect> aspects, List<CustomModelConstraint> constraints)
{
    this.name = modelDefinition.getName().getLocalName();
    this.author = modelDefinition.getAuthor();
    this.description = modelDefinition.getDescription();
    this.status = modelDefinition.isActive() ? ModelStatus.ACTIVE : ModelStatus.DRAFT;
    // we don't need to check for NoSuchElementException, as we don't allow
    // the model to be saved without a valid namespace
    NamespaceDefinition nsd = modelDefinition.getNamespaces().iterator().next();
    this.namespaceUri = nsd.getUri();
    this.namespacePrefix = nsd.getPrefix();
    this.types = types;
    this.aspects = aspects;
    this.constraints = constraints;
}
 
Example 3
Source File: CustomModelsImpl.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ModelDetails(CustomModelDefinition modelDefinition)
{
    this.model = new CustomModel(modelDefinition);
    this.active = modelDefinition.isActive();
    this.types = convertToCustomTypes(modelDefinition.getTypeDefinitions(), false);
    this.aspects = convertToCustomAspects(modelDefinition.getAspectDefinitions(), false);
    this.modelDefinedConstraints = convertToCustomModelConstraints(modelDefinition.getModelDefinedConstraints());
}