Incremented logs
This commit is contained in:
parent
9f047dff91
commit
04a86e0280
|
@ -156,13 +156,15 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
|
|
||||||
protected Project unlockAndUpdate(Project proj) throws InvalidLockException, ProjectNotFoundException,
|
protected Project unlockAndUpdate(Project proj) throws InvalidLockException, ProjectNotFoundException,
|
||||||
JsonProcessingException, InvalidUserRoleException, UnauthorizedAccess {
|
JsonProcessingException, InvalidUserRoleException, UnauthorizedAccess {
|
||||||
log.trace("Unlocking for update {} lock is {} ", proj.getId(), proj.getLock());
|
log.info("Unlocking for update {} lock is {} ", proj.getId(), proj.getLock());
|
||||||
// find one and update
|
// find one and update
|
||||||
Lock oldLock = proj.getLock();
|
Lock oldLock = proj.getLock();
|
||||||
proj.setLock(null);
|
proj.setLock(null);
|
||||||
|
|
||||||
Document filter = new Document(mongoIDFieldName(), asId(proj.getId())).append(Project.LOCK + "." + Lock.ID,
|
Document filter = new Document(mongoIDFieldName(), asId(proj.getId())).append(Project.LOCK + "." + Lock.ID,
|
||||||
oldLock.getId());
|
oldLock.getId());
|
||||||
|
|
||||||
|
log.info("Filter document is {} ", filter.toJson());
|
||||||
|
|
||||||
Object obj = getCollection().findOneAndReplace(
|
Object obj = getCollection().findOneAndReplace(
|
||||||
// filter by id and missing lock
|
// filter by id and missing lock
|
||||||
|
@ -181,13 +183,15 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
|
|
||||||
protected Project unlockAndPatch(Project proj) throws InvalidLockException, ProjectNotFoundException,
|
protected Project unlockAndPatch(Project proj) throws InvalidLockException, ProjectNotFoundException,
|
||||||
JsonProcessingException, InvalidUserRoleException, UnauthorizedAccess {
|
JsonProcessingException, InvalidUserRoleException, UnauthorizedAccess {
|
||||||
log.trace("Unlocking for patching {} lock is {} ", proj.getId(), proj.getLock());
|
log.info("Unlocking for patching {} lock is {} ", proj.getId(), proj.getLock());
|
||||||
// find one and update
|
// find one and update
|
||||||
Lock oldLock = proj.getLock();
|
Lock oldLock = proj.getLock();
|
||||||
proj.setLock(null);
|
proj.setLock(null);
|
||||||
|
|
||||||
Document filter = new Document(mongoIDFieldName(), asId(proj.getId())).append(Project.LOCK + "." + Lock.ID,
|
Document filter = new Document(mongoIDFieldName(), asId(proj.getId())).append(Project.LOCK + "." + Lock.ID,
|
||||||
oldLock.getId());
|
oldLock.getId());
|
||||||
|
|
||||||
|
log.info("Filter document is {} ", filter.toJson());
|
||||||
|
|
||||||
Object obj = getCollection().findOneAndUpdate(
|
Object obj = getCollection().findOneAndUpdate(
|
||||||
// filter by id and missing lock
|
// filter by id and missing lock
|
||||||
|
@ -367,7 +371,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
|
|
||||||
toUpdate.setTheDocument(toSet);
|
toUpdate.setTheDocument(toSet);
|
||||||
toUpdate.getLifecycleInformation().cleanState();
|
toUpdate.getLifecycleInformation().cleanState();
|
||||||
toUpdate = onPatch(toUpdate);
|
toUpdate = onUpdate(toUpdate);
|
||||||
return unlockAndPatch(toUpdate);
|
return unlockAndPatch(toUpdate);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.error("Unexpected exception ", t);
|
log.error("Unexpected exception ", t);
|
||||||
|
@ -517,12 +521,12 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
return triggerEvent(toUpdate, EventExecutionRequest.Events.ON_INIT_DOCUMENT, null);
|
return triggerEvent(toUpdate, EventExecutionRequest.Events.ON_INIT_DOCUMENT, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Project onPatch(Project toUpdate) throws EventException {
|
// private Project onPatch(Project toUpdate) throws EventException {
|
||||||
UserUtils.AuthenticatedUser u = UserUtils.getCurrent();
|
// UserUtils.AuthenticatedUser u = UserUtils.getCurrent();
|
||||||
toUpdate.getInfo().setLastEditInfo(u.asInfo());
|
// toUpdate.getInfo().setLastEditInfo(u.asInfo());
|
||||||
toUpdate.setVersion(toUpdate.getVersion().withIncPatch());
|
// toUpdate.setVersion(toUpdate.getVersion().withIncPatch());
|
||||||
return triggerEvent(toUpdate, EventExecutionRequest.Events.ON_UPDATE_DOCUMENT, null);
|
// return triggerEvent(toUpdate, EventExecutionRequest.Events.ON_UPDATE_DOCUMENT, null);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String id, boolean force)
|
public void delete(String id, boolean force)
|
||||||
|
|
|
@ -34,6 +34,13 @@ import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ProfiledDocuments.
|
||||||
|
* @author created by Fabio Sinibaldi
|
||||||
|
* @author maintainer - Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Apr 18, 2023
|
||||||
|
*/
|
||||||
@Path(InterfaceConstants.Methods.PROJECTS+"/{"+InterfaceConstants.Parameters.UCID +"}")
|
@Path(InterfaceConstants.Methods.PROJECTS+"/{"+InterfaceConstants.Parameters.UCID +"}")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestHeaders({
|
@RequestHeaders({
|
||||||
|
@ -44,6 +51,12 @@ public class ProfiledDocuments {
|
||||||
|
|
||||||
private ProfiledMongoManager manager;
|
private ProfiledMongoManager manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new profiled documents.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @throws ConfigurationException the configuration exception
|
||||||
|
*/
|
||||||
public ProfiledDocuments(@PathParam(InterfaceConstants.Parameters.UCID) String profileID) throws ConfigurationException {
|
public ProfiledDocuments(@PathParam(InterfaceConstants.Parameters.UCID) String profileID) throws ConfigurationException {
|
||||||
log.info("Accessing profile "+profileID);
|
log.info("Accessing profile "+profileID);
|
||||||
manager=new GuardedMethod<ProfiledMongoManager>(){
|
manager=new GuardedMethod<ProfiledMongoManager>(){
|
||||||
|
@ -54,6 +67,12 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the configuration.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @return the configuration
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path(InterfaceConstants.Methods.CONFIGURATION_PATH)
|
@Path(InterfaceConstants.Methods.CONFIGURATION_PATH)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -68,6 +87,12 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the new.
|
||||||
|
*
|
||||||
|
* @param d the d
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -84,6 +109,13 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update.
|
||||||
|
*
|
||||||
|
* @param documentId the document id
|
||||||
|
* @param d the d
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -98,6 +130,13 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch.
|
||||||
|
*
|
||||||
|
* @param documentId the document id
|
||||||
|
* @param d the d
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@PATCH
|
@PATCH
|
||||||
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -113,6 +152,13 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param force the force
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
||||||
|
@ -129,6 +175,13 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register file set.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param request the request
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -182,6 +235,13 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform step.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param request the request
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -201,6 +261,12 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force unlock.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -217,6 +283,13 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the access policy.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param toSet the to set
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -235,6 +308,11 @@ public class ProfiledDocuments {
|
||||||
|
|
||||||
//********************************** READ
|
//********************************** READ
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List.
|
||||||
|
*
|
||||||
|
* @return the iterable
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Iterable<?> list() {
|
public Iterable<?> list() {
|
||||||
|
@ -245,6 +323,12 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the by id.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the by id
|
||||||
|
*/
|
||||||
// BY ID
|
// BY ID
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -259,6 +343,12 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search.
|
||||||
|
*
|
||||||
|
* @param filter the filter
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -274,6 +364,12 @@ public class ProfiledDocuments {
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query.
|
||||||
|
*
|
||||||
|
* @param queryString the query string
|
||||||
|
* @return the iterable
|
||||||
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -289,6 +385,14 @@ public class ProfiledDocuments {
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relationship chain.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param relationshipId the relationship id
|
||||||
|
* @param deep the deep
|
||||||
|
* @return the relationship chain
|
||||||
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
||||||
|
@ -309,6 +413,15 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the relation.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param relationshipId the relationship id
|
||||||
|
* @param targetId the target id
|
||||||
|
* @param targetUCD the target UCD
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
||||||
|
@ -333,6 +446,15 @@ public class ProfiledDocuments {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete relation.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param relationshipId the relationship id
|
||||||
|
* @param targetId the target id
|
||||||
|
* @param targetUCD the target UCD
|
||||||
|
* @return the project
|
||||||
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
@Path("{"+InterfaceConstants.Methods.RELATIONSHIP+"}/{"+InterfaceConstants.Parameters.PROJECT_ID+"}" +
|
||||||
|
|
Loading…
Reference in New Issue