/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2014-2015 ForgeRock AS
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/**
* CRESTHelper is a util class to make simpler the ConnectorObject and the JSON Map conversion.
*
* @author Laszlo Hordos
*/
class CRESTHelper {
/**
* Transform a <code>Collection</code> of {@link org.identityconnectors.framework.common.objects.Attribute} instances into a {@link Map}.
* <p/>
* The key to each element in the map is the <i>name</i> of an <code>Attribute</code>. The value of each element in
* the map is the <code>Attribute</code> value checked with <code>ObjectClassInfo</code>.
*
* @param attributes
* set of attribute to transform to a map.
* @param objectClassInfo
* @return a map of string and attribute value.
* @throws NullPointerException
* if the parameter <strong>attributes</strong> is <strong>null</strong>.
*/
public static JsonValue toJsonValue(
} else {
}
if (value.attributeInfo.required && (null == attribute || null == attribute.getValue() || attribute.getValue().isEmpty())) {
if (attributeValue == null) {
} else {
if (attributeValue.isEmpty()) {
} else {
})
}
final StringBuilder msg =
" attribute is not single value attribute.");
} else {
if (attributeValue.isEmpty()) {
} else {
}
}
}
}
}
}
return ret
}
return null;
}
try {
} else if (Long.TYPE.equals(attributeInfo.getType()) || Long.class.equals(attributeInfo.getType())) {
return value;
} else if (Double.TYPE.equals(attributeInfo.getType()) || Double.class.equals(attributeInfo.getType())) {
} else if (Float.TYPE.equals(attributeInfo.getType()) || Float.class.equals(attributeInfo.getType())) {
} else if (Integer.TYPE.equals(attributeInfo.getType()) || Integer.class.equals(attributeInfo.getType())) {
} else if (Boolean.TYPE.equals(attributeInfo.getType()) || Boolean.class.equals(attributeInfo.getType())) {
} else if (Byte.TYPE.equals(attributeInfo.getType()) || Byte.class.equals(attributeInfo.getType())) {
} else {
//This could happen only if this implementation and the FrameworkUtil is out of sync.
throw new IllegalArgumentException("");
}
} catch (final ClassCastException e) {
final StringBuilder msg =
}
}
final StringBuilder msg =
" attribute is not null value attribute.");
}
return null;
}
try {
} else if (Long.TYPE.equals(attributeInfo.getType()) || Long.class.equals(attributeInfo.getType())) {
} else if (Double.TYPE.equals(attributeInfo.getType()) || Double.class.equals(attributeInfo.getType())) {
} else if (Float.TYPE.equals(attributeInfo.getType()) || Float.class.equals(attributeInfo.getType())) {
} else if (Integer.TYPE.equals(attributeInfo.getType()) || Integer.class.equals(attributeInfo.getType())) {
} else if (Boolean.TYPE.equals(attributeInfo.getType()) || Boolean.class.equals(attributeInfo.getType())) {
} else if (Byte.TYPE.equals(attributeInfo.getType()) || Byte.class.equals(attributeInfo.getType())) {
return (BigDecimal) value;
return (BigInteger) value;
} else {
//This could happen only if this implementation and the FrameworkUtil is out of sync.
throw new IllegalArgumentException("");
}
} catch (final ClassCastException e) {
final StringBuilder msg =
}
}
}