@PUT
@Path("{packageName}")
@Consumes(MediaType.APPLICATION_ATOM_XML)
public void updatePackageFromAtom(@PathParam("packageName") String packageName, Entry entry) {
try {
ModuleItem p = rulesRepository.loadModule(packageName);
p.checkout();
// TODO: support rename package.
// p.updateTitle(entry.getTitle());
if (entry.getSummary() != null) {
p.updateDescription(entry.getSummary());
}
// TODO: support LastContributor
if (entry.getAuthor() != null) {
}
ExtensibleElement metadataExtension = entry
.getExtension(Translator.METADATA);
if (metadataExtension != null) {
ExtensibleElement archivedExtension = metadataExtension
.getExtension(Translator.ARCHIVED);
if (archivedExtension != null) {
p.archiveItem(Boolean.getBoolean(archivedExtension
.getSimpleExtension(Translator.VALUE)));
}
// TODO: Package state is not fully supported yet
/*
* ExtensibleElement stateExtension =
* metadataExtension.getExtension(Translator.STATE);
* if(stateExtension != null) {
* p.updateState(stateExtension.getSimpleExtension
* (Translator.STATE)); }
*/
}
p.checkin("Updated from ATOM.");
rulesRepository.save();
} catch (Exception e) {
throw new WebApplicationException(e);
}
}