Skip to content

Commit 2c2afe4

Browse files
Remove RPC Geometry Calls
1 parent 9920d1a commit 2c2afe4

5 files changed

Lines changed: 41 additions & 93 deletions

File tree

vcell-api/src/main/java/org/vcell/rest/rpc/RpcDbServerProxy.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ public org.vcell.util.document.VCDocumentInfo curate(CurateSpec curateSpec) thro
3636
return (org.vcell.util.document.VCDocumentInfo)rpc("curate",new Object[]{userLoginInfo.getUser(),curateSpec});
3737
}
3838

39-
public void deleteGeometry(org.vcell.util.document.KeyValue geometryKey) throws DataAccessException, ObjectNotFoundException {
40-
rpc("deleteGeometry",new Object[]{userLoginInfo.getUser(), geometryKey});
41-
}
42-
4339

4440
public void deleteResultSetExport(org.vcell.util.document.KeyValue eleKey) throws DataAccessException {
4541
rpc("deleteResultSetExport",new Object[]{userLoginInfo.getUser(), eleKey});
@@ -74,18 +70,6 @@ public cbit.vcell.model.ReactionDescription[] getDictionaryReactions(ReactionQue
7470
return (cbit.vcell.model.ReactionDescription[])rpc("getDictionaryReactions",new Object[]{userLoginInfo.getUser(), reactionQuerySpec});
7571
}
7672

77-
public cbit.vcell.geometry.GeometryInfo getGeometryInfo(org.vcell.util.document.KeyValue key) throws DataAccessException, ObjectNotFoundException {
78-
return (cbit.vcell.geometry.GeometryInfo)rpc("getGeometryInfo",new Object[]{userLoginInfo.getUser(),key});
79-
}
80-
81-
public cbit.vcell.geometry.GeometryInfo[] getGeometryInfos(boolean bAll) throws DataAccessException {
82-
return (cbit.vcell.geometry.GeometryInfo[])rpc("getGeometryInfos",new Object[]{userLoginInfo.getUser(), new Boolean(bAll)});
83-
}
84-
85-
public BigString getGeometryXML(org.vcell.util.document.KeyValue key) throws DataAccessException {
86-
return (BigString)rpc("getGeometryXML",new Object[]{userLoginInfo.getUser(), key});
87-
}
88-
8973
public org.vcell.util.Preference[] getPreferences() throws DataAccessException {
9074
return (org.vcell.util.Preference[])rpc("getPreferences",new Object[]{userLoginInfo.getUser()});
9175
}
@@ -180,14 +164,6 @@ private Object rpc(String methodName, Object[] args) throws ObjectNotFoundExcept
180164
}
181165
}
182166

183-
public BigString saveGeometry(BigString geometryXML) throws DataAccessException, ObjectNotFoundException {
184-
return (BigString)rpc("saveGeometry",new Object[]{userLoginInfo.getUser(), geometryXML});
185-
}
186-
187-
public BigString saveGeometryAs(BigString geometryXML, java.lang.String newName) throws DataAccessException, ObjectNotFoundException {
188-
return (BigString)rpc("saveGeometryAs",new Object[]{userLoginInfo.getUser(), geometryXML, newName});
189-
}
190-
191167
public org.vcell.util.BigString saveSimulation(org.vcell.util.BigString simulationXML, boolean bForceIndependent) throws DataAccessException {
192168
return (BigString)rpc("saveSimulation",new Object[]{userLoginInfo.getUser(), simulationXML, new Boolean(bForceIndependent)});
193169
}

vcell-apiclient/src/main/java/org/vcell/api/client/VCellApiClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
import org.vcell.restclient.ApiException;
3737
import org.vcell.restclient.CustomApiClientCode;
3838
import org.vcell.restclient.CustomObjectMapper;
39-
import org.vcell.restclient.api.BioModelResourceApi;
40-
import org.vcell.restclient.api.FieldDataResourceApi;
41-
import org.vcell.restclient.api.MathModelResourceApi;
42-
import org.vcell.restclient.api.UsersResourceApi;
39+
import org.vcell.restclient.api.*;
4340
import org.vcell.restclient.auth.InteractiveLogin;
4441
import org.vcell.restclient.model.AccesTokenRepresentationRecord;
4542
import org.vcell.restclient.model.UserIdentityJSONSafe;
@@ -347,6 +344,8 @@ public MathModelResourceApi getMathModelApi(){
347344
return new MathModelResourceApi(apiClient);
348345
}
349346

