org.picketlink.idm.file.internal.FilePartition Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.picketlink.idm.file.internal;
import org.picketlink.idm.model.Partition;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author pedroigor
*/
public class FilePartition extends AbstractFileAttributedType {
private static final long serialVersionUID = -8949732184464473476L;
private static final String VERSION = "1";
private transient String configurationName;
private transient Map> identityTypes = new ConcurrentHashMap>();
private transient Map>> credentials = new ConcurrentHashMap>>();
private Map> permissions;
protected FilePartition(Partition object, String configurationName) {
super(VERSION, object);
this.configurationName = configurationName;
}
@Override
protected void doReadObject(ObjectInputStream s) throws Exception {
super.doReadObject(s);
this.configurationName = s.readObject().toString();
}
@Override
protected void doWriteObject(ObjectOutputStream s) throws Exception {
super.doWriteObject(s);
s.writeObject(configurationName);
}
@Override
protected Partition doCreateInstance(Map properties) throws Exception {
String name = properties.get("name").toString();
return (Partition) Class.forName(getType()).getConstructor(String.class).newInstance(name);
}
@Override
protected void doPopulateProperties(Map properties) throws Exception {
super.doPopulateProperties(properties);
Partition partition = getEntry();
properties.put("name", partition.getName());
}
@Override
protected Partition doPopulateEntry(Map properties) throws Exception {
Partition partition = super.doPopulateEntry(properties);
return partition;
}
public String getConfigurationName() {
return this.configurationName;
}
public Map> getIdentityTypes() {
return this.identityTypes;
}
public void setIdentityTypes(Map> identityTypes) {
this.identityTypes = identityTypes;
}
public Map>> getCredentials() {
return this.credentials;
}
public void setCredentials(Map>> credentials) {
this.credentials = credentials;
}
public void setPermissions(Map> permissions) {
this.permissions = permissions;
}
public Map> getPermissions() {
return this.permissions;
}
}