use of net.geoprism.registry.service.SearchService in project geoprism-registry by terraframe.
the class SearchTablePatch method doIt.
@Transaction
private void doIt() {
SearchService service = new SearchService();
service.createSearchTable();
createRecords(service);
}
use of net.geoprism.registry.service.SearchService in project geoprism-registry by terraframe.
the class ServerGeoObjectType method deleteInTransaction.
@Transaction
private void deleteInTransaction() {
List<ServerHierarchyType> hierarchies = this.getHierarchies(true);
if (hierarchies.size() > 0) {
StringBuilder codes = hierarchies.stream().collect(StringBuilder::new, (x, y) -> x.append(y.getCode()), (a, b) -> a.append(",").append(b));
throw new TypeInUseException("Cannot delete a GeoObjectType used in the hierarchies: " + codes);
}
// for (String hierarchy : hierarchies)
// {
// OIterator<com.runwaysdk.business.ontology.Term> it =
// this.universal.getDirectDescendants(hierarchy);
//
// try
// {
// if (it.hasNext())
// {
// }
// }
// finally
// {
// it.close();
// }
// }
/*
* Delete all subtypes
*/
List<ServerGeoObjectType> subtypes = this.getSubtypes();
for (ServerGeoObjectType subtype : subtypes) {
subtype.deleteInTransaction();
}
/*
* Delete all inherited hierarchies
*/
List<? extends InheritedHierarchyAnnotation> annotations = InheritedHierarchyAnnotation.getByUniversal(getUniversal());
for (InheritedHierarchyAnnotation annotation : annotations) {
annotation.delete();
}
GeoVertexType.remove(this.universal.getUniversalId());
/*
* Delete all Attribute references
*/
// AttributeHierarchy.deleteByUniversal(this.universal);
this.getMetadata().delete();
// This deletes the {@link MdBusiness} as well
this.universal.delete(false);
// Delete the term root
Classifier classRootTerm = TermConverter.buildIfNotExistdMdBusinessClassifier(this.mdBusiness);
classRootTerm.delete();
// roles specified on the super type.
if (this.getSuperType() == null) {
Actor ownerActor = this.universal.getOwner();
if (ownerActor instanceof Roles) {
Roles ownerRole = (Roles) ownerActor;
String roleName = ownerRole.getRoleName();
if (RegistryRole.Type.isOrgRole(roleName)) {
String organizationCode = RegistryRole.Type.parseOrgCode(roleName);
String geoObjectTypeCode = this.type.getCode();
String rmRoleName = RegistryRole.Type.getRM_RoleName(organizationCode, geoObjectTypeCode);
Roles role = Roles.findRoleByName(rmRoleName);
role.delete();
String rcRoleName = RegistryRole.Type.getRC_RoleName(organizationCode, geoObjectTypeCode);
role = Roles.findRoleByName(rcRoleName);
role.delete();
String acRoleName = RegistryRole.Type.getAC_RoleName(organizationCode, geoObjectTypeCode);
role = Roles.findRoleByName(acRoleName);
role.delete();
}
}
}
ListType.markAllAsInvalid(null, this);
new SearchService().clear(this.getCode());
new ChangeRequestService().markAllAsInvalid(this);
// Delete the transition and transition events
TransitionEvent.removeAll(this);
Transition.removeAll(this);
}
use of net.geoprism.registry.service.SearchService in project geoprism-registry by terraframe.
the class VertexServerGeoObject method apply.
@Override
public void apply(boolean isImport) {
if (!isImport && !this.vertex.isNew() && !this.getType().isGeometryEditable() && this.vertex.isModified(this.getGeometryAttributeName())) {
throw new GeometryUpdateException();
}
if (this.vertex.isNew() || this.vertex.getObjectValue(GeoVertex.CREATEDATE) == null) {
this.vertex.setValue(GeoVertex.CREATEDATE, new Date());
}
this.vertex.setValue(GeoVertex.LASTUPDATEDATE, new Date());
if (this.getInvalid() == null) {
this.setInvalid(false);
}
this.validate();
try {
this.getVertex().apply();
} catch (CreatePermissionException ex) {
CreateGeoObjectPermissionException goex = new CreateGeoObjectPermissionException();
goex.setGeoObjectType(this.getType().getLabel().getValue());
goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
throw goex;
} catch (WritePermissionException ex) {
WriteGeoObjectPermissionException goex = new WriteGeoObjectPermissionException();
goex.setGeoObjectType(this.getType().getLabel().getValue());
goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
throw goex;
} catch (ReadPermissionException ex) {
ReadGeoObjectPermissionException goex = new ReadGeoObjectPermissionException();
goex.setGeoObjectType(this.getType().getLabel().getValue());
goex.setOrganization(this.getType().getOrganization().getDisplayLabel().getValue());
throw goex;
}
if (!this.getInvalid()) {
new SearchService().insert(this);
} else {
new SearchService().remove(this.getCode());
}
}
Aggregations