347+
public GeometryResourceApi getGeometryApi(){return new GeometryResourceApi(apiClient);}
348+
350349
public String getVCellUserNameFromAuth0Mapping() throws ApiException {
351350
try {
352351
UsersResourceApi usersResourceApi = new UsersResourceApi(apiClient);

vcell-apiclient/src/main/java/org/vcell/api/messaging/LocalUserMetaDbServerMessaging.java

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package org.vcell.api.messaging;
1212

1313
import cbit.vcell.field.FieldDataAllDBEntries;
14+
import cbit.vcell.geometry.GeometryInfo;
1415
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
1516
import cbit.vcell.message.server.bootstrap.client.RpcDbServerProxy;
1617
import cbit.vcell.message.server.bootstrap.client.RpcSender;
@@ -140,13 +141,10 @@ public void deleteGeometry(org.vcell.util.document.KeyValue key) throws DataAcce
140141

141142
try {
142143
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.deleteGeometry(Key="+key+")");
143-
dbServerProxy.deleteGeometry(key);
144-
} catch (DataAccessException e) {
145-
lg.error(e.getMessage(),e);
146-
throw e;
147-
} catch (Throwable e) {
148-
lg.error(e.getMessage(),e);
149-
throw new DataAccessException(e.getMessage());
144+
vCellApiClient.getGeometryApi().deleteGeometry(key.toString());
145+
} catch (ApiException e) {
146+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
147+
throw new RuntimeException("Expected error handler to throw an error.", e);
150148
}
151149
}
152150

@@ -364,13 +362,10 @@ public cbit.vcell.geometry.GeometryInfo getGeometryInfo(org.vcell.util.document.
364362

365363
try {
366364
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.getGeometryInfo(key="+geoKey+")");
367-
return dbServerProxy.getGeometryInfo(geoKey);
368-
} catch (DataAccessException e) {
369-
lg.error(e.getMessage(),e);
370-
throw e;
371-
} catch (Throwable e) {
372-
lg.error(e.getMessage(),e);
373-
throw new DataAccessException(e.getMessage());
365+
return DtoModelTransforms.geometrySummaryToGeometryInfo(vCellApiClient.getGeometryApi().getGeometrySummary(geoKey.toString()));
366+
} catch (ApiException e) {
367+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
368+
throw new RuntimeException("Expected error handler to throw an error.", e);
374369
}
375370
}
376371

@@ -379,13 +374,15 @@ public cbit.vcell.geometry.GeometryInfo[] getGeometryInfos(boolean bAll) throws
379374

380375
try {
381376
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.getGeometryInfos(bAll="+bAll+")");
382-
return dbServerProxy.getGeometryInfos(bAll);
383-
} catch (DataAccessException e) {
384-
lg.error(e.getMessage(),e);
385-
throw e;
386-
} catch (Throwable e) {
387-
lg.error(e.getMessage(),e);
388-
throw new DataAccessException(e.getMessage());
377+
List<GeometrySummary> summaries = vCellApiClient.getGeometryApi().getGeometrySummaries(bAll);
378+
GeometryInfo[] infos = new GeometryInfo[summaries.size()];
379+
for(int i = 0; i < summaries.size(); i++){
380+
infos[i] = DtoModelTransforms.geometrySummaryToGeometryInfo(summaries.get(i));
381+
}
382+
return infos;
383+
} catch (ApiException e) {
384+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
385+
throw new RuntimeException("Expected error handler to throw an error.", e);
389386
}
390387
}
391388

@@ -398,14 +395,10 @@ public BigString getGeometryXML(KeyValue geometryKey) throws DataAccessException
398395

399396
try {
400397
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.getGeometryXML(key="+geometryKey+")");
401-
BigString geometryXML = dbServerProxy.getGeometryXML(geometryKey);
402-
return geometryXML;
403-
} catch (DataAccessException e) {
404-
lg.error(e.getMessage(),e);
405-
throw e;
406-
} catch (Throwable e) {
407-
lg.error(e.getMessage(),e);
408-
throw new DataAccessException(e.getMessage());
398+
return new BigString(vCellApiClient.getGeometryApi().getGeometryVCML(geometryKey.toString()));
399+
} catch (ApiException e) {
400+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
401+
throw new RuntimeException("Expected error handler to throw an error.", e);
409402
}
410403

411404
}
@@ -860,14 +853,10 @@ public BigString saveGeometry(BigString geometryXML) throws DataAccessException
860853

861854
try {
862855
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.saveGeometry()");
863-
BigString savedGeometryXML = dbServerProxy.saveGeometry(geometryXML);
864-
return savedGeometryXML;
865-
} catch (DataAccessException e) {
866-
lg.error(e.getMessage(),e);
867-
throw e;
868-
} catch (Throwable e) {
869-
lg.error(e.getMessage(),e);
870-
throw new DataAccessException(e.getMessage());
856+
return new BigString(vCellApiClient.getGeometryApi().saveGeometry(geometryXML.toString(), null));
857+
} catch (ApiException e) {
858+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
859+
throw new RuntimeException("Expected error handler to throw an error.", e);
871860
}
872861

