use of com.liferay.ide.service.core.model.ServiceBuilder in project liferay-ide by liferay.
the class PackagePathValidationService method compute.
@Override
public Status compute() {
ServiceBuilder serviceBuilderClass = context().find(ServiceBuilder.class);
Value<String> packagePath = serviceBuilderClass.getPackagePath();
String packPathVal = packagePath.content();
if (packPathVal == null) {
return Status.createErrorStatus(Msgs.packagePathNotEmpty);
}
// Use standard java conventions to validate the package name
IStatus javaStatus = JavaConventions.validatePackageName(packPathVal, CompilerOptions.VERSION_1_7, CompilerOptions.VERSION_1_7);
if (javaStatus.getSeverity() == IStatus.ERROR) {
return Status.createErrorStatus(J2EECommonMessages.ERR_JAVA_PACAKGE_NAME_INVALID + javaStatus.getMessage());
}
if (javaStatus.getSeverity() == IStatus.WARNING) {
return Status.createWarningStatus(J2EECommonMessages.ERR_JAVA_PACKAGE_NAME_WARNING + javaStatus.getMessage());
}
return Status.createOkStatus();
}
use of com.liferay.ide.service.core.model.ServiceBuilder in project liferay-ide by liferay.
the class ToggleDiagramConnectionLabelsActionHandler method run.
@Override
protected Object run(Presentation context) {
checked = !checked;
ServiceBuilder serviceBuilder = (ServiceBuilder) context.part().getModelElement();
serviceBuilder.setShowRelationshipLabels(checked);
serviceBuilder.refresh();
return null;
}
use of com.liferay.ide.service.core.model.ServiceBuilder in project liferay-ide by liferay.
the class ServiceXmlTests method testEntityReferenceService.
@Test
public void testEntityReferenceService() throws Exception {
ServiceBuilder sb = ServiceBuilder6xx.TYPE.instantiate(new RootXmlResource(new XmlResourceStore(this.getClass().getResourceAsStream("files/entity-reference-test.xml"))));
Entity foo = sb.getEntities().get(0);
Entity bar = sb.getEntities().get(1);
ElementList<Relationship> relationships = sb.getRelationships();
assertEquals(1, relationships.size());
Entity to = sb.getRelationships().get(0).getToEntity().target();
Entity from = sb.getRelationships().get(0).getFromEntity().target();
assertEquals(to, foo);
assertEquals(from, bar);
}
use of com.liferay.ide.service.core.model.ServiceBuilder in project liferay-ide by liferay.
the class NamespaceValidationService method compute.
@Override
public Status compute() {
ServiceBuilder namespaceClass = context().find(ServiceBuilder.class);
Value<String> namespace = namespaceClass.getNamespace();
String content = namespace.content();
if ((content != null) && !ServiceUtil.isValidNamespace(content.toString())) {
return Status.createErrorStatus(Msgs.namespaceElementValidKeyword);
}
return Status.createOkStatus();
}
use of com.liferay.ide.service.core.model.ServiceBuilder in project liferay-ide by liferay.
the class RelationshipResource method _persistRelationship.
private void _persistRelationship() {
Element element = parent().element();
ServiceBuilder serviceBuilder = element.nearest(ServiceBuilder.class);
String fromName = _relationshipObject.getFromName();
String toName = _relationshipObject.getToName();
Entity fromEntity = EntityRelationshipService.findEntity(fromName, serviceBuilder);
Entity toEntity = EntityRelationshipService.findEntity(toName, serviceBuilder);
if ((fromEntity != null) && (toEntity != null)) {
Column primaryKeyColumn = null;
for (Column column : toEntity.getColumns()) {
if (column.isPrimary().content()) {
primaryKeyColumn = column;
break;
}
}
if (primaryKeyColumn != null) {
Column column = fromEntity.getColumns().insert();
column.setName(primaryKeyColumn.getName().content());
column.setType("long");
}
}
}
Aggregations