Package edu.stanford.smi.protege.server.metaproject

Examples of edu.stanford.smi.protege.server.metaproject.ProjectInstance


        if (userId.isGuest()) {
            return false;
        }
        MetaProjectManager mpm = getMetaProjectManager();
        MetaProject metaProject = mpm.getMetaProject();
        ProjectInstance project = metaProject.getProject(projectId.getId());
        if (project == null) {
            return false;
        }
        User owner = project.getOwner();
        return owner != null && userId.getUserName().equals(owner.getName());
    }
View Full Code Here


    public synchronized boolean isRegisteredProject(ProjectId projectId) {
        if (projectId == null) {
            throw new NullPointerException("projectId must not be null");
        }
        ProjectInstance pi = MetaProjectManager.getManager().getMetaProject().getProject(projectId.getId());
        return pi != null;
    }
View Full Code Here

    public void setProjectType(ProjectId projectId, OWLAPIProjectType projectType) throws UnknownProjectException {
        setPropertyValue(projectId, PROJECT_TYPE_PROPERTY_NAME, projectType.getProjectTypeName());
    }

    public String getDisplayName(ProjectId projectId) {
        ProjectInstance pi = getProjectInstance(projectId);
        Slot displayNameSlot = pi.getProtegeInstance().getKnowledgeBase().getSlot("displayName");
        if(displayNameSlot == null) {
            return projectId.getId();
        }
        else {
            return pi.getProtegeInstance().getDirectOwnSlotValue(displayNameSlot).toString();
        }
    }
View Full Code Here

        }
    }


    public String getDescription(ProjectId projectId) {
        ProjectInstance pi = getProjectInstance(projectId);
        String result = pi.getDescription();
        if(result == null) {
            return "";
        }
        return result;
    }
View Full Code Here

        }
        return result;
    }
   
    public void setDescription(ProjectId projectId, String description) {
        ProjectInstance pi = getProjectInstance(projectId);
        pi.setDescription(description);
    }
View Full Code Here

        final UserId userId = getOwner(projectId);
        return Arrays.asList(userId);
    }

    private UserId getOwner(ProjectId projectId) {
        ProjectInstance pi = getProjectInstance(projectId);
        User owner = pi.getOwner();
        return UserId.getUserId(owner.getName());
    }
View Full Code Here

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    private void setPropertyValue(ProjectId projectId, String propertyName, String propertyValue) {
        try {
            WRITE_LOCK.lock();
            ProjectInstance pi = getProjectInstance(projectId);
            MetaProject mp = getMetaProject();
            PropertyValue pv = mp.createPropertyValue(propertyName, propertyValue);
            Set<PropertyValue> propertyValues = new HashSet<PropertyValue>(pi.getPropertyValues());
            for(Iterator<PropertyValue> it = propertyValues.iterator(); it.hasNext(); ) {
                PropertyValue curPv = it.next();
                if(curPv.getPropertyName().equals(propertyName)) {
                    it.remove();
                }
            }
            propertyValues.add(pv);
            pi.setPropertyValues(propertyValues);
//            Should be threaded off
            save();
        }
        finally {
            WRITE_LOCK.unlock();
View Full Code Here

   
    private String getPropertyValue(ProjectId projectId, String propertyName, String defaultValue) {
        try {
            READ_LOCK.lock();
            ProjectInstance pi = getProjectInstance(projectId);
            String value = pi.getPropertyValue(propertyName);
            if(value == null) {
                return defaultValue;
            }
            return value;
        }
View Full Code Here

    private ProjectInstance getProjectInstance(ProjectId projectId) throws UnknownProjectException {
        try {
            READ_LOCK.lock();
            MetaProject metaProject = getMetaProject();
            ProjectInstance pi = metaProject.getProject(projectId.getId());
            if(pi == null) {
                throw new UnknownProjectException(projectId);
            }
            return pi;
        }
View Full Code Here


    public boolean isInTrash(ProjectId projectId) {
        try {
            READ_LOCK.lock();
            ProjectInstance pi = getProjectInstance(projectId);
            Instance instance = pi.getProtegeInstance();
            KnowledgeBase knowledgeBase = instance.getKnowledgeBase();
            Slot inTrashSlot = knowledgeBase.getSlot(IN_TRASH_SLOT_NAME);
            if(inTrashSlot == null) {
                return false;
            }
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protege.server.metaproject.ProjectInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.