Browse Source

Remove classes.

1.0.x
Ben Alex 20 years ago
parent
commit
a5d33af2e6
  1. 38
      domain/src/main/java/org/acegisecurity/domain/service/CreatableManager.java
  2. 36
      domain/src/main/java/org/acegisecurity/domain/service/CreatableManagerImpl.java
  3. 35
      domain/src/main/java/org/acegisecurity/domain/service/Manager.java
  4. 37
      domain/src/main/java/org/acegisecurity/domain/service/ManagerImpl.java
  5. 51
      domain/src/main/java/org/acegisecurity/domain/service/UpdatableManager.java
  6. 52
      domain/src/main/java/org/acegisecurity/domain/service/UpdatableManagerImpl.java

38
domain/src/main/java/org/acegisecurity/domain/service/CreatableManager.java

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
/**
* Adds a creation method to the <code>ImmutableManager</code>.
*
* @author Ben Alex
* @version $Id$
*/
public interface CreatableManager<E extends PersistableEntity> extends ImmutableManager<E> {
//~ Methods ================================================================
/**
* Create a new object, with the current {@link
* PersistableEntity#getInternalId()} value being ignored.
*
* @param value (without the identity property initialized)
*
* @return the value created (with the identity property initialised)
*/
public E create(E value);
}

36
domain/src/main/java/org/acegisecurity/domain/service/CreatableManagerImpl.java

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
import org.springframework.util.Assert;
/**
* Base {@link CreatableManager} implementation.
*
* @author Ben Alex
* @version $Id$
*/
public class CreatableManagerImpl<E extends PersistableEntity> extends ImmutableManagerImpl<E> implements CreatableManager<E> {
public E create(E value) {
Assert.notNull(value);
if (logger.isDebugEnabled()) {
logger.debug("Creating: " + value);
}
return dao.create(value);
}
}

35
domain/src/main/java/org/acegisecurity/domain/service/Manager.java

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
/**
* Adds a deletion method to <code>UpdatableManager</code>, thus providing CRUD
* use case support.
*
* @author Ben Alex
* @version $Id$
*/
public interface Manager<E extends PersistableEntity> extends UpdatableManager<E> {
//~ Methods ================================================================
/**
* Delete an object.
*
* @param value the value to delete
*/
public void delete(E value);
}

37
domain/src/main/java/org/acegisecurity/domain/service/ManagerImpl.java

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
import org.springframework.util.Assert;
/**
* Base {@link Manager} implementation.
*
* @author Ben Alex
* @version $Id$
*/
public class ManagerImpl<E extends PersistableEntity> extends UpdatableManagerImpl<E> implements Manager<E> {
public void delete(E value) {
Assert.notNull(value);
if (logger.isDebugEnabled()) {
logger.debug("Deleting: " + value);
}
dao.delete(value);
}
}

51
domain/src/main/java/org/acegisecurity/domain/service/UpdatableManager.java

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
/**
* Adds update (but no delete) methods to the <code>CreatableManager</code>.
*
* @author Ben Alex
* @version $Id$
*/
public interface UpdatableManager<E extends PersistableEntity> extends CreatableManager<E> {
//~ Methods ================================================================
/**
* Saves an existing object to the persistence layer, or creates a new
* object in the persistence layer. Implementations typically rely on
* {@link PersistableEntity#getInternalId()} being non-<code>null</code>
* to differentiate between persistence instances previous saved and those
* requiring initial creation.
*
* @param value to save or update
*
* @return the saved or updated (as appropriate) value
*/
public E createOrUpdate(E value);
/**
* Update an object.
*
* @param value to update, with the <code>PersistableEntity</code> having a
* non-<code>null</code> identifier
*
* @return the updated value
*/
public E update(E value);
}

52
domain/src/main/java/org/acegisecurity/domain/service/UpdatableManagerImpl.java

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity.domain.service;
import org.acegisecurity.domain.PersistableEntity;
import org.springframework.util.Assert;
/**
* Base {@link UpdatableManager} implementation.
*
* @author Ben Alex
* @version $Id$
*/
public class UpdatableManagerImpl<E extends PersistableEntity> extends CreatableManagerImpl<E> implements UpdatableManager<E> {
public E update(E value) {
Assert.notNull(value);
if (logger.isDebugEnabled()) {
logger.debug("Updating: " + value);
}
return dao.update(value);
}
/**
* Delegates to the appropriate services layer method (not the DAO).
*/
public E createOrUpdate(E value) {
Assert.notNull(value);
if (logger.isDebugEnabled()) {
logger.debug("CreatingOrUpdating: " + value);
}
if (value.getInternalId() == null) {
return create(value);
} else {
return update(value);
}
}
}
Loading…
Cancel
Save