use of net.geoprism.registry.etl.export.UnexpectedRemoteResponse in project geoprism-registry by terraframe.
the class DHIS2OptionCache method init.
private void init() {
try {
MetadataGetResponse<OptionSet> resp = dhis2.<OptionSet>metadataGet(OptionSet.class);
if (!resp.isSuccess()) {
// if (resp.hasMessage())
// {
// ExportRemoteException ere = new ExportRemoteException();
// ere.setRemoteError(resp.getMessage());
// throw ere;
// }
// else
// {
UnexpectedRemoteResponse re = new UnexpectedRemoteResponse();
throw re;
// }
}
List<OptionSet> objects = resp.getObjects();
this.optionSets = new HashMap<String, IntegratedOptionSet>(objects.size());
for (OptionSet os : objects) {
this.optionSets.put(os.getId(), new IntegratedOptionSet(os));
}
if (this.optionSets.size() > 0) {
MetadataGetResponse<Option> resp2 = dhis2.<Option>metadataGet(Option.class);
if (!resp2.isSuccess()) {
// if (resp.hasMessage())
// {
// ExportRemoteException ere = new ExportRemoteException();
// ere.setRemoteError(resp.getMessage());
// throw ere;
// }
// else
// {
UnexpectedRemoteResponse re = new UnexpectedRemoteResponse();
throw re;
// }
}
List<Option> options = resp2.getObjects();
for (Option option : options) {
if (option.getOptionSetId() != null && this.optionSets.containsKey(option.getOptionSetId())) {
this.optionSets.get(option.getOptionSetId()).addOption(option);
}
}
}
} catch (InvalidLoginException e) {
LoginException cgrlogin = new LoginException(e);
throw cgrlogin;
} catch (HTTPException e) {
HttpError cgrhttp = new HttpError(e);
throw cgrhttp;
} catch (BadServerUriException e) {
HttpError cgrhttp = new HttpError(e);
throw cgrhttp;
}
}
use of net.geoprism.registry.etl.export.UnexpectedRemoteResponse in project geoprism-registry by terraframe.
the class DHIS2FeatureService method getDHIS2Attributes.
private List<Attribute> getDHIS2Attributes(DHIS2TransportServiceIF dhis2) {
try {
MetadataGetResponse<Attribute> resp = dhis2.<Attribute>metadataGet(Attribute.class);
if (!resp.isSuccess()) {
// if (resp.hasMessage())
// {
// ExportRemoteException ere = new ExportRemoteException();
// ere.setRemoteError(resp.getMessage());
// throw ere;
// }
// else
// {
UnexpectedRemoteResponse re = new UnexpectedRemoteResponse();
throw re;
// }
}
List<Attribute> attrs = resp.getObjects();
attrs.addAll(buildDefaultDhis2OrgUnitAttributes());
return attrs;
} catch (InvalidLoginException e) {
LoginException cgrlogin = new LoginException(e);
throw cgrlogin;
} catch (HTTPException | BadServerUriException e) {
HttpError cgrhttp = new HttpError(e);
throw cgrhttp;
}
}
use of net.geoprism.registry.etl.export.UnexpectedRemoteResponse in project geoprism-registry by terraframe.
the class DHIS2FeatureService method validateDhis2Response.
public void validateDhis2Response(DHIS2Response resp) {
if (!resp.isSuccess()) {
if (resp.hasMessage()) {
ExportRemoteException ere = new ExportRemoteException();
ere.setRemoteError(resp.getMessage());
throw ere;
} else {
UnexpectedRemoteResponse re = new UnexpectedRemoteResponse();
throw re;
}
}
}
Aggregations