CPD Results
The following document contains the results of PMD's CPD 6.49.0.
Duplications
File |
Line |
org\mycore\restapi\v1\utils\MCRRestAPIObjectsHelper.java |
462 |
org\mycore\restapi\v1\utils\MCRRestAPIObjectsHelper.java |
598 |
eMcrobjects.addContent(eMcrObject);
}
try {
StringWriter sw = new StringWriter();
XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
xout.output(docOut, sw);
return Response.ok(sw.toString())
.type("application/xml; charset=UTF-8")
.build();
} catch (IOException e) {
throw new MCRRestAPIException(Response.Status.INTERNAL_SERVER_ERROR,
new MCRRestAPIError(MCRRestAPIError.CODE_INTERNAL_ERROR, GENERAL_ERROR_MSG, e.getMessage()));
}
}
//output as JSON
if (MCRRestAPIObjects.FORMAT_JSON.equals(format)) {
StringWriter sw = new StringWriter();
try {
JsonWriter writer = new JsonWriter(sw);
writer.setIndent(" ");
writer.beginObject();
writer.name("numFound").value(objIdDates.size());
writer.name("mycoreobjects");
writer.beginArray();
for (MCRObjectIDDate oid : objIdDates) {
writer.beginObject();
writer.name("ID").value(oid.getId()); |
File |
Line |
org\mycore\restapi\v1\utils\MCRRestAPIObjectsHelper.java |
489 |
org\mycore\restapi\v1\utils\MCRRestAPIObjectsHelper.java |
628 |
writer.name("ID").value(oid.getId());
writer.name("lastModified").value(SDF_UTC.format(oid.getLastModified()));
writer.name("href").value(info.getAbsolutePathBuilder().path(oid.getId()).build().toString());
writer.endObject();
}
writer.endArray();
writer.endObject();
writer.close();
return Response.ok(sw.toString())
.type("application/json; charset=UTF-8")
.build();
} catch (IOException e) {
throw new MCRRestAPIException(Response.Status.INTERNAL_SERVER_ERROR,
new MCRRestAPIError(MCRRestAPIError.CODE_INTERNAL_ERROR, GENERAL_ERROR_MSG, e.getMessage()));
}
}
throw new MCRRestAPIException(Response.Status.INTERNAL_SERVER_ERROR,
new MCRRestAPIError(MCRRestAPIError.CODE_INTERNAL_ERROR, "A problem in programm flow", null)); |
File |
Line |
org\mycore\restapi\v1\MCRRestAuthorizationFilter.java |
99 |
org\mycore\restapi\v2\MCRRestAuthorizationFilter.java |
85 |
throws MCRRestAPIException {
LogManager.getLogger().debug("Permission: {}, Object: {}, Derivate: {}, Path: {}", permission, objectId, derId,
path);
Optional<String> checkable = Optional.ofNullable(derId)
.filter(d -> path != null) //only check for derId if path is given
.map(Optional::of)
.orElseGet(() -> Optional.ofNullable(objectId));
checkable.ifPresent(id -> LogManager.getLogger().info("Checking " + permission + " access on " + id));
MCRRequestScopeACL aclProvider = MCRRequestScopeACL.getInstance(requestContext);
boolean allowed = checkable
.map(id -> aclProvider.checkPermission(id, permission.toString()))
.orElse(true);
if (allowed) {
return;
} |
File |
Line |
org\mycore\restapi\v1\MCRRestAPIClassifications.java |
133 |
org\mycore\restapi\v1\MCRRestAPIClassifications.java |
465 |
for (Element eLabel : e.getChildren("label")) {
if (lang == null || lang.equals(eLabel.getAttributeValue("lang", Namespace.XML_NAMESPACE))) {
writer.beginObject();
writer.name("lang").value(eLabel.getAttributeValue("lang", Namespace.XML_NAMESPACE));
writer.name("text").value(eLabel.getAttributeValue("text"));
if (eLabel.getAttributeValue("description") != null) {
writer.name("description").value(eLabel.getAttributeValue("description"));
}
writer.endObject();
}
}
writer.endArray();
if (e.getChildren("category").size() > 0) { |