private Integer getKey(ContentItem item) { final int prime = 31; int result = 1; result = prime * result + item.getContentType().hashCode(); result = prime * result + item.getRelativePath().hashCode(); return result; } }
private Integer getKey(ContentItem item) { final int prime = 31; int result = 1; result = prime * result + item.getContentType().hashCode(); result = prime * result + item.getRelativePath().hashCode(); return result; } }
public static void formatFailedResponse(final PatchingException e, final ModelNode failureDescription) { if(e instanceof ContentConflictsException) { failureDescription.get(Constants.MESSAGE).set(PatchLogger.ROOT_LOGGER.detectedConflicts()); final ModelNode conflicts = failureDescription.get(Constants.CONFLICTS); for(final ContentItem item : ((ContentConflictsException)e).getConflicts()) { final ContentType type = item.getContentType(); switch (type) { case BUNDLE: conflicts.get(Constants.BUNDLES).add(item.getRelativePath()); break; case MODULE: conflicts.get(Constants.MODULES).add(item.getRelativePath()); break; case MISC: conflicts.get(Constants.MISC).add(item.getRelativePath()); break; } } } else { failureDescription.set(e.getLocalizedMessage()); } }
public static void formatFailedResponse(final PatchingException e, final ModelNode failureDescription) { if(e instanceof ContentConflictsException) { failureDescription.get(Constants.MESSAGE).set(PatchLogger.ROOT_LOGGER.detectedConflicts()); final ModelNode conflicts = failureDescription.get(Constants.CONFLICTS); for(final ContentItem item : ((ContentConflictsException)e).getConflicts()) { final ContentType type = item.getContentType(); switch (type) { case BUNDLE: conflicts.get(Constants.BUNDLES).add(item.getRelativePath()); break; case MODULE: conflicts.get(Constants.MODULES).add(item.getRelativePath()); break; case MISC: conflicts.get(Constants.MISC).add(item.getRelativePath()); break; } } } else { failureDescription.set(e.getLocalizedMessage()); } }
@Override public String toString() { final StringBuilder buf = new StringBuilder(); buf.append(ID).append(':'); switch(contentItem.getContentType()) { case MISC: buf.append(ContentType.MISC.toString()); break; case MODULE: buf.append(ContentType.MODULE.toString()); break; case BUNDLE: buf.append(ContentType.BUNDLE.toString()); break; default: throw new IllegalStateException(PatchLogger.ROOT_LOGGER.unsupportedContentType(contentItem.getContentType().name())); } return buf.append(':').append(contentItem.getRelativePath()).toString(); } }
@Override public String toString() { final StringBuilder buf = new StringBuilder(); buf.append(ID).append(':'); switch(contentItem.getContentType()) { case MISC: buf.append(ContentType.MISC.toString()); break; case MODULE: buf.append(ContentType.MODULE.toString()); break; case BUNDLE: buf.append(ContentType.BUNDLE.toString()); break; default: throw new IllegalStateException(PatchLogger.ROOT_LOGGER.unsupportedContentType(contentItem.getContentType().name())); } return buf.append(':').append(contentItem.getRelativePath()).toString(); } }
if (cp1Type.equals(ModificationType.ADD)) { if (cp2Type.equals(ModificationType.ADD)) { throw new PatchingException("Patch " + cp2.getPatchId() + " adds " + cp1Mod.getItem().getRelativePath() + " already added by patch " + cp1.getPatchId()); if (cp2Type.equals(ModificationType.REMOVE)) { throw new PatchingException("Patch " + cp2.getPatchId() + " removes " + cp1Mod.getItem().getRelativePath() + " already removed by patch " + cp1.getPatchId()); } else { // modify if (cp2Type.equals(ModificationType.ADD)) { throw new PatchingException("Patch " + cp2.getPatchId() + " adds " + cp1Mod.getItem().getRelativePath() + " modified by patch " + cp1.getPatchId());
if (cp1Type.equals(ModificationType.ADD)) { if (cp2Type.equals(ModificationType.ADD)) { throw new PatchingException("Patch " + cp2.getPatchId() + " adds " + cp1Mod.getItem().getRelativePath() + " already added by patch " + cp1.getPatchId()); if (cp2Type.equals(ModificationType.REMOVE)) { throw new PatchingException("Patch " + cp2.getPatchId() + " removes " + cp1Mod.getItem().getRelativePath() + " already removed by patch " + cp1.getPatchId()); } else { // modify if (cp2Type.equals(ModificationType.ADD)) { throw new PatchingException("Patch " + cp2.getPatchId() + " adds " + cp1Mod.getItem().getRelativePath() + " modified by patch " + cp1.getPatchId());