下面列出了java.util.Hashtable#putAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Permission, Permission> perms =
new Hashtable<>(permsMap.size()*2);
perms.putAll(permsMap);
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Permission, Permission> perms =
new Hashtable<>(permsMap.size()*2);
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases. allPermission
* unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("allPermission", allPermission); // no sync; staleness OK
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases. allPermission
* unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("allPermission", allPermission); // no sync; staleness OK
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases. allPermission
* unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("allPermission", allPermission); // no sync; staleness OK
pfields.put("perms", perms);
out.writeFields();
}
public Hashtable getAssignmentInfoTable(Collection classesOrClassIds) throws Exception {
Set deptIds = iRemoteSolverProxy.getDepartmentIds();
Hashtable infos = new Hashtable();
Vector solverClassesOrClassIds = new Vector(classesOrClassIds.size());
for (Iterator i=classesOrClassIds.iterator();i.hasNext();) {
Object classOrClassId = i.next();
if (classOrClassId instanceof Object[]) classOrClassId = ((Object[])classOrClassId)[0];
Class_ clazz = (classOrClassId instanceof Class_ ? (Class_)classOrClassId : (new Class_DAO()).get((Long)classOrClassId));
if (clazz.getManagingDept()==null || !deptIds.contains(clazz.getManagingDept().getUniqueId())) {
AssignmentPreferenceInfo info = iCommitedClassAssignmentProxy.getAssignmentInfo(clazz);
if (info!=null)
infos.put(clazz.getUniqueId(), info);
} else {
solverClassesOrClassIds.add(clazz.getUniqueId());
}
}
if (!solverClassesOrClassIds.isEmpty())
infos.putAll(iRemoteSolverProxy.getAssignmentInfoTable2(solverClassesOrClassIds));
return infos;
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the perms field out as a Hashtable for
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<String, Permission> permissions =
new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("all_allowed", all_allowed);
pfields.put("permissions", permissions);
pfields.put("permClass", permClass);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Permission, Permission> perms =
new Hashtable<>(permsMap.size()*2);
perms.putAll(permsMap);
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Permission, Permission> perms =
new Hashtable<>(permsMap.size()*2);
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Permission, Permission> perms =
new Hashtable<>(permsMap.size()*2);
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("perms", perms);
out.writeFields();
}
/**
* @serialData Default fields.
*/
/*
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases. allPermission
* unchanged.
*/
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) {
perms.putAll(permsMap);
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("allPermission", allPermission); // no sync; staleness OK
pfields.put("perms", perms);
out.writeFields();
}
public Dictionary<String, String> getProperties() {
final Hashtable<String, String> p = new Hashtable<String, String>(props_default);
@SuppressWarnings({ "rawtypes", "unchecked" })
final
Hashtable<String,String> sysProps = (Hashtable) System.getProperties();
p.putAll(sysProps);
p.putAll(props);
p.put(KEY_KEYS, makeKeys());
return p;
}
/**
* Returns all request elements, including uploaded files.
*
* @return the all elements
*/
@Override
public Hashtable<String, Object> getAllElements() {
Hashtable<String, Object> result =
new Hashtable<String, Object>(uploadedFileElements);
result.putAll(request.getParameterMap());
return result;
}
/**
* Gets the configurations map.
*
* @return the configurations map
*/
public static Hashtable<String, Object> getConfigurationsMap() {
JsonArray propertySourcesArray = new JsonArray();
Hashtable<String, Object> appPropsHashtable = new Hashtable<>();
Hashtable<String, Object> rulePropsHashtable = new Hashtable<>();
Hashtable<String, Object> configHashtable = new Hashtable<>();
String configServerURL = CommonHttpUtils.getEnvironmentVariable(PacmanSdkConstants.CONFIG_SERVICE_URL);
String configCredentials = CommonHttpUtils.getEnvironmentVariable(PacmanSdkConstants.CONFIG_CREDENTIALS);
if (StringUtils.isNullOrEmpty(configServerURL) || StringUtils.isNullOrEmpty(configCredentials)) {
logger.info(PacmanSdkConstants.MISSING_CONFIGURATION);
throw new InvalidInputException(PacmanSdkConstants.MISSING_CONFIGURATION);
}
Map<String, Object> configCreds = CommonHttpUtils.getHeader(configCredentials);
JsonObject configurationsFromPacmanTable = CommonHttpUtils.getConfigurationsFromConfigApi(configServerURL, configCreds);
logger.info("Configured values {} ",configurationsFromPacmanTable);
if (configurationsFromPacmanTable != null) {
propertySourcesArray = configurationsFromPacmanTable.get("propertySources").getAsJsonArray();
}
if (propertySourcesArray.size() > 0) {
for (int i = 0; i < propertySourcesArray.size(); i++) {
JsonObject propertySource = (JsonObject) propertySourcesArray.get(i);
if (propertySource.get(PacmanSdkConstants.NAME).toString().contains("application")) {
JsonObject appProps = propertySource.get(PacmanSdkConstants.SOURCE).getAsJsonObject();
appPropsHashtable = new Gson().fromJson(appProps,new TypeToken<Hashtable<String, Object>>() {}.getType());
}
if (propertySource.get(PacmanSdkConstants.NAME).toString().contains("rule")) {
JsonObject ruleProps = propertySource.get(PacmanSdkConstants.SOURCE).getAsJsonObject();
rulePropsHashtable = new Gson().fromJson(ruleProps,new TypeToken<Hashtable<String, Object>>() {}.getType());
}
}
} else {
logger.info(PacmanSdkConstants.MISSING_DB_CONFIGURATION);
throw new InvalidInputException(PacmanSdkConstants.MISSING_DB_CONFIGURATION);
}
configHashtable.putAll(appPropsHashtable);
configHashtable.putAll(rulePropsHashtable);
return configHashtable;
}