Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (C) 2010 Ansgar Gerlicher
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Stuttgart, Hochschule der Medien: http://www.mi.hdm-stuttgart.de/mmb/
 * Collaborative Editing Framework or XML:
 * http://sourceforge.net/projects/cefx/
 * 
 * Dresden, University of Technology, Faculty of Computer Science
 * Computer Networks Group: http://www.rn.inf.tu-dresden.de
 * mobilis project: http://mobilisplatform.sourceforge.net
 ******************************************************************************/

import org.w3c.dom.Element;

public class Main {
    public static final String CEFX_NAMESPACE = "http://www.hdm-stuttgart.de/~gerlicher/cefx";
    public static final String CEFX_LOCKED_ATTR_NAME = "CEFXLOCKED";

    /**
     * Checks if the given node is locked.
     * @param element the node that is to be checked.
     * @return true if the node is locked.
     */
    public static boolean isLocked(Element element) {
        String locked = element.getAttributeNS(CEFX_NAMESPACE, CEFX_LOCKED_ATTR_NAME);
        System.out.println("CEFXUtil.isLocked() " + locked + " element: " + element);
        if (locked.equals("") || locked == null) {
            // The node does not carry the Lock Attribute. It is not locked
            return false;
        } else {
            return true;
        }
    }
}