All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alkacon.acacia.shared.ContentDefinition Maven / Gradle / Ivy

Go to download

A GWT based resource editor. This component is used as a part of OpenCms, an enterprise-ready, easy to use website content management system based on Java and XML technology. Offering a complete set of features, OpenCms helps content managers worldwide to create and maintain beautiful websites fast and efficiently.

There is a newer version: 2.1
Show newest version
/*
 * This library is part of the Acacia Editor -
 * an open source inline and form based content editor for GWT.
 *
 * Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software, please see the
 * company website: http://www.alkacon.com
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.alkacon.acacia.shared;

import com.alkacon.vie.shared.I_Type;

import java.util.List;
import java.util.Map;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Contains all information defining a content entity type.

*/ public class ContentDefinition implements IsSerializable { /** The attribute configurations. */ private Map m_configurations; /** The entity. */ private Entity m_entity; /** Indicates if optional fields should be grouped together. */ private boolean m_groupOptionalFields; /** The content locale. */ private String m_locale; /** The tab information beans. */ private List m_tabInfos; /** The types defining the entity. */ private Map m_types; /** * Constructor.

* * @param entity the entity * @param configurations the attribute configurations * @param types the types * @param tabInfos the tab information beans * @param groupOptionalFields true if optional fields should be grouped together * @param locale the content locale */ public ContentDefinition( Entity entity, Map configurations, Map types, List tabInfos, boolean groupOptionalFields, String locale) { m_entity = entity; m_configurations = configurations; m_types = types; m_tabInfos = tabInfos; m_groupOptionalFields = groupOptionalFields; m_locale = locale; } /** * Constructor. Used for serialization only.

*/ protected ContentDefinition() { // nothing to do } /** * Extracts the attribute index from the given attribute name where the index is appended to the name like 'attributename[1]'.

* * @param attributeName the attribute name * * @return the extracted index */ public static int extractIndex(String attributeName) { int index = 0; // check if the value index is appended to the attribute name if (attributeName.endsWith("]") && attributeName.contains("[")) { try { String temp = attributeName.substring(attributeName.lastIndexOf("[") + 1, attributeName.length() - 1); index = Integer.parseInt(temp); } catch (NumberFormatException e) { // ignore } } return index; } /** * Removes an attribute index suffix from the given attribute name.

* * @param attributeName the attribute name * * @return the attribute name */ public static String removeIndex(String attributeName) { if (attributeName.endsWith("]") && attributeName.contains("[")) { attributeName = attributeName.substring(0, attributeName.lastIndexOf("[")); } return attributeName; } /** * Returns the attribute configurations.

* * @return the attribute configurations */ public Map getConfigurations() { return m_configurations; } /** * Returns the entity.

* * @return the entity */ public Entity getEntity() { return m_entity; } /** * Returns the entity id.

* * @return the entity id */ public String getEntityId() { return m_entity.getId(); } /** * Returns the entity type name.

* * @return the entity type name */ public String getEntityTypeName() { return m_entity.getTypeName(); } /** * Returns the locale.

* * @return the locale */ public String getLocale() { return m_locale; } /** * Returns the tab information beans.

* * @return the tab information beans */ public List getTabInfos() { return m_tabInfos; } /** * Returns the types.

* * @return the types */ public Map getTypes() { return m_types; } /** * Returns if optional fields should be grouped together.

* * @return true if optional fields should be grouped together */ public boolean isGroupOptionalFields() { return m_groupOptionalFields; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy