@Override public int compare(final FacetedMethod o1, final FacetedMethod o2) { final Identifier identifier1 = o1.getIdentifier(); final Identifier identifier2 = o2.getIdentifier(); return identifier1.compareTo(identifier2); }
@Override public Identifier getIdentifier() { return getFacetedMethod().getIdentifier(); }
private FacetedMethod getMemberWithName(final String name) { final String searchName = NameUtils.simpleName(name); for (int i = 0; i < members.size(); i++) { final FacetedMethod member = members.get(i); if (member != null) { final String testName = NameUtils.simpleName(member.getIdentifier().getMemberName()); if (testName.equals(searchName)) { members.set(i, null); return member; } } } return null; }
@Override public String toString() { return getFeatureType().name() + " Peer [identifier=\"" + getIdentifier() + "\",type=" + getType().getName() + " ]"; }
@Override protected String determineColumnName(final ObjectAssociation objectAssociation) { if (objectAssociation instanceof OneToManyAssociationImpl) { final OneToManyAssociationImpl fkAssoc = (OneToManyAssociationImpl) objectAssociation; final FacetedMethod peer = fkAssoc.getFacetedMethod(); final String fullClassName = peer.getIdentifier().getClassName(); final int lastPos = fullClassName.lastIndexOf('.'); return fullClassName.substring(lastPos + 1) + "_" + fkAssoc.getId(); } else { return objectAssociation.getSpecification().getShortIdentifier(); } } }
protected ObjectMemberAbstract(final FacetedMethod facetedMethod, final FeatureType featureType, final ObjectMemberContext objectMemberContext) { final String id = facetedMethod.getIdentifier().getMemberName(); if (id == null) { throw new IllegalArgumentException("Name must always be set"); } this.facetedMethod = facetedMethod; this.featureType = featureType; this.id = id; this.defaultName = NameUtils.naturalName(this.id); this.authenticationSessionProvider = objectMemberContext.getAuthenticationSessionProvider(); this.specificationLookup = objectMemberContext.getSpecificationLookup(); this.adapterMap = objectMemberContext.getAdapterManager(); this.querySubmitter = objectMemberContext.getQuerySubmitter(); this.collectionTypeRegistry = objectMemberContext.getCollectionTypeRegistry(); }
private void allowingPeerToReturnIdentifier() { context.checking(new Expectations() { { one(mockPeer).getIdentifier(); will(returnValue(Identifier.propertyOrCollectionIdentifier(Customer.class, COLLECTION_ID))); } }); }
@Before public void setUp() throws Exception { context.checking(new Expectations() {{ allowing(mockServicesInjector).lookupService(TranslationService.class); will(returnValue(mockTranslationService)); allowing(mockServicesInjector).getConfigurationServiceInternal(); will(returnValue(mockConfiguration)); allowing(mockServicesInjector).injectServicesInto(with(any(List.class))); allowing(mockFacetedMethod).getIdentifier(); will(returnValue(Identifier.actionIdentifier(Customer.class, "foo"))); }}); domainObjectClassWithoutAnnotation = DomainObjectWithoutMustSatisfyAnnotations.class; domainObjectClassWithAnnotation = DomainObjectWithMustSatisfyAnnotations.class; firstNameMethodWithout = domainObjectClassWithoutAnnotation.getMethod("getFirstName"); firstNameMethodWith = domainObjectClassWithAnnotation.getMethod("getFirstName"); facetFactory = new PropertyAnnotationFacetFactory(); facetFactory.setServicesInjector(mockServicesInjector); }
@Override @Before public void setUp() throws Exception { super.setUp(); mockFacetedMethod = mockery.mock(FacetedMethod.class); mockAuthenticationSessionProvider = mockery.mock(AuthenticationSessionProvider.class); mockSpecificationLookup = mockery.mock(SpecificationLookup.class); mockAdapterManager = mockery.mock(AdapterMap.class); mockServicesProvider = mockery.mock(ServicesProvider.class); mockQuerySubmitter = mockery.mock(QuerySubmitter.class); mockCollectionTypeRegistry = mockery.mock(CollectionTypeRegistry.class); mockery.checking(new Expectations() { { one(mockFacetedMethod).getIdentifier(); will(returnValue(Identifier.actionIdentifier("Customer", "reduceheadcount"))); } }); action = new ObjectActionImpl(mockFacetedMethod, new ObjectMemberContext(mockAuthenticationSessionProvider, mockSpecificationLookup, mockAdapterManager, mockQuerySubmitter, mockCollectionTypeRegistry), mockServicesProvider); }