Package de.innovationgate.webgate.api.schemadef

Examples of de.innovationgate.webgate.api.schemadef.WGSchemaDocumentDefinition


    public List<WGAreaDefinition> getAreaDefinitions() {
        List<WGAreaDefinition> areaDefs = new ArrayList<WGAreaDefinition>();
        if (_schema != null) {
            Iterator<WGSchemaDocumentDefinition> defs =  _schema.getDocumentDefinitions().iterator();
            while (defs.hasNext()) {
                WGSchemaDocumentDefinition def = defs.next();
                if (def instanceof WGAreaDefinition) {
                    areaDefs.add((WGAreaDefinition)def);
                }
            }
        }
View Full Code Here


    public List<WGLanguageDefinition> getLanguageDefinitions() {
        List<WGLanguageDefinition> langDefs = new ArrayList<WGLanguageDefinition>();
        if (_schema != null) {
            Iterator<WGSchemaDocumentDefinition> defs =  _schema.getDocumentDefinitions().iterator();
            while (defs.hasNext()) {
                WGSchemaDocumentDefinition def = defs.next();
                if (def instanceof WGLanguageDefinition) {
                    langDefs.add((WGLanguageDefinition)def);
                }
            }
        }
View Full Code Here

    public List<WGContentTypeDefinition> getContentTypeDefinitions() {
        List<WGContentTypeDefinition> ctDefs = new ArrayList<WGContentTypeDefinition>();
        if (_schema != null) {
            Iterator<WGSchemaDocumentDefinition> defs =  _schema.getDocumentDefinitions().iterator();
            while (defs.hasNext()) {
                WGSchemaDocumentDefinition def = defs.next();
                if (def instanceof WGContentTypeDefinition) {
                    ctDefs.add((WGContentTypeDefinition)def);
                }
            }
        }
View Full Code Here

    public String getText(Object node) {
        if (node instanceof String) {
            return (String)node;
        } else if (node instanceof WGSchemaDocumentDefinition) {
            WGSchemaDocumentDefinition def = (WGSchemaDocumentDefinition) node;
            return def.getName();
        } else if (node instanceof WGContentItemDefinition) {
            WGContentItemDefinition def = (WGContentItemDefinition) node;
            return def.getName();
        } else if (node instanceof WGMetaFieldDefinition) {
            WGMetaFieldDefinition def = (WGMetaFieldDefinition) node;
            return AddContentTypeMetaDefinitionDialog.METADATA_DEFINITION_LABELS.get(def.getName());
        }
        return null;
    }
View Full Code Here

                ISelection selection = _treeViewer.getSelection();
                if (selection instanceof TreeSelection) {
                    TreeSelection treeSelection = (TreeSelection) selection;
                    Object node = treeSelection.getFirstElement();
                    if (node instanceof WGSchemaDocumentDefinition) {
                        WGSchemaDocumentDefinition def = (WGSchemaDocumentDefinition)node;
                        String typeName = "Document Definition";
                        if (def instanceof WGContentTypeDefinition) {
                            typeName = "Content Type Definition";
                        } else if (def instanceof WGAreaDefinition) {
                            typeName = "Area Definition";
                        } else if (def instanceof WGLanguageDefinition) {
                            typeName = "Language Definition";
                        }
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + def.getName() + "'?");
                        if (result) {
                            _model.removeSchemaDocumentDefintion(def);
                        }
                    } else if (node instanceof WGContentItemDefinition) {
                        WGContentItemDefinition def = (WGContentItemDefinition)node;
                        String typeName = "Item Definition";
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + def.getName() + "'?");
                        if (result) {
                            _model.remove(def);
                        }
                    } else if (node instanceof WGMetaFieldDefinition) {
                        WGMetaFieldDefinition def = (WGMetaFieldDefinition)node;
                        String typeName = "Property";
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + AddContentTypeMetaDefinitionDialog.METADATA_DEFINITION_LABELS.get(def.getName()) + "'?");
                        if (result) {
                            _model.remove(def);
                        }
                    }
                }
View Full Code Here

   
    @Override
    public Object getMetaData(String name) throws WGAPIException {

        String ucName = name.toUpperCase();
        WGSchemaDocumentDefinition docDef = getSchemaDefinition();
        if (docDef != null && docDef.getMetadataCache().containsKey(ucName)) {
            WGMetaFieldDefinition metaDef = docDef.getMetadataCache().get(ucName);
            MetaInfo metaInfo = getMetaInfo(ucName);
            if (metaInfo != null && metaInfo.isMultiple()) {
                return metaDef.getValues();
            }
            else {
View Full Code Here

     * @throws WGAPIException
     */
    public boolean isMetaDeterminedInSchema(String name) throws WGAPIException {
       
        name = name.toUpperCase();
        WGSchemaDocumentDefinition docDef = getSchemaDefinition();
        if (docDef != null) {
            return docDef.getMetadataCache().containsKey(name);
        }
        else {
            return false;
        }
       
View Full Code Here

    /**
     * Creates a schema definition predefining all the metadata currently on this document
     */
    public WGSchemaDocumentDefinition createSchemaDefinition() throws WGAPIException {
       
        WGSchemaDocumentDefinition docDef;
        if (this instanceof WGContentType) {
            docDef = new WGContentTypeDefinition();
        }
        else if (this instanceof WGArea) {
            docDef = new WGAreaDefinition();
        }
        else if (this instanceof WGLanguage) {
            docDef = new WGLanguageDefinition();  
        }
        else {
            throw new WGNotSupportedException("Schema definitions for document of type " + getClass().getName() + " are not supported");
        }
       
        docDef.setName(getName());
       
        for (String metaName : getMetaNames()) {
            MetaInfo metaInfo = getMetaInfo(metaName);
            if (!getClass().equals(metaInfo.getDefiningClass())) {
                continue;
            }
           
            Object value = getMetaData(metaName);
          
            if (!WGUtils.isEmpty(value)) {
                WGMetaFieldDefinition metaDef = new WGMetaFieldDefinition(metaName, value);
                docDef.addMetadata(metaDef);
            }
        }
       
        return docDef;
       
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.schemadef.WGSchemaDocumentDefinition

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.