use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class CRAttributePatch method patchAllGos.
private void patchAllGos() {
for (Universal uni : getUniversals()) {
MdGeoVertexDAO mdVertex = GeoVertexType.getMdGeoVertex(uni.getUniversalId());
List<? extends MdAttributeDAOIF> attributes = mdVertex.getAllDefinedMdAttributes();
String[] skipAttrs = new String[] { DefaultAttribute.UID.getName(), "uuid", DefaultAttribute.CODE.getName(), DefaultAttribute.CREATE_DATE.getName(), DefaultAttribute.LAST_UPDATE_DATE.getName(), DefaultAttribute.SEQUENCE.getName(), DefaultAttribute.TYPE.getName(), MdAttributeConcreteInfo.OID, MdAttributeConcreteInfo.SEQUENCE };
StringBuilder statement = new StringBuilder();
statement.append("SELECT FROM " + mdVertex.getDBClassName());
GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(statement.toString());
List<VertexObject> results = query.getResults();
logger.info("Updating [" + results.size() + "] objects on table [" + mdVertex.getDBClassName() + "].");
for (VertexObject vo : query.getResults()) {
for (MdAttributeDAOIF attr : attributes) {
if (!ArrayUtils.contains(skipAttrs, attr.definesAttribute())) {
ValueOverTimeCollection col = vo.getValuesOverTime(attr.definesAttribute());
for (ValueOverTime vot : col) {
vot.setOid(UUID.randomUUID().toString());
}
}
}
vo.apply();
}
}
}
use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class SearchTablePatch method createRecords.
@Transaction
public void createRecords(SearchService service) {
MdVertexDAOIF mdVertex = MdVertexDAO.getMdVertexDAO(GeoVertex.CLASS);
long pageSize = 1000;
long skip = 0;
int count = 0;
do {
StringBuilder builder = new StringBuilder();
builder.append("SELECT FROM " + mdVertex.getDBClassName());
builder.append(" ORDER BY oid");
builder.append(" SKIP " + skip + " LIMIT " + pageSize);
GraphQuery<VertexObject> query = new GraphQuery<VertexObject>(builder.toString());
List<VertexObject> results = query.getResults();
for (VertexObject result : results) {
ServerGeoObjectType type = ServerGeoObjectType.get((MdVertexDAOIF) result.getMdClass());
service.insert(new VertexServerGeoObject(type, result));
}
skip += pageSize;
count = results.size();
} while (count > 0);
}
use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class VertexGeoObjectStrategy method constructFromGeoObject.
@Override
public VertexServerGeoObject constructFromGeoObject(GeoObject geoObject, boolean isNew) {
if (!isNew) {
VertexObject vertex = VertexServerGeoObject.getVertex(type, geoObject.getUid());
if (vertex == null) {
InvalidRegistryIdException ex = new InvalidRegistryIdException();
ex.setRegistryId(geoObject.getUid());
throw ex;
}
return new VertexServerGeoObject(type, vertex);
} else {
if (!RegistryIdService.getInstance().isIssuedId(geoObject.getUid())) {
InvalidRegistryIdException ex = new InvalidRegistryIdException();
ex.setRegistryId(geoObject.getUid());
throw ex;
}
VertexObject vertex = VertexServerGeoObject.newInstance(type);
return new VertexServerGeoObject(type, vertex);
}
}
use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class BusinessObjectImporter method setClassificationValue.
protected void setClassificationValue(BusinessObject entity, AttributeType attributeType, String attributeName, Object value) {
if (!this.configuration.isExclusion(attributeName, value.toString())) {
try {
BusinessType type = this.configuration.getType();
MdVertexDAOIF mdBusiness = type.getMdVertexDAO();
MdAttributeClassificationDAOIF mdAttribute = (MdAttributeClassificationDAOIF) mdBusiness.definesAttribute(attributeName);
VertexObject classifier = AbstractClassification.findMatchingClassification(value.toString().trim(), mdAttribute);
if (classifier == null) {
throw new UnknownTermException(value.toString().trim(), attributeType);
} else {
entity.setValue(attributeName, classifier.getOid());
}
} catch (UnknownTermException e) {
TermValueException ex = new TermValueException();
ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
ex.setCode(e.getCode());
throw e;
}
}
}
use of com.runwaysdk.business.graph.VertexObject in project geoprism-registry by terraframe.
the class ServerGeoObjectService method build.
public ServerGeoObjectIF build(ServerGeoObjectType type, String runwayId) {
ServerGeoObjectStrategyIF strategy = this.getStrategy(type);
VertexObject vertex = VertexObject.get(type.getMdVertex(), runwayId);
return strategy.constructFromDB(vertex);
}
Aggregations