org.cesecore.profiles.ProfileBase Maven / Gradle / Ivy
/*************************************************************************
* *
* EJBCA Community: The OpenSource Certificate Authority *
* *
* This software 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 any later version. *
* *
* See terms of license at gnu.org. *
* *
*************************************************************************/
package org.cesecore.profiles;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
import org.cesecore.internal.UpgradeableDataHashMap;
/**
* Base class for all Profile entity beans. Mainly a holder for an UpgradeableDataHashMap, it's meant to be completely agnostic of any implementation
* details.
*
* @version $Id: ProfileBase.java 28140 2018-01-30 12:40:30Z andresjakobs $
*
*/
public abstract class ProfileBase extends UpgradeableDataHashMap implements Profile, Serializable{
private static final long serialVersionUID = 1L;
public static final float LATEST_VERSION = 1f;
private static final String PROFILE_NAME_KEY = "profile.name";
private static final String PROFILE_ID_KEY = "profile.id";
private transient Class implementationClass = null;
private transient String name = null;
private transient Integer profileId = null;
/** List separator. */
protected static final String LIST_SEPARATOR = ";";
public ProfileBase() {
//Public constructor needed deserialization
}
public ProfileBase(final String name) {
super();
setProfileName(name);
initialize();
}
/*
* This method only needs to be called by the factory method (and some unit tests), because it sets a ton of boilerplate stuff which isn't
* required by already initialized profiles.
*/
@Override
public void initialize() {
data.put(PROFILE_TYPE, getImplementationClass());
}
@Override
@SuppressWarnings("unchecked")
public LinkedHashMap