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

org.bonitasoft.engine.business.application.ApplicationCreator Maven / Gradle / Ivy

There is a newer version: 10.2.0
Show newest version
/**
 * Copyright (C) 2019 Bonitasoft S.A.
 * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
 * 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
 * version 2.1 of the License.
 * 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.
 * You should have received a copy of the GNU Lesser General Public License along with this
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA.
 **/
package org.bonitasoft.engine.business.application;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.bonitasoft.engine.profile.Profile;

/**
 * Describes the information about an {@link Application} to be created
 *
 * @author Elias Ricken de Medeiros
 * @see Application
 * @since 7.0.0
 */
public class ApplicationCreator implements Serializable {

    private static final long serialVersionUID = -916041825489100271L;

    private final Map fields;

    /**
     * Creates an instance of ApplicationCreator containing mandatory information.
     * 

The created {@link Application} will used the default layout.

* * @param token the {@code Application} token. The token will be part of application URL. It cannot be null or empty * and should contain only alpha numeric * characters and the following special characters '-', '.', '_' or '~'. In addition, the following words are * reserved key words and cannot be used * as token: 'api', 'content', 'theme'. * @param displayName the Application display name. It cannot be null or empty * @param version the Application version * @see Application */ public ApplicationCreator(final String token, final String displayName, final String version) { fields = new HashMap<>(3); fields.put(ApplicationField.TOKEN, token); fields.put(ApplicationField.VERSION, version); fields.put(ApplicationField.DISPLAY_NAME, displayName); } /** * Retrieves the {@link Application} token * * @return the Application token * @see Application */ public String getToken() { return (String) fields.get(ApplicationField.TOKEN); } /** * Defines the {@link Application} description and returns the current ApplicationCreator * * @param description the Application description * @return the current ApplicationCreator * @see Application */ public ApplicationCreator setDescription(final String description) { fields.put(ApplicationField.DESCRIPTION, description); return this; } /** * Defines the {@link Application} icon path and returns the current ApplicationCreator * * @param iconPath the Application icon path * @return the current ApplicationCreator * @see Application */ public ApplicationCreator setIconPath(final String iconPath) { fields.put(ApplicationField.ICON_PATH, iconPath); return this; } /** * Defines the identifier of the {@link Profile} related to this {@link Application} and returns the current * ApplicationCreator * * @param profileId the Profile identifier * @return the current ApplicationCreator * @see Application * @see Profile */ public ApplicationCreator setProfileId(final Long profileId) { fields.put(ApplicationField.PROFILE_ID, profileId); return this; } /** * Retrieves all fields defined in this ApplicationCreator * * @return a {@link Map}<{@link ApplicationField}, {@link Serializable}> containing all fields defined in this * ApplicationCreator * @see ApplicationField */ public Map getFields() { return fields; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (fields == null ? 0 : fields.hashCode()); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ApplicationCreator other = (ApplicationCreator) obj; if (fields == null) { if (other.fields != null) { return false; } } else if (!fields.equals(other.fields)) { return false; } return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy