Reverted some changes
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134084 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
dfb9d513ce
commit
38eedcea37
|
@ -36,7 +36,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx;
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class ContextUtility {
|
public class ContextUtility {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(ContextUtility.class);
|
.getLogger(ContextUtility.class);
|
||||||
|
@ -86,9 +86,8 @@ public abstract class ContextUtility {
|
||||||
}
|
}
|
||||||
return authorizationEntry.getContext();
|
return authorizationEntry.getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vertex getActualContextVertex() throws ContextNotFoundException, ContextException{
|
public static UUID getActualContextUUID() throws ContextException {
|
||||||
OrientGraphNoTx orientGraphNoTx = null;
|
|
||||||
try {
|
try {
|
||||||
String scope = getCurrentScope();
|
String scope = getCurrentScope();
|
||||||
if(scope==null){
|
if(scope==null){
|
||||||
|
@ -99,30 +98,14 @@ public abstract class ContextUtility {
|
||||||
.getSecurityContextFactory(
|
.getSecurityContextFactory(
|
||||||
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
|
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
|
||||||
PermissionMode.READER);
|
PermissionMode.READER);
|
||||||
|
Vertex context = ContextUtility.getContextVertexByFullName(
|
||||||
orientGraphNoTx = factory.getNoTx();
|
factory.getTx(), scope);
|
||||||
return ContextUtility.getContextVertexByFullName(orientGraphNoTx, scope);
|
|
||||||
} catch (ContextNotFoundException e) {
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new ContextException(
|
|
||||||
"Unable to restrive Context Vertex for current Context", e);
|
|
||||||
} finally{
|
|
||||||
if(orientGraphNoTx!=null){
|
|
||||||
orientGraphNoTx.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UUID getActualContextUUID() throws ContextException {
|
|
||||||
try {
|
|
||||||
Vertex context = getActualContextVertex();
|
|
||||||
return getContextUUIDFromContextVertex(context);
|
return getContextUUIDFromContextVertex(context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ContextException(
|
throw new ContextException(
|
||||||
"Unable to restrive Context UUID for current Context", e);
|
"Unable to restrive Context UUID from current Context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +166,7 @@ public abstract class ContextUtility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vertex getContextVertexByFullName(OrientGraphNoTx orientGraphNoTx,
|
public static Vertex getContextVertexByFullName(OrientGraph orientGraph,
|
||||||
String fullName) throws ContextNotFoundException {
|
String fullName) throws ContextNotFoundException {
|
||||||
|
|
||||||
logger.trace("Going to get {} {} from full name '{}'", Context.NAME, Vertex.class.getSimpleName(), fullName);
|
logger.trace("Going to get {} {} from full name '{}'", Context.NAME, Vertex.class.getSimpleName(), fullName);
|
||||||
|
@ -199,7 +182,7 @@ public abstract class ContextUtility {
|
||||||
;
|
;
|
||||||
OSQLSynchQuery<Vertex> osqlSynchQuery = new OSQLSynchQuery<Vertex>(
|
OSQLSynchQuery<Vertex> osqlSynchQuery = new OSQLSynchQuery<Vertex>(
|
||||||
select);
|
select);
|
||||||
Iterable<Vertex> vertexes = orientGraphNoTx.command(osqlSynchQuery)
|
Iterable<Vertex> vertexes = orientGraph.command(osqlSynchQuery)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (vertexes == null || !vertexes.iterator().hasNext()) {
|
if (vertexes == null || !vertexes.iterator().hasNext()) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.tinkerpop.blueprints.Vertex;
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class HeaderUtility {
|
public class HeaderUtility {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(HeaderUtility.class);
|
.getLogger(HeaderUtility.class);
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.tinkerpop.blueprints.util.io.graphson.GraphSONUtility;
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class Utility {
|
public class Utility {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Utility.class);
|
private static final Logger logger = LoggerFactory.getLogger(Utility.class);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue