diff options
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/MOAPersonalAttributeList.java')
-rw-r--r-- | id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/MOAPersonalAttributeList.java | 343 |
1 files changed, 0 insertions, 343 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/MOAPersonalAttributeList.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/MOAPersonalAttributeList.java deleted file mode 100644 index d559cdba7..000000000 --- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/MOAPersonalAttributeList.java +++ /dev/null @@ -1,343 +0,0 @@ -///* -// * Copyright 2014 Federal Chancellery Austria -// * MOA-ID has been developed in a cooperation between BRZ, the Federal -// * Chancellery Austria - ICT staff unit, and Graz University of Technology. -// * -// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by -// * the European Commission - subsequent versions of the EUPL (the "Licence"); -// * You may not use this work except in compliance with the Licence. -// * You may obtain a copy of the Licence at: -// * http://www.osor.eu/eupl/ -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the Licence is distributed on an "AS IS" basis, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the Licence for the specific language governing permissions and -// * limitations under the Licence. -// * -// * This product combines work with different licenses. See the "NOTICE" text -// * file for details on the various modules and licenses. -// * The "NOTICE" text file is part of the distribution. Any derivative works -// * that you distribute must include a readable copy of the "NOTICE" text file. -// */ -//package at.gv.egovernment.moa.id.auth.modules.eidas.utils; -// -//import java.io.IOException; -//import java.io.ObjectInputStream; -//import java.util.ArrayList; -//import java.util.Collections; -//import java.util.HashMap; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.StringTokenizer; -//import java.util.concurrent.ConcurrentHashMap; -// -//import org.apache.commons.lang.StringUtils; -// -//import at.gv.egovernment.moa.logging.Logger; -// -//import eu.eidas.auth.commons.AttributeConstants; -//import eu.eidas.auth.commons.AttributeUtil; -//import eu.eidas.auth.commons.EIDASErrors; -//import eu.eidas.auth.commons.EIDASParameters; -//import eu.eidas.auth.commons.EIDASUtil; -//import eu.eidas.auth.commons.EIDASValues; -//import eu.eidas.auth.commons.IPersonalAttributeList; -//import eu.eidas.auth.commons.PersonalAttribute; -//import eu.eidas.auth.commons.exceptions.InternalErrorEIDASException; -// -///** -// * @author tlenz -// * -// */ -//public final class MOAPersonalAttributeList extends -// ConcurrentHashMap<String, PersonalAttribute> implements IPersonalAttributeList { -// -// /** -// * -// */ -// private static final long serialVersionUID = -4488124133022713089L; -// -// public MOAPersonalAttributeList(IPersonalAttributeList eIDASAttributeList) { -// super(); -// Iterator<PersonalAttribute> element = eIDASAttributeList.iterator(); -// while(element.hasNext()) -// add(element.next()); -// -// } -// -// /** -// * Hash with the latest fetched attribute name alias. -// */ -// private Map<String, Integer> latestAttrAlias = -// new HashMap<String, Integer>(); -// -// /** -// * Hash with mapping number of alias or the attribute name. -// */ -// private Map<String, Integer> attrAliasNumber = -// new HashMap<String, Integer>(); -// private List<String> insertOrder = new ArrayList<String>(); -// -// /** -// * Obtain the insertOrder Collection -// * -// * @return defensive copy of the collection -// */ -// List<String> getInsertOrder() { -// return Collections.unmodifiableList(this.insertOrder); -// } -// -// /** -// * Default constructor. -// */ -// public MOAPersonalAttributeList() { -// super(); -// -// } -// -// /** -// * Constructor with initial capacity for the PersonalAttributeList size. -// * -// * @param capacity The initial capacity for the PersonalAttributeList. -// */ -// public MOAPersonalAttributeList(final int capacity) { -// super(capacity); -// } -// -// /** -// * {@inheritDoc} -// */ -// public Iterator<PersonalAttribute> iterator() { -// return new MOAOrderedAttributeIterator(this); -// } -// -// /** -// * {@inheritDoc} -// */ -// public PersonalAttribute get(final Object key) { -// String attrName = (String) key; -// -// if (this.latestAttrAlias == null) -// this.latestAttrAlias = new HashMap<String, Integer>(); -// -// if (this.attrAliasNumber == null) -// this.attrAliasNumber = new HashMap<String, Integer>(); -// -// if (this.latestAttrAlias.containsKey(key)) { -// attrName = attrName + this.latestAttrAlias.get(key); -// } else { -// if (this.attrAliasNumber.containsKey(key)) { -// this.latestAttrAlias.put(attrName, this.attrAliasNumber.get(key)); -// } -// } -// return super.get(attrName); -// } -// -// /** -// * {@inheritDoc} -// */ -// public void add(final PersonalAttribute value) { -// if (value != null) { -// this.put(value.getName(), value); -// } -// } -// -// /** -// * {@inheritDoc} -// */ -// public PersonalAttribute put(final String key, final PersonalAttribute val) { -// if (StringUtils.isNotEmpty(key) && val != null) { -// // Validate if attribute name already exists! -// String attrAlias = key; -// if (this.containsKey(attrAlias)) { -// if (this.attrAliasNumber == null) -// this.attrAliasNumber = new HashMap<String, Integer>(); -// if (!val.isEmptyValue() && StringUtils.isNumeric(val.getValue().get(0))) { -// final String attrValue = val.getValue().get(0); -// attrAlias = key + attrValue; -// this.attrAliasNumber.put(key, Integer.valueOf(attrValue)); -// } else { -// final PersonalAttribute attr = super.get(key); -// if (!attr.isEmptyValue() -// && StringUtils.isNumeric(attr.getValue().get(0))) { -// attrAlias = key + attr.getValue().get(0); -// super.put(key, (PersonalAttribute) attr); -// this.attrAliasNumber.put(key, null); -// } -// } -// } else { -// if (insertOrder == null) -// insertOrder = new ArrayList<String>(); -// -// insertOrder.add(key); -// } -// return super.put(attrAlias, val); -// } else { -// return null; -// } -// } -// -// @Override -// public PersonalAttribute remove(Object key) { -// insertOrder.remove(key); -// return super.remove(key); -// } -// -// /** -// * {@inheritDoc} -// */ -// public void populate(final String attrList) { -// final StringTokenizer strToken = -// new StringTokenizer(attrList, EIDASValues.ATTRIBUTE_SEP.toString()); -// -// while (strToken.hasMoreTokens()) { -// final PersonalAttribute persAttr = new PersonalAttribute(); -// String[] tuples = -// strToken.nextToken().split(EIDASValues.ATTRIBUTE_TUPLE_SEP.toString(), -// AttributeConstants.NUMBER_TUPLES.intValue()); -// -// // Convert to the new format if needed! -// tuples = convertFormat(tuples); -// -// if (AttributeUtil.hasValidTuples(tuples)) { -// final int attrValueIndex = -// AttributeConstants.ATTR_VALUE_INDEX.intValue(); -// final String tmpAttrValue = -// tuples[attrValueIndex].substring(1, -// tuples[attrValueIndex].length() - 1); -// final String[] vals = -// tmpAttrValue.split(EIDASValues.ATTRIBUTE_VALUE_SEP.toString()); -// -// persAttr.setName(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()]); -// persAttr.setIsRequired(Boolean -// .valueOf(tuples[AttributeConstants.ATTR_TYPE_INDEX.intValue()])); -// // check if it is a complex value -// if (tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()] -// .equals(EIDASParameters.COMPLEX_ADDRESS_VALUE.toString())) { -// persAttr.setComplexValue(createComplexValue(vals)); -// } else { -// persAttr.setValue(createValues(vals)); -// } -// -// if (tuples.length == AttributeConstants.NUMBER_TUPLES.intValue()) { -// persAttr.setStatus(tuples[AttributeConstants.ATTR_STATUS_INDEX -// .intValue()]); -// } -// this.put(tuples[AttributeConstants.ATTR_NAME_INDEX.intValue()], -// persAttr); -// -// } else { -// Logger.info("BUSINESS EXCEPTION : Invalid personal attribute list tuples"); -// } -// -// } -// } -// -// /** -// * Returns a copy of this <tt>IPersonalAttributeList</tt> instance. -// * -// * @return The copy of this IPersonalAttributeList. -// */ -// public Object clone() { -// try { -// MOAPersonalAttributeList theClone= (MOAPersonalAttributeList)super.clone(); -// theClone.insertOrder=new ArrayList<String>(insertOrder); -// return theClone; -// -// } catch (CloneNotSupportedException e) { -// throw new InternalErrorEIDASException( -// EIDASUtil.getConfig(EIDASErrors.INTERNAL_ERROR.errorCode()), -// EIDASUtil.getConfig(EIDASErrors.INTERNAL_ERROR.errorMessage()), e); -// } -// } -// -// /** -// * Creates a string in the following format. -// * -// * attrName:attrType:[attrValue1,attrValue2=attrComplexValue]:attrStatus; -// * -// * @return {@inheritDoc} -// */ -// @Override -// public String toString() { -// final StringBuilder strBuilder = new StringBuilder(); -// final Iterator<String> iteratorInsertOrder = insertOrder.iterator(); -// while (iteratorInsertOrder.hasNext()) { -// String key = iteratorInsertOrder.next(); -// final PersonalAttribute attr = get(key); -// strBuilder.append(attr.toString()); -// if (isNumberAlias(key)) { -// strBuilder.append(get(key).toString()); -// } -// } -// return strBuilder.toString(); -// } -// -// /** -// * Validates and creates the attribute's complex values. -// * -// * @param values The complex values. -// * @return The {@link Map} with the complex values. -// * @see Map -// */ -// private Map<String, String> createComplexValue(final String[] values) { -// final Map<String, String> complexValue = new HashMap<String, String>(); -// for (final String val : values) { -// final String[] tVal = val.split("="); -// if (StringUtils.isNotEmpty(val) && tVal.length == 2) { -// complexValue.put(tVal[0], AttributeUtil.unescape(tVal[1])); -// } -// } -// return complexValue; -// } -// -// /** -// * Validates and creates the attribute values. -// * -// * @param vals The attribute values. -// * @return The {@link List} with the attribute values. -// * @see List -// */ -// private List<String> createValues(final String[] vals) { -// final List<String> values = new ArrayList<String>(); -// for (final String val : vals) { -// if (StringUtils.isNotEmpty(val)) { -// values.add(AttributeUtil.unescape(val)); -// } -// } -// return values; -// } -// -// ////////////////// -// /** -// * Converts the attribute tuple (attrName:attrType...) to the new format. -// * -// * @param tuples The attribute tuples to convert. -// * @return The attribute tuples in the new format. -// */ -// private String[] convertFormat(final String[] tuples) { -// final String[] newFormatTuples = -// new String[AttributeConstants.NUMBER_TUPLES.intValue()]; -// if (tuples != null) { -// System.arraycopy(tuples, 0, newFormatTuples, 0, tuples.length); -// -// for (int i = tuples.length; i < newFormatTuples.length; i++) { -// if (i == AttributeConstants.ATTR_VALUE_INDEX.intValue()) { -// newFormatTuples[i] = "[]"; -// } else { -// newFormatTuples[i] = ""; -// } -// } -// } -// return newFormatTuples; -// } -// -// public boolean isNumberAlias(String key) { -// return this.attrAliasNumber.containsKey(key); -// } -// -// -// -//} |