873862
}
@@ -881,14 +870,10 @@ public BigString saveGeometryAs(BigString geometryXML, String newName) throws Da
881870

882871
try {
883872
if (lg.isTraceEnabled()) lg.trace("LocalUserMetaDbServerMessaging.saveGeometryAs(newName="+newName+")");
884-
BigString savedGeometryXML = dbServerProxy.saveGeometryAs(geometryXML,newName);
885-
return savedGeometryXML;
886-
} catch (DataAccessException e) {
887-
lg.error(e.getMessage(),e);
888-
throw e;
889-
} catch (Throwable e) {
890-
lg.error(e.getMessage(),e);
891-
throw new DataAccessException(e.getMessage());
873+
return new BigString(vCellApiClient.getGeometryApi().saveGeometry(geometryXML.toString(), newName));
874+
} catch (ApiException e) {
875+
ExceptionHandler.onlyDataAccessOrPermissionException(e);
876+
throw new RuntimeException("Expected error handler to throw an error.", e);
892877
}
893878

894879
}

vcell-core/src/main/java/cbit/vcell/message/server/bootstrap/client/RpcDbServerProxy.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,6 @@ public cbit.vcell.model.ReactionDescription[] getDictionaryReactions(ReactionQue
7474
return (cbit.vcell.model.ReactionDescription[])rpc("getDictionaryReactions",new Object[]{userLoginInfo.getUser(), reactionQuerySpec});
7575
}
7676

77-
public cbit.vcell.geometry.GeometryInfo getGeometryInfo(org.vcell.util.document.KeyValue key) throws DataAccessException, ObjectNotFoundException {
78-
return (cbit.vcell.geometry.GeometryInfo)rpc("getGeometryInfo",new Object[]{userLoginInfo.getUser(),key});
79-
}
80-
81-
public cbit.vcell.geometry.GeometryInfo[] getGeometryInfos(boolean bAll) throws DataAccessException {
82-
return (cbit.vcell.geometry.GeometryInfo[])rpc("getGeometryInfos",new Object[]{userLoginInfo.getUser(), new Boolean(bAll)});
83-
}
84-
85-
public BigString getGeometryXML(org.vcell.util.document.KeyValue key) throws DataAccessException {
86-
return (BigString)rpc("getGeometryXML",new Object[]{userLoginInfo.getUser(), key});
87-
}
88-
8977
public org.vcell.util.Preference[] getPreferences() throws DataAccessException {
9078
return (org.vcell.util.Preference[])rpc("getPreferences",new Object[]{userLoginInfo.getUser()});
9179
}
@@ -187,14 +175,6 @@ private Object rpc(String methodName, Object[] args) throws ObjectNotFoundExcept
187175
}
188176
}
189177

190-
public BigString saveGeometry(BigString geometryXML) throws DataAccessException, ObjectNotFoundException {
191-
return (BigString)rpc("saveGeometry",new Object[]{userLoginInfo.getUser(), geometryXML});
192-
}
193-
194-
public BigString saveGeometryAs(BigString geometryXML, java.lang.String newName) throws DataAccessException, ObjectNotFoundException {
195-
return (BigString)rpc("saveGeometryAs",new Object[]{userLoginInfo.getUser(), geometryXML, newName});
196-
}
197-
198178
public org.vcell.util.BigString saveSimulation(org.vcell.util.BigString simulationXML, boolean bForceIndependent) throws DataAccessException {
199179
return (BigString)rpc("saveSimulation",new Object[]{userLoginInfo.getUser(), simulationXML, new Boolean(bForceIndependent)});
200180
}

vcell-restclient/src/main/java/org/vcell/restclient/utils/DtoModelTransforms.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import cbit.vcell.field.FieldDataAllDBEntries;
55
import cbit.vcell.field.io.FieldData;
6+
import cbit.vcell.geometry.GeometryInfo;
67
import cbit.vcell.math.Variable;
78
import cbit.vcell.math.VariableType;
89
import cbit.vcell.simdata.DataIdentifier;
@@ -278,4 +279,11 @@ public static MathModelInfo mathModelContextToMathModel(MathModelSummary summary
278279
);
279280
}
280281

282+
public static GeometryInfo geometrySummaryToGeometryInfo(org.vcell.restclient.model.GeometrySummary summary){
283+
return new GeometryInfo(DtoModelTransforms.versionDTOToVersion(summary.getVersion()),
284+
summary.getDimension(), DtoModelTransforms.dtoToExtent(summary.getExtent()),
285+
DtoModelTransforms.dtoToOrigin(summary.getOrigin()), new KeyValue(summary.getImageRef()),
286+
DtoModelTransforms.dtoToVCellSoftwareVersion(summary.getSoftwareVersion()));
287+
}
288+
281289
}

0 commit comments

Comments
 (